window: Guard minimize()

Not all windows can be minimized: X11 clients can disable the
functionality, and so do we for windows that aren't shown in
the alt-tab popup or the shell overview, so there would be no
way of getting them back.

While we make sure that we respect that ourselves (keybinding,
window menu, etc.), we don't guard meta_window_minimize(), so
clients or extensions can still minimize a window that isn't
supposed to be minimized.

That can lead to all kinds of issues, from the hidden window
being lost (as far as users are concerned) to a crash when
the minimzed window has a transient parent.

Just add an explicit check to make sure the unexpected doesn't
happen after all, and print a warning if it does.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2491>
This commit is contained in:
Florian Müllner 2022-06-30 13:56:21 +02:00 committed by Marge Bot
parent 9bdf4b3572
commit 7ff1c04c8f

View File

@ -2463,6 +2463,13 @@ meta_window_minimize (MetaWindow *window)
{
g_return_if_fail (!window->override_redirect);
if (!window->has_minimize_func)
{
g_warning ("Window %s cannot be minimized, but something tried "
"anyways. Not having it!", window->desc);
return;
}
if (!window->minimized)
{
window->minimized = TRUE;