summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-28 16:43:15 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-28 16:43:15 +0200
commit16f8d46391b99318521aa4e589aa36d0da912447 (patch)
tree6b20af3a6069da48e1f919d72d48d6af6349419d /src/managers/KeybindManager.cpp
parent5726f394b1f59fac4d229a6790fcf9c9315aaf27 (diff)
Force wlroots to not send leave events in pass to XWayland
Massive hack, kill me
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 318d7407..aeb89ed4 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -1378,15 +1378,18 @@ void CKeybindManager::pass(std::string regexp) {
return;
}
+ const auto XWTOXW = PWINDOW->m_bIsX11 && g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsX11;
+
// pass all mf shit
- wlr_seat_keyboard_notify_enter(g_pCompositor->m_sSeat.seat, g_pXWaylandManager->getWindowSurface(PWINDOW), KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
+ if (!XWTOXW)
+ wlr_seat_keyboard_enter(g_pCompositor->m_sSeat.seat, g_pXWaylandManager->getWindowSurface(PWINDOW), KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
wlr_keyboard_modifiers kbmods = {g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0};
wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &kbmods);
- if (g_pKeybindManager->m_iPassPressed == 1)
+ if (g_pKeybindManager->m_iPassPressed == 1) {
wlr_seat_keyboard_notify_key(g_pCompositor->m_sSeat.seat, g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastCode - 8, WLR_BUTTON_PRESSED);
- else if (g_pKeybindManager->m_iPassPressed == 0)
+ } else if (g_pKeybindManager->m_iPassPressed == 0)
wlr_seat_keyboard_notify_key(g_pCompositor->m_sSeat.seat, g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastCode - 8, WLR_BUTTON_RELEASED);
else {
// dynamic call of the dispatcher
@@ -1395,7 +1398,18 @@ void CKeybindManager::pass(std::string regexp) {
wlr_seat_keyboard_notify_key(g_pCompositor->m_sSeat.seat, g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastCode - 8, WLR_BUTTON_RELEASED);
}
- wlr_seat_keyboard_notify_enter(g_pCompositor->m_sSeat.seat, PLASTSRF, KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
+ if (XWTOXW)
+ return;
+
+ // Massive hack:
+ // this will make wlroots NOT send the leave event to XWayland apps, provided we are not on an XWayland window already.
+ // please kill me
+ if (PWINDOW->m_bIsX11) {
+ g_pCompositor->m_sSeat.seat->keyboard_state.focused_client = nullptr;
+ g_pCompositor->m_sSeat.seat->keyboard_state.focused_surface = nullptr;
+ }
+
+ wlr_seat_keyboard_enter(g_pCompositor->m_sSeat.seat, PLASTSRF, KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
}
void CKeybindManager::layoutmsg(std::string msg) {