mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-12 10:49:50 +01:00
input-capture: impl force release
This commit is contained in:
parent
93da5ffb12
commit
4fc4388283
6 changed files with 3199 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
#include "../protocols/ShortcutsInhibit.hpp"
|
||||
#include "../protocols/GlobalShortcuts.hpp"
|
||||
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
||||
#include "../devices/IKeyboard.hpp"
|
||||
#include "KeybindManager.hpp"
|
||||
#include "PointerManager.hpp"
|
||||
#include "Compositor.hpp"
|
||||
|
@ -13,6 +14,7 @@
|
|||
#include "debug/Log.hpp"
|
||||
#include "helpers/varlist/VarList.hpp"
|
||||
#include "../helpers/signal/Signal.hpp"
|
||||
#include "protocols/InputCapture.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <iterator>
|
||||
|
@ -131,6 +133,7 @@ CKeybindManager::CKeybindManager() {
|
|||
m_mDispatchers["event"] = event;
|
||||
m_mDispatchers["global"] = global;
|
||||
m_mDispatchers["setprop"] = setProp;
|
||||
m_mDispatchers["releaseinputcapture"] = releaseInputCapture;
|
||||
|
||||
m_tScrollTimer.reset();
|
||||
|
||||
|
@ -3160,3 +3163,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
|||
|
||||
return {};
|
||||
}
|
||||
SDispatchResult CKeybindManager::releaseInputCapture(std::string args) {
|
||||
PROTO::inputCapture->forceRelease();
|
||||
return {};
|
||||
}
|
||||
|
|
3180
src/managers/KeybindManager.cpp.orig
Normal file
3180
src/managers/KeybindManager.cpp.orig
Normal file
File diff suppressed because it is too large
Load diff
|
@ -220,6 +220,7 @@ class CKeybindManager {
|
|||
static SDispatchResult global(std::string);
|
||||
static SDispatchResult event(std::string);
|
||||
static SDispatchResult setProp(std::string);
|
||||
static SDispatchResult releaseInputCapture(std::string);
|
||||
|
||||
friend class CCompositor;
|
||||
friend class CInputManager;
|
||||
|
|
|
@ -1345,7 +1345,7 @@ void CInputManager::onKeyboardKey(std::any event, SP<IKeyboard> pKeyboard) {
|
|||
const auto EMAP = std::unordered_map<std::string, std::any>{{"keyboard", pKeyboard}, {"event", event}};
|
||||
EMIT_HOOK_EVENT_CANCELLABLE("keyPress", EMAP);
|
||||
|
||||
bool passEvent = !PROTO::inputCapture->isCaptured() && (DISALLOWACTION || g_pKeybindManager->onKeyEvent(event, pKeyboard));
|
||||
bool passEvent = (DISALLOWACTION || g_pKeybindManager->onKeyEvent(event, pKeyboard)) && !PROTO::inputCapture->isCaptured();
|
||||
|
||||
auto e = std::any_cast<IKeyboard::SKeyEvent>(event);
|
||||
|
||||
|
|
|
@ -67,6 +67,14 @@ void CInputCaptureProtocol::sendKeymap(SP<IKeyboard> keyboard, const std::unique
|
|||
close(fd);
|
||||
}
|
||||
|
||||
void CInputCaptureProtocol::forceRelease() {
|
||||
Debug::log(LOG, "[input-capture] Force Input released");
|
||||
active = false;
|
||||
|
||||
for (const auto& manager : m_vManagers)
|
||||
manager->sendForceRelease();
|
||||
}
|
||||
|
||||
void CInputCaptureProtocol::sendKey(uint32_t keyCode, hyprlandInputCaptureManagerV1KeyState state) {
|
||||
for (const auto& manager : m_vManagers)
|
||||
manager->sendKey(keyCode, state);
|
||||
|
|
|
@ -13,6 +13,8 @@ class CInputCaptureProtocol : public IWaylandProtocol {
|
|||
bool isCaptured();
|
||||
|
||||
void updateKeymap();
|
||||
void forceRelease();
|
||||
|
||||
void sendMotion(const Vector2D& absolutePosition, const Vector2D& delta);
|
||||
void sendKey(uint32_t keyCode, hyprlandInputCaptureManagerV1KeyState state);
|
||||
void sendButton(uint32_t button, hyprlandInputCaptureManagerV1ButtonState state);
|
||||
|
|
Loading…
Reference in a new issue