diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index bc1a9d0bdd..0429ee5f54 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -1086,6 +1086,24 @@ gdk_wayland_window_sync_parent (GdkWindow *window, parent_toplevel); } +static void +gdk_wayland_window_sync_parent_of_imported (GdkWindow *window) +{ + GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + + if (!impl->display_server.wl_surface) + return; + + if (!impl->imported_transient_for) + return; + + if (!impl->display_server.xdg_toplevel) + return; + + zxdg_imported_v1_set_parent_of (impl->imported_transient_for, + impl->display_server.wl_surface); +} + static void gdk_wayland_window_update_dialogs (GdkWindow *window) { @@ -1542,6 +1560,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS window); gdk_wayland_window_sync_parent (window, NULL); + gdk_wayland_window_sync_parent_of_imported (window); gdk_wayland_window_sync_title (window); if (window->state & GDK_WINDOW_STATE_MAXIMIZED) @@ -4361,12 +4380,12 @@ gdk_wayland_window_set_transient_for_exported (GdkWindow *window, g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), FALSE); g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), FALSE); + g_return_val_if_fail (!should_map_as_subsurface (window) && + !should_map_as_popup (window), FALSE); impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); display_wayland = GDK_WAYLAND_DISPLAY (display); - g_return_val_if_fail (impl->display_server.xdg_surface, FALSE); - if (!display_wayland->xdg_importer) { g_warning ("Server is missing xdg_foreign support"); @@ -4381,8 +4400,7 @@ gdk_wayland_window_set_transient_for_exported (GdkWindow *window, &xdg_imported_listener, window); - zxdg_imported_v1_set_parent_of (impl->imported_transient_for, - impl->display_server.wl_surface); + gdk_wayland_window_sync_parent_of_imported (window); return TRUE; }