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
This commit is contained in:
Thomas Lübking 2015-11-10 23:59:17 +01:00
parent 01451eea36
commit 37a64dcf5f

View file

@ -484,10 +484,13 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
case XCB_FOCUS_IN: { case XCB_FOCUS_IN: {
const auto *event = reinterpret_cast<xcb_focus_in_event_t*>(e); const auto *event = reinterpret_cast<xcb_focus_in_event_t*>(e);
if (event->event == rootWindow() 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; Xcb::CurrentInput currentInput;
updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp) 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" ; //kWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" ;
AbstractClient *c = mostRecentlyActivatedClient(); AbstractClient *c = mostRecentlyActivatedClient();
if (c != NULL) if (c != NULL)