From 21a7251d0212dfffb6c11b930dfdd01f7f72bb9e Mon Sep 17 00:00:00 2001 From: Gwilherm Folliot Date: Tue, 17 Dec 2024 19:20:52 +0100 Subject: [PATCH] input-capture: send modifiers (highly experimental) --- src/managers/input/InputManager.cpp | 5 +++++ src/protocols/InputCapture.cpp | 6 ++++++ src/protocols/InputCapture.hpp | 1 + 3 files changed, 12 insertions(+) diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index e1cc0e09..19cbba03 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1384,6 +1384,11 @@ void CInputManager::onKeyboardMod(SP pKeyboard) { auto MODS = pKeyboard->modifiersState; MODS.depressed = ALLMODS; + PROTO::inputCapture->sendModifiers(MODS.depressed,MODS.latched, MODS.locked, MODS.group); + + if (PROTO::inputCapture->isCaptured()) + return; + const auto IME = m_sIMERelay.m_pIME.lock(); if (IME && IME->hasGrab() && !DISALLOWACTION) { diff --git a/src/protocols/InputCapture.cpp b/src/protocols/InputCapture.cpp index 52639113..c91d13f7 100644 --- a/src/protocols/InputCapture.cpp +++ b/src/protocols/InputCapture.cpp @@ -79,6 +79,12 @@ void CInputCaptureProtocol::sendKey(uint32_t keyCode, hyprlandInputCaptureManage manager->sendKey(keyCode, state); } +void CInputCaptureProtocol::sendModifiers(uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) { + for (const auto& manager : m_vManagers) + manager->sendModifiers(mods_depressed, mods_locked, mods_locked, group); +} + + void CInputCaptureProtocol::sendButton(uint32_t button, hyprlandInputCaptureManagerV1ButtonState state) { for (const auto& manager : m_vManagers) manager->sendButton(button, state); diff --git a/src/protocols/InputCapture.hpp b/src/protocols/InputCapture.hpp index f22f31b3..eb63bdd5 100644 --- a/src/protocols/InputCapture.hpp +++ b/src/protocols/InputCapture.hpp @@ -18,6 +18,7 @@ class CInputCaptureProtocol : public IWaylandProtocol { void sendMotion(const Vector2D& absolutePosition, const Vector2D& delta); void sendKey(uint32_t keyCode, hyprlandInputCaptureManagerV1KeyState state); + void sendModifiers(uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group); void sendButton(uint32_t button, hyprlandInputCaptureManagerV1ButtonState state); void sendAxis(hyprlandInputCaptureManagerV1Axis axis, double value); void sendAxisValue120(hyprlandInputCaptureManagerV1Axis axis, int32_t value120);