From c4cd0b1ca85d6bd9e4fc6803a2c393c0d0e8fba2 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 13 Dec 2021 20:44:14 +0100 Subject: [PATCH] fix some lost keybinds --- src/windowManager.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/windowManager.cpp b/src/windowManager.cpp index 5146c64..5a22f4f 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -444,13 +444,13 @@ void CWindowManager::setFocusedWindow(xcb_drawable_t window) { LastWindow = window; applyShapeToWindow(g_pWindowManager->getWindowFromDrawable(window)); - - // set focus in X11 - xcb_set_input_focus(DisplayConnection, XCB_INPUT_FOCUS_POINTER_ROOT, window, XCB_CURRENT_TIME); - - // EWMH - EWMH::updateCurrentWindow(LastWindow); } + + // EWMH + EWMH::updateCurrentWindow(window); + + // set focus in X11 + xcb_set_input_focus(DisplayConnection, XCB_INPUT_FOCUS_POINTER_ROOT, window, XCB_CURRENT_TIME); } // TODO: make this executed less. It's too often imo. @@ -1645,8 +1645,10 @@ void CWindowManager::refocusWindowOnClosed() { const auto PWINDOW = findWindowAtCursor(); // No window or last window valid - if (!PWINDOW || getWindowFromDrawable(LastWindow)) + if (!PWINDOW || getWindowFromDrawable(LastWindow)) { + setFocusedWindow(Screen->root); //refocus on root return; + } LastWindow = PWINDOW->getDrawable();