diff --git a/src/core/PortalManager.cpp b/src/core/PortalManager.cpp index 4e3dc42..8e0d266 100644 --- a/src/core/PortalManager.cpp +++ b/src/core/PortalManager.cpp @@ -22,6 +22,7 @@ SOutput::SOutput(SP output_) : output(output_) { refreshRate = refresh; width = width_; height = height_; + Debug::log(LOG, "??? {} {}", flags, refresh); }); output->setGeometry( [this](CCWlOutput* r, int32_t x_, int32_t y_, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char* make, const char* model, int32_t transform_) { diff --git a/src/portals/InputCapture.cpp b/src/portals/InputCapture.cpp index 70376a1..4372a36 100644 --- a/src/portals/InputCapture.cpp +++ b/src/portals/InputCapture.cpp @@ -28,6 +28,10 @@ CInputCapturePortal::CInputCapturePortal(SP mgr onKeymap(format == HYPRLAND_INPUT_CAPTURE_MANAGER_V1_KEYMAP_FORMAT_XKB_V1 ? fd : 0, size); }); + mgr->setModifiers([this](CCHyprlandInputCaptureManagerV1* r, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) { + onModifiers(mods_depressed, mods_latched, mods_locked, group); + }); + mgr->setKey([this](CCHyprlandInputCaptureManagerV1* r, uint32_t key, hyprlandInputCaptureManagerV1KeyState state) { onKey(key, state); }); mgr->setButton([this](CCHyprlandInputCaptureManagerV1* r, uint32_t button, hyprlandInputCaptureManagerV1ButtonState state) { onButton(button, state); }); @@ -321,6 +325,11 @@ void CInputCapturePortal::onKey(uint32_t id, bool pressed) { value->key(id, pressed); } +void CInputCapturePortal::onModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group) { + for (const auto& [key, value] : sessions) + value->modifiers(modsDepressed, modsLatched, modsLocked, group); +} + void CInputCapturePortal::onKeymap(int32_t fd, uint32_t size) { keymap.fd = fd; keymap.size = size; @@ -475,6 +484,13 @@ void CInputCapturePortal::SSession::key(uint32_t key, bool pressed) { eis->sendKey(key, pressed); } +void CInputCapturePortal::SSession::modifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group) { + if (status != ACTIVATED) + return; + + eis->sendModifiers(modsDepressed, modsLatched, modsLocked, group); +} + void CInputCapturePortal::SSession::button(uint32_t button, bool pressed) { if (status != ACTIVATED) return; diff --git a/src/portals/InputCapture.hpp b/src/portals/InputCapture.hpp index 0f5a108..99dcd36 100644 --- a/src/portals/InputCapture.hpp +++ b/src/portals/InputCapture.hpp @@ -36,6 +36,7 @@ class CInputCapturePortal { void onMotion(double x, double y, double dx, double dy); void onKeymap(int32_t fd, uint32_t size); void onKey(uint32_t key, bool pressed); + void onModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); void onButton(uint32_t button, bool pressed); void onAxis(bool axis, double value); void onAxisValue120(bool axis, int32_t value120); @@ -66,6 +67,7 @@ class CInputCapturePortal { void motion(double dx, double dy); void key(uint32_t key, bool pressed); + void modifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); void keymap(Keymap keymap); void button(uint32_t button, bool pressed); void axis(bool axis, double value); diff --git a/src/shared/Eis.cpp b/src/shared/Eis.cpp index 4c3a5a1..6032fba 100644 --- a/src/shared/Eis.cpp +++ b/src/shared/Eis.cpp @@ -269,6 +269,14 @@ void EmulatedInputServer::sendKey(uint32_t key, bool pressed) { eis_device_frame(client.keyboard, now); } +void EmulatedInputServer::sendModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group) { + if (!client.keyboard) + return; + uint64_t now = eis_now(eisCtx); + eis_device_keyboard_send_xkb_modifiers(client.keyboard, modsDepressed, modsLatched, modsLocked, group); + eis_device_frame(client.keyboard, now); +} + void EmulatedInputServer::sendButton(uint32_t button, bool pressed) { if (!client.pointer) return; diff --git a/src/shared/Eis.hpp b/src/shared/Eis.hpp index 918dc71..3af8181 100644 --- a/src/shared/Eis.hpp +++ b/src/shared/Eis.hpp @@ -23,6 +23,7 @@ class EmulatedInputServer { void sendMotion(double x, double y); void sendKey(uint32_t key, bool pressed); + void sendModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); void sendButton(uint32_t button, bool pressed); void sendScrollDelta(double x, double y); void sendScrollDiscrete(int32_t x, int32_t y); diff --git a/subprojects/hyprland-protocols b/subprojects/hyprland-protocols index 0c7cf26..cb1b99c 160000 --- a/subprojects/hyprland-protocols +++ b/subprojects/hyprland-protocols @@ -1 +1 @@ -Subproject commit 0c7cf263faeae9429942c6ffbc1e9b5dfd709bf4 +Subproject commit cb1b99ca037311417f9fde600732f21dc9ed983e