diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index b984671b8..5d1035ab4 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -149,6 +149,10 @@ meta_wayland_surface_role_shell_surface_close (MetaWaylandSurfaceRoleShellSurfac static void meta_wayland_surface_role_shell_surface_popup_done (MetaWaylandSurfaceRoleShellSurface *shell_surface_role); +static void +meta_wayland_surface_role_shell_surface_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, + MetaWindow *window); + gboolean meta_wayland_surface_assign_role (MetaWaylandSurface *surface, GType role_type) @@ -1726,6 +1730,16 @@ meta_wayland_surface_popup_done (MetaWaylandSurface *surface) meta_wayland_surface_role_shell_surface_popup_done (shell_surface_role); } +void +meta_wayland_surface_window_managed (MetaWaylandSurface *surface, + MetaWindow *window) +{ + MetaWaylandSurfaceRoleShellSurface *shell_surface_role = + META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE (surface->role); + + meta_wayland_surface_role_shell_surface_managed (shell_surface_role, window); +} + void meta_wayland_surface_drag_dest_focus_in (MetaWaylandSurface *surface, MetaWaylandDataOffer *offer) @@ -1939,6 +1953,16 @@ meta_wayland_surface_role_shell_surface_popup_done (MetaWaylandSurfaceRoleShellS shell_surface_role_class->popup_done (shell_surface_role); } +static void +meta_wayland_surface_role_shell_surface_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, + MetaWindow *window) +{ + MetaWaylandSurfaceRoleShellSurfaceClass *shell_surface_role_class = + META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_GET_CLASS (shell_surface_role); + + shell_surface_role_class->managed (shell_surface_role, window); +} + void meta_wayland_surface_queue_pending_frame_callbacks (MetaWaylandSurface *surface) { diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index 190ee1f14..920949e0b 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -94,6 +94,8 @@ struct _MetaWaylandSurfaceRoleShellSurfaceClass int new_width, int new_height, MetaWaylandSerial *sent_serial); + void (*managed) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, + MetaWindow *window); void (*ping) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, uint32_t serial); void (*close) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role); @@ -348,4 +350,8 @@ gboolean meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surf MetaGrabOp grab_op, gfloat x, gfloat y); + +void meta_wayland_surface_window_managed (MetaWaylandSurface *surface, + MetaWindow *window); + #endif diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c index 6933ebba3..7a3490913 100644 --- a/src/wayland/meta-wayland-wl-shell.c +++ b/src/wayland/meta-wayland-wl-shell.c @@ -528,6 +528,12 @@ wl_shell_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surfa new_width, new_height); } +static void +wl_shell_surface_role_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, + MetaWindow *window) +{ +} + static void wl_shell_surface_role_ping (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, guint32 serial) @@ -574,6 +580,7 @@ meta_wayland_surface_role_wl_shell_surface_class_init (MetaWaylandSurfaceRoleWlS shell_surface_role_class = META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_CLASS (klass); shell_surface_role_class->configure = wl_shell_surface_role_configure; + shell_surface_role_class->managed = wl_shell_surface_role_managed; shell_surface_role_class->ping = wl_shell_surface_role_ping; shell_surface_role_class->close = wl_shell_surface_role_close; shell_surface_role_class->popup_done = wl_shell_surface_role_popup_done; diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index cf1c7c7b3..94b488ad8 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -625,6 +625,12 @@ xdg_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_ro } } +static void +xdg_surface_role_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, + MetaWindow *window) +{ +} + static void xdg_surface_role_ping (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, uint32_t serial) @@ -665,6 +671,7 @@ meta_wayland_surface_role_xdg_surface_class_init (MetaWaylandSurfaceRoleXdgSurfa META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_CLASS (klass); shell_surface_role_class->configure = xdg_surface_role_configure; + shell_surface_role_class->managed = xdg_surface_role_managed; shell_surface_role_class->ping = xdg_surface_role_ping; shell_surface_role_class->close = xdg_surface_role_close; } @@ -704,6 +711,22 @@ xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role * Just ignore it. */ } +static void +xdg_popup_role_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, + MetaWindow *window) +{ + MetaWaylandSurfaceRole *surface_role = + META_WAYLAND_SURFACE_ROLE (shell_surface_role); + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (surface_role); + MetaWaylandSurface *parent = surface->popup.parent; + + g_assert (parent); + + meta_window_set_transient_for (window, parent->window); + meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU); +} + static void xdg_popup_role_ping (MetaWaylandSurfaceRoleShellSurface *shell_surface_role, uint32_t serial) @@ -744,6 +767,7 @@ meta_wayland_surface_role_xdg_popup_class_init (MetaWaylandSurfaceRoleXdgPopupCl META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_CLASS (klass); shell_surface_role_class->configure = xdg_popup_role_configure; + shell_surface_role_class->managed = xdg_popup_role_managed; shell_surface_role_class->ping = xdg_popup_role_ping; shell_surface_role_class->popup_done = xdg_popup_role_popup_done; } diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index fb051a1e0..5b9b40982 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -68,15 +68,7 @@ meta_window_wayland_manage (MetaWindow *window) 0); } - if (META_IS_WAYLAND_SURFACE_ROLE_XDG_POPUP (window->surface->role)) - { - MetaWaylandSurface *parent = window->surface->popup.parent; - - g_assert (parent); - - meta_window_set_transient_for (window, parent->window); - meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU); - } + meta_wayland_surface_window_managed (window->surface, window); } static void