From 37a64dcf5f7cebbb44886561d309e59112ef6afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 10 Nov 2015 23:59:17 +0100 Subject: [PATCH] catch lost FOCUS_POINTER_ROOT FOCUS_IN events it seems we can "loose" focus reversions when the closing client hold a grab (eg. the screenlocker or some games) thus we catch the typical pattern (though we don't want the focus on the root anyway) BUG: 348935 FIXED-IN: 5.5 REVIEW: 126033 --- events.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/events.cpp b/events.cpp index b1edf6f348..508934727b 100644 --- a/events.cpp +++ b/events.cpp @@ -484,10 +484,13 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e) case XCB_FOCUS_IN: { const auto *event = reinterpret_cast(e); if (event->event == rootWindow() - && (event->detail == XCB_NOTIFY_DETAIL_NONE || event->detail == XCB_NOTIFY_DETAIL_POINTER_ROOT)) { + && (event->detail == XCB_NOTIFY_DETAIL_NONE || event->detail == XCB_NOTIFY_DETAIL_POINTER_ROOT || event->detail == XCB_NOTIFY_DETAIL_INFERIOR)) { Xcb::CurrentInput currentInput; updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp) - if (!currentInput.isNull() && (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT)) { + // it seems we can "loose" focus reversions when the closing client hold a grab + // => catch the typical pattern (though we don't want the focus on the root anyway) #348935 + const bool lostFocusPointerToRoot = currentInput->focus == rootWindow() && event->detail == XCB_NOTIFY_DETAIL_INFERIOR; + if (!currentInput.isNull() && (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT || lostFocusPointerToRoot)) { //kWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" ; AbstractClient *c = mostRecentlyActivatedClient(); if (c != NULL)