1
0
Fork 0

window: Close window when unsetting transient_for

Since b443bd42ac, we unmanage a wayland window when clearing its
transient parent. That's to make sure that xdg-foreign doesn't
leave the dialog around after the imported surface was destroyed.

While that behavior is sound, it is problematic to implement it
by unmanaging the window, as that happens entirely behind the
client's back.

Instead, send a close event for the window. Unless the client has
good reasons, it should honor the request. (And if it has good
reasons - like unsaved work - then effectively hiding the window
from both the user and client is probably not the best idea anyway).

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5458

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2499>
This commit is contained in:
Florian Müllner 2022-07-07 17:53:39 +02:00 committed by Marge Bot
parent 7ff1c04c8f
commit 640ca57c34

View file

@ -7943,9 +7943,10 @@ meta_window_set_transient_for (MetaWindow *window,
timestamp = timestamp =
meta_display_get_current_time_roundtrip (window->display); meta_display_get_current_time_roundtrip (window->display);
meta_window_unmanage (window, timestamp); meta_window_delete (window, timestamp);
return; return;
} }
/* We know this won't create a reference cycle because we check for loops */ /* We know this won't create a reference cycle because we check for loops */
g_clear_object (&window->transient_for); g_clear_object (&window->transient_for);
window->transient_for = parent ? g_object_ref (parent) : NULL; window->transient_for = parent ? g_object_ref (parent) : NULL;