core/window: Propagate focus appearance to all ancestors

The loop in meta_window_propagate_focus_appearance breaks if any
ancestor has attached_focus_window == focus_window but further ancestors
might still have a different attached_focus_window.

Continue the loop until the root ancestor instead.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2913
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3356>
This commit is contained in:
Sebastian Wick 2023-10-30 13:57:17 +01:00 committed by Marge Bot
parent 6f6f16c2b1
commit 4e088cac0e

View File

@ -5232,19 +5232,15 @@ meta_window_propagate_focus_appearance (MetaWindow *window,
parent = meta_window_get_transient_for (child); parent = meta_window_get_transient_for (child);
while (parent && (!focused || should_propagate_focus_appearance (child))) while (parent && (!focused || should_propagate_focus_appearance (child)))
{ {
gboolean child_focus_state_changed; gboolean child_focus_state_changed = FALSE;
if (focused) if (focused && parent->attached_focus_window != focus_window)
{ {
if (parent->attached_focus_window == focus_window)
break;
child_focus_state_changed = (parent->attached_focus_window == NULL); child_focus_state_changed = (parent->attached_focus_window == NULL);
parent->attached_focus_window = focus_window; parent->attached_focus_window = focus_window;
} }
else else if (parent->attached_focus_window == focus_window)
{ {
if (parent->attached_focus_window != focus_window)
break;
child_focus_state_changed = (parent->attached_focus_window != NULL); child_focus_state_changed = (parent->attached_focus_window != NULL);
parent->attached_focus_window = NULL; parent->attached_focus_window = NULL;
} }