diff --git a/src/core/window.c b/src/core/window.c index 1deece0db..0ba7980ab 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1468,7 +1468,7 @@ meta_window_unmanage (MetaWindow *window, /* This needs to happen for both Wayland and XWayland clients, * so it can't be in MetaWindowWayland. */ if (window->surface) - meta_wayland_surface_window_unmanaged (window->surface); + meta_wayland_surface_set_window (window->surface, NULL); if (window->visible_to_compositor) { diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 2eb32ecb5..2c49c4721 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -549,16 +549,13 @@ const struct wl_surface_interface meta_wayland_surface_interface = { }; void -meta_wayland_surface_make_toplevel (MetaWaylandSurface *surface) +meta_wayland_surface_set_window (MetaWaylandSurface *surface, + MetaWindow *window) { - clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), TRUE); -} + gboolean has_window = (window != NULL); -void -meta_wayland_surface_window_unmanaged (MetaWaylandSurface *surface) -{ - clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), FALSE); - surface->window = NULL; + clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), has_window); + surface->window = window; } static void @@ -909,6 +906,7 @@ xdg_shell_get_xdg_surface (struct wl_client *client, struct wl_resource *surface_resource) { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); + MetaWindow *window; if (!create_surface_extension (&surface->xdg_surface, META_XDG_SURFACE_VERSION, @@ -923,8 +921,8 @@ xdg_shell_get_xdg_surface (struct wl_client *client, return; } - meta_wayland_surface_make_toplevel (surface); - surface->window = meta_window_wayland_new (meta_get_display (), surface); + window = meta_window_wayland_new (meta_get_display (), surface); + meta_wayland_surface_set_window (surface, window); } static void @@ -962,6 +960,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client, MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource); MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource); + MetaWindow *window; if (parent_surf == NULL || parent_surf->window == NULL) return; @@ -979,15 +978,15 @@ xdg_shell_get_xdg_popup (struct wl_client *client, return; } - meta_wayland_surface_make_toplevel (surface); - surface->window = meta_window_wayland_new (meta_get_display (), surface); - surface->window->rect.x = parent_surf->window->rect.x + x; - surface->window->rect.y = parent_surf->window->rect.y + y; - surface->window->showing_for_first_time = FALSE; - surface->window->placed = TRUE; - meta_window_set_transient_for (surface->window, parent_surf->window); + window = meta_window_wayland_new (meta_get_display (), surface); + window->rect.x = parent_surf->window->rect.x + x; + window->rect.y = parent_surf->window->rect.y + y; + window->showing_for_first_time = FALSE; + window->placed = TRUE; + meta_window_set_transient_for (window, parent_surf->window); + meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU); - meta_window_set_type (surface->window, META_WINDOW_DROPDOWN_MENU); + meta_wayland_surface_set_window (surface, window); meta_wayland_pointer_start_popup_grab (&seat->pointer, surface); } @@ -1270,6 +1269,7 @@ wl_shell_get_shell_surface (struct wl_client *client, struct wl_resource *surface_resource) { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); + MetaWindow *window; if (!create_surface_extension (&surface->wl_shell_surface, META_WL_SHELL_SURFACE_VERSION, @@ -1284,8 +1284,8 @@ wl_shell_get_shell_surface (struct wl_client *client, return; } - meta_wayland_surface_make_toplevel (surface); - surface->window = meta_window_wayland_new (meta_get_display (), surface); + window = meta_window_wayland_new (meta_get_display (), surface); + meta_wayland_surface_set_window (surface, window); } static const struct wl_shell_interface meta_wayland_wl_shell_interface = { diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index e0886536e..25fe83c11 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -111,8 +111,8 @@ MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *composit guint32 id, guint32 version); -void meta_wayland_surface_make_toplevel (MetaWaylandSurface *surface); -void meta_wayland_surface_window_unmanaged (MetaWaylandSurface *surface); +void meta_wayland_surface_set_window (MetaWaylandSurface *surface, + MetaWindow *window); void meta_wayland_surface_configure_notify (MetaWaylandSurface *surface, int width, diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index 7748b123c..d261ca712 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -54,9 +54,7 @@ xserver_set_window_id (struct wl_client *client, if (window->surface) window->surface->window = NULL; - meta_wayland_surface_make_toplevel (surface); - - surface->window = window; + meta_wayland_surface_set_window (surface, window); window->surface = surface; meta_compositor_window_surface_changed (display->compositor, window);