From f0bc53ce5a6cc5b2998c5cf316c57060cd882474 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 22 Nov 2013 12:45:27 -0500 Subject: [PATCH] display: Fix logic for determining whether our focus was successful In some cases, we can focus the frame window instead of the client window, so make sure that our checks include that as well. https://bugzilla.gnome.org/show_bug.cgi?id=715030 --- src/core/display.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/display.c b/src/core/display.c index 33ebc7b61..b89f43059 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2127,6 +2127,19 @@ handle_window_focus_event (MetaDisplay *display, } } +static gboolean +window_has_xwindow (MetaWindow *window, + Window xwindow) +{ + if (window->xwindow == xwindow) + return TRUE; + + if (window->frame && window->frame->xwindow == xwindow) + return TRUE; + + return FALSE; +} + /** * event_callback: * @event: The event that just happened @@ -2182,7 +2195,7 @@ event_callback (XEvent *event, if (event->xany.serial > display->focus_serial && display->focus_window && - display->focus_window->xwindow != display->server_focus_window) + !window_has_xwindow (display->focus_window, display->server_focus_window)) { meta_topic (META_DEBUG_FOCUS, "Earlier attempt to focus %s failed\n", display->focus_window->desc);