diff options
author | vaxerski <[email protected]> | 2022-11-07 22:22:13 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-11-07 22:22:13 +0000 |
commit | aefc34b4050ec2d4aa70220726c168ca6ad5eea2 (patch) | |
tree | 1f3335f839d415c68a574a95948d8b47110bc446 | |
parent | 2a20cf5379161adc16424652313371c558b1467e (diff) | |
download | Hyprland-aefc34b4050ec2d4aa70220726c168ca6ad5eea2.tar.gz Hyprland-aefc34b4050ec2d4aa70220726c168ca6ad5eea2.zip |
Minor fixes for virtual input devices
-rw-r--r-- | src/managers/KeybindManager.cpp | 2 | ||||
-rw-r--r-- | src/managers/input/InputManager.cpp | 9 | ||||
-rw-r--r-- | src/managers/input/InputManager.hpp | 3 | ||||
-rw-r--r-- | src/managers/input/InputMethodRelay.hpp | 3 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 0e6f1485..7eb556b5 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -165,7 +165,7 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard return true; } - if (pKeyboard->isVirtual) + if (pKeyboard->isVirtual && g_pInputManager->shouldIgnoreVirtualKeyboard(pKeyboard)) return true; if (!m_pXKBTranslationState) { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 3f9c3b83..9c71c982 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -52,9 +52,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { return; } - if (g_pCompositor->m_sSeat.mouse->virt) - return; // don't refocus on virt - if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS) { // enable dpms g_pKeybindManager->dpms("on"); @@ -861,6 +858,10 @@ void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) { } } +bool CInputManager::shouldIgnoreVirtualKeyboard(SKeyboard* pKeyboard) { + return !pKeyboard || (m_sIMERelay.m_pKeyboardGrab && wl_resource_get_client(m_sIMERelay.m_pKeyboardGrab->pWlrKbGrab->resource) == wl_resource_get_client(wlr_input_device_get_virtual_keyboard(pKeyboard->keyboard)->resource)); +} + void CInputManager::refocus() { mouseMoveUnified(0, true); } @@ -1002,7 +1003,7 @@ uint32_t CInputManager::accumulateModsFromAllKBs() { uint32_t finalMask = 0; for (auto& kb : m_lKeyboards) { - if (kb.isVirtual) + if (kb.isVirtual && shouldIgnoreVirtualKeyboard(&kb)) continue; finalMask |= wlr_keyboard_get_modifiers(wlr_keyboard_from_input_device(kb.keyboard)); diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index a020fade..18786758 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -120,6 +120,9 @@ public: CWindow* m_pFollowOnDnDBegin = nullptr; + // for virtual keyboards: whether we should respect them as normal ones + bool shouldIgnoreVirtualKeyboard(SKeyboard*); + private: // for click behavior override diff --git a/src/managers/input/InputMethodRelay.hpp b/src/managers/input/InputMethodRelay.hpp index 1ecc5a5d..5f4e9752 100644 --- a/src/managers/input/InputMethodRelay.hpp +++ b/src/managers/input/InputMethodRelay.hpp @@ -3,6 +3,8 @@ #include "../../defines.hpp" #include "../../helpers/WLClasses.hpp" +class CInputManager; + class CInputMethodRelay { public: CInputMethodRelay(); @@ -45,4 +47,5 @@ private: void createNewTextInput(wlr_text_input_v3*); friend class CHyprRenderer; + friend class CInputManager; };
\ No newline at end of file |