[mutter] window: Ensure that popup window types propagate their focus appearance



commit 993bec37d72a9f14d550eb865ecc38ea81301238
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Oct 6 16:55:01 2014 -0700

    window: Ensure that popup window types propagate their focus appearance
    
    In Wayland, popup window types are not override-redirect, and thus can
    steal window focus away from their parent window when clicked on.
    
    This means that we need to make sure their appearance is properly
    propagated to the parent windows so the parent windows don't lose their
    focus while they're propagated.

 src/core/window.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index d4c1018..77ded44 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4652,6 +4652,25 @@ meta_window_appears_focused_changed (MetaWindow *window)
     meta_frame_queue_draw (window->frame);
 }
 
+static gboolean
+should_propagate_focus_appearance (MetaWindow *window)
+{
+  if (meta_window_is_attached_dialog (window))
+    return TRUE;
+
+  switch (window->type)
+    {
+    case META_WINDOW_DROPDOWN_MENU:
+    case META_WINDOW_POPUP_MENU:
+    case META_WINDOW_COMBO:
+      return TRUE;
+    default:
+      break;
+    }
+
+  return FALSE;
+}
+
 /**
  * meta_window_propagate_focus_appearance:
  * @window: the window to start propagating from
@@ -4675,7 +4694,7 @@ meta_window_propagate_focus_appearance (MetaWindow *window,
 
   child = window;
   parent = meta_window_get_transient_for (child);
-  while (parent && (!focused || meta_window_is_attached_dialog (child)))
+  while (parent && (!focused || should_propagate_focus_appearance (child)))
     {
       gboolean child_focus_state_changed;
 


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