window: Propagate stickyness across modal dialog chains

While marking a parent window as sticky or non-sticky always propagates
to the children, also propagate to the parents if the dialog in question
is modal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
This commit is contained in:
Jonas Ådahl
2024-07-16 11:44:58 +02:00
committed by Marge Bot
parent c079e2696d
commit 288d57f6a5
4 changed files with 122 additions and 0 deletions

View File

@ -4907,6 +4907,27 @@ stick_foreach_func (MetaWindow *window,
return TRUE;
}
static void
foreach_modal_ancestor (MetaWindow *window,
void (*func) (MetaWindow *window))
{
MetaWindow *parent;
if (window->type != META_WINDOW_MODAL_DIALOG)
return;
parent = window->transient_for;
while (parent)
{
func (parent);
if (parent->type != META_WINDOW_MODAL_DIALOG)
break;
parent = parent->transient_for;
}
}
void
meta_window_stick (MetaWindow *window)
{
@ -4918,6 +4939,7 @@ meta_window_stick (MetaWindow *window)
meta_window_foreach_transient (window,
stick_foreach_func,
&stick);
foreach_modal_ancestor (window, window_stick_impl);
}
void
@ -4931,6 +4953,7 @@ meta_window_unstick (MetaWindow *window)
meta_window_foreach_transient (window,
stick_foreach_func,
&stick);
foreach_modal_ancestor (window, window_unstick_impl);
}
void