From 993bec37d72a9f14d550eb865ecc38ea81301238 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 6 Oct 2014 16:55:01 -0700 Subject: [PATCH] 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 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/core/window.c b/src/core/window.c index d4c101821..77ded4437 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;