[mutter] Work around race condition focusing a window on a different workspace



commit e8a29c1e82e834ec921e5681ff87ea6b84dd5671
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Oct 7 13:43:33 2009 -0400

    Work around race condition focusing a window on a different workspace
    
    When we focus a window on a different desktop, and the calc_showing
    idle that hides/shows the windows gets run before we get focus events
    back from X, we think that we are hiding the window with the focus
    so we focus a "random" window to avoid leaving the user with no focus.
    
    Work around this temporarily by checking display->expected_focus_window;
    this isn't a perfect fix because there are cases where
    display->expected_focus_window corresponds to a window we tried to
    focus in the past but failed, but it makes things work fairly well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=597352

 src/core/window.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 35730ea..5f02b13 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2731,7 +2731,14 @@ meta_window_hide (MetaWindow *window)
       invalidate_work_areas (window);
     }
 
-  if (window->has_focus)
+  /* The check on expected_focus_window is a temporary workaround for
+   *  https://bugzilla.gnome.org/show_bug.cgi?id=597352
+   * We may have already switched away from this window but not yet
+   * gotten FocusIn/FocusOut events. A more complete comprehensive
+   * fix for these type of issues is described in the bug.
+   */
+  if (window->has_focus &&
+      window == window->display->expected_focus_window)
     {
       MetaWindow *not_this_one = NULL;
       MetaWorkspace *my_workspace = meta_window_get_workspace (window);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]