diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c index 8aff17f43..5a299b406 100644 --- a/src/wayland/meta-wayland-shell-surface.c +++ b/src/wayland/meta-wayland-shell-surface.c @@ -133,6 +133,19 @@ meta_wayland_shell_surface_managed (MetaWaylandShellSurface *shell_surface, shell_surface_class->managed (shell_surface, window); } +static void +meta_wayland_shell_surface_assigned (MetaWaylandSurfaceRole *surface_role) +{ + MetaWaylandSurfaceRoleClass *surface_role_class = + META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_shell_surface_parent_class); + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (surface_role); + + surface->dnd.funcs = meta_wayland_data_device_get_drag_dest_funcs (); + + surface_role_class->assigned (surface_role); +} + static void meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface_role, MetaWaylandSurfaceState *pending) @@ -263,6 +276,7 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass) object_class->finalize = meta_wayland_shell_surface_finalize; + surface_role_class->assigned = meta_wayland_shell_surface_assigned; surface_role_class->apply_state = meta_wayland_shell_surface_surface_apply_state; surface_role_class->notify_subsurface_state_changed = diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c index c55600912..efa1da1b6 100644 --- a/src/wayland/meta-wayland-subsurface.c +++ b/src/wayland/meta-wayland-subsurface.c @@ -225,6 +225,19 @@ meta_wayland_subsurface_union_geometry (MetaWaylandSubsurface *subsurface, } } +static void +meta_wayland_subsurface_assigned (MetaWaylandSurfaceRole *surface_role) +{ + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (surface_role); + MetaWaylandSurfaceRoleClass *surface_role_class = + META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_subsurface_parent_class); + + surface->dnd.funcs = meta_wayland_data_device_get_drag_dest_funcs (); + + surface_role_class->assigned (surface_role); +} + static MetaWaylandSurface * meta_wayland_subsurface_get_toplevel (MetaWaylandSurfaceRole *surface_role) { @@ -318,6 +331,7 @@ meta_wayland_subsurface_class_init (MetaWaylandSubsurfaceClass *klass) MetaWaylandActorSurfaceClass *actor_surface_class = META_WAYLAND_ACTOR_SURFACE_CLASS (klass); + surface_role_class->assigned = meta_wayland_subsurface_assigned; surface_role_class->get_toplevel = meta_wayland_subsurface_get_toplevel; surface_role_class->should_cache_state = meta_wayland_subsurface_should_cache_state; surface_role_class->notify_subsurface_state_changed = diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index d94e5b63a..d93141bdc 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1128,19 +1128,6 @@ static const struct wl_surface_interface meta_wayland_wl_surface_interface = { wl_surface_damage_buffer, }; -static void -sync_drag_dest_funcs (MetaWaylandSurface *surface) -{ - MetaWindow *window; - - window = meta_wayland_surface_get_window (surface); - if (window && - window->client_type == META_WINDOW_CLIENT_TYPE_X11) - surface->dnd.funcs = meta_xwayland_selection_get_drag_dest_funcs (); - else - surface->dnd.funcs = meta_wayland_data_device_get_drag_dest_funcs (); -} - static void surface_entered_output (MetaWaylandSurface *surface, MetaWaylandOutput *wayland_output) @@ -1297,8 +1284,6 @@ meta_wayland_surface_set_window (MetaWaylandSurface *surface, if (actor) clutter_actor_set_reactive (actor, !!window); - sync_drag_dest_funcs (surface); - if (was_unmapped) g_signal_emit (surface, surface_signals[SURFACE_UNMAPPED], 0); @@ -1423,8 +1408,6 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor, wl_list_init (&surface->pending_frame_callback_list); - sync_drag_dest_funcs (surface); - surface->outputs_to_destroy_notify_id = g_hash_table_new (NULL, NULL); surface->shortcut_inhibited_seats = g_hash_table_new (NULL, NULL); diff --git a/src/wayland/meta-xwayland-surface.c b/src/wayland/meta-xwayland-surface.c index 905b49afd..874d123ba 100644 --- a/src/wayland/meta-xwayland-surface.c +++ b/src/wayland/meta-xwayland-surface.c @@ -26,6 +26,7 @@ #include "compositor/meta-surface-actor-wayland.h" #include "compositor/meta-window-actor-private.h" #include "wayland/meta-wayland-actor-surface.h" +#include "wayland/meta-xwayland-private.h" enum { @@ -80,6 +81,19 @@ meta_xwayland_surface_associate_with_window (MetaXwaylandSurface *xwayland_surfa } } +static void +meta_xwayland_surface_assigned (MetaWaylandSurfaceRole *surface_role) +{ + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (surface_role); + MetaWaylandSurfaceRoleClass *surface_role_class = + META_WAYLAND_SURFACE_ROLE_CLASS (meta_xwayland_surface_parent_class); + + surface->dnd.funcs = meta_xwayland_selection_get_drag_dest_funcs (); + + surface_role_class->assigned (surface_role); +} + static void meta_xwayland_surface_get_relative_coordinates (MetaWaylandSurfaceRole *surface_role, float abs_x, @@ -160,6 +174,7 @@ meta_xwayland_surface_class_init (MetaXwaylandSurfaceClass *klass) object_class->finalize = meta_xwayland_surface_finalize; + surface_role_class->assigned = meta_xwayland_surface_assigned; surface_role_class->get_relative_coordinates = meta_xwayland_surface_get_relative_coordinates; surface_role_class->get_toplevel = meta_xwayland_surface_get_toplevel;