mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland/surface: Let roles set DND functions
The DND functions are role specific, with Xwayland surface being the special one. Let the roles set it instead of having per role like logic in MetaWaylandSurface. https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
This commit is contained in:
parent
54194e67e3
commit
722ae2b77a
@ -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 =
|
||||
|
@ -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 =
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user