wayland/xdg-shell: Reset XDG surface roles when role is assigned

Instead of resetting in the xdg_surface.get_toplevel call.

It also changes XDG popus handling to deal with cases where the surface
was part of a window before, the same way the toplevel does.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3667>
This commit is contained in:
Sebastian Wick 2024-03-18 19:28:18 +01:00 committed by Marge Bot
parent e775052429
commit 82c71426cc

View File

@ -1018,7 +1018,6 @@ meta_wayland_xdg_toplevel_reset (MetaWaylandXdgSurface *xdg_surface)
surface = meta_wayland_surface_role_get_surface (surface_role);
meta_wayland_shell_surface_destroy_window (shell_surface);
meta_wayland_actor_surface_reset_actor (META_WAYLAND_ACTOR_SURFACE (surface_role));
window = meta_window_wayland_new (display_from_surface (surface), surface);
meta_wayland_shell_surface_set_window (shell_surface, window);
@ -1225,7 +1224,9 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
G_CALLBACK (on_parent_surface_unmapped),
xdg_popup);
window = meta_window_wayland_new (display, surface);
meta_wayland_shell_surface_destroy_window (shell_surface);
meta_wayland_actor_surface_reset_actor (META_WAYLAND_ACTOR_SURFACE (surface_role));
window = meta_window_wayland_new (display_from_surface (surface), surface);
meta_wayland_shell_surface_set_window (shell_surface, window);
parent_window = meta_wayland_surface_get_window (parent_surface);
@ -1918,6 +1919,8 @@ meta_wayland_xdg_surface_assigned (MetaWaylandSurfaceRole *surface_role)
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_surface_parent_class);
surface_role_class->assigned (surface_role);
meta_wayland_xdg_surface_reset (xdg_surface);
}
static void
@ -2091,8 +2094,6 @@ xdg_surface_constructor_get_toplevel (struct wl_client *client,
MetaWaylandSurface *surface = constructor->surface;
MetaWaylandXdgToplevel *xdg_toplevel;
MetaWaylandXdgSurface *xdg_surface;
MetaWaylandShellSurface *shell_surface;
MetaWindow *window;
if (!meta_wayland_surface_assign_role (surface,
META_TYPE_WAYLAND_XDG_TOPLEVEL,
@ -2118,10 +2119,6 @@ xdg_surface_constructor_get_toplevel (struct wl_client *client,
xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_toplevel);
meta_wayland_xdg_surface_constructor_finalize (constructor, xdg_surface);
window = meta_window_wayland_new (display_from_surface (surface), surface);
shell_surface = META_WAYLAND_SHELL_SURFACE (xdg_surface);
meta_wayland_shell_surface_set_window (shell_surface, window);
}
static void