window: Don't unmanage transient_for when attached

For some reason, when a modal dialog was made an attaching
transient-for, if the window wasn't "constructing", it would be
unmanaged and rely on some side effect to be recreated. This side
effect is not triggered for Wayland clients, thus if one happen to set
a surface as "modal" via gtk_surface.set_modal before
xdg_toplevel.set_parent, it'd be unmanaged and never show up.

Instead, simply just set the tranciency anyway for Wayland clients.
This makes GTK+ clients that set_modal() before set_transient_for()
work.

https://bugzilla.gnome.org/show_bug.cgi?id=770324
This commit is contained in:
Jonas Ådahl 2016-08-24 12:53:25 +08:00
parent 8942e98e1d
commit 658d97d00e

View File

@ -7415,23 +7415,26 @@ meta_window_set_transient_for (MetaWindow *window,
/* may now be a dialog */ /* may now be a dialog */
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11) if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
meta_window_x11_recalc_window_type (window);
if (!window->constructing)
{ {
/* If the window attaches, detaches, or changes attached meta_window_x11_recalc_window_type (window);
* parents, we need to destroy the MetaWindow and let a new one
* be created (which happens as a side effect of
* meta_window_unmanage()). The condition below is correct
* because we know window->transient_for has changed.
*/
if (window->attached || meta_window_should_attach_to_parent (window))
{
guint32 timestamp;
timestamp = meta_display_get_current_time_roundtrip (window->display); if (!window->constructing)
meta_window_unmanage (window, timestamp); {
return; /* If the window attaches, detaches, or changes attached
* parents, we need to destroy the MetaWindow and let a new one
* be created (which happens as a side effect of
* meta_window_unmanage()). The condition below is correct
* because we know window->transient_for has changed.
*/
if (window->attached || meta_window_should_attach_to_parent (window))
{
guint32 timestamp;
timestamp =
meta_display_get_current_time_roundtrip (window->display);
meta_window_unmanage (window, timestamp);
return;
}
} }
} }