[mutter] window: fix a case of appears-focused getting stuck



commit eb0e658c99734381c4b21eaf1e62d5627a268d72
Author: Dan Winship <danw gnome org>
Date:   Wed Apr 13 14:19:40 2011 -0400

    window: fix a case of appears-focused getting stuck
    
    Since appears-focus only propagates up from modal dialogs, if an
    application removed the modal hint from a dialog before destroying it,
    then its parent would be left with a stray reference to it in
    attached_focus_window, causing it to be permanently appears-focused.
    
    The obvious fix, calling meta_window_propagate_focus_appearance() when
    the modal hint is removed, tends to cause noticeable flashing, because
    the window will get drawn unfocused and then focused again.
    
    So instead we just change meta_window_propagate_focus_appearance() to
    check the window type only when focusing in, not when focusing out.
    
    This would also cause flashing, but in this case we can avoid it by
    not notifying the change in appears-focus on the parent window if it
    is the expected_focus_window (which it will be by this point). (This
    does mean though that if something weird happens and the window
    doesn't end up becoming the focus window, it won't get redrawn
    unfocused until something else forces it to.)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647613

 src/core/window.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index edb6149..964ada8 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6390,7 +6390,7 @@ meta_window_propagate_focus_appearance (MetaWindow *window,
 
   child = window;
   parent = meta_window_get_transient_for (child);
-  while (child->type == META_WINDOW_MODAL_DIALOG && parent)
+  while (parent && (!focused || child->type == META_WINDOW_MODAL_DIALOG))
     {
       gboolean child_focus_state_changed;
 
@@ -6409,7 +6409,8 @@ meta_window_propagate_focus_appearance (MetaWindow *window,
           parent->attached_focus_window = NULL;
         }
 
-      if (child_focus_state_changed && !parent->has_focus)
+      if (child_focus_state_changed && !parent->has_focus &&
+          parent != window->display->expected_focus_window)
         {
           g_object_notify (G_OBJECT (parent), "appears-focused");
           if (parent->frame)



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