Minor fixes for virtual input devices

This commit is contained in:
vaxerski 2022-11-07 22:22:13 +00:00
parent 2a20cf5379
commit aefc34b405
4 changed files with 12 additions and 5 deletions

View file

@ -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) {

View file

@ -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));

View file

@ -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

View file

@ -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;
};