From 21dca329349cc76f0f1b2e2998b374e1b454705d Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 17 Jan 2020 19:32:08 +0100 Subject: [PATCH] xwayland: Set XDND source-side actions as per XDND In XDND, we just get a hint on XdndPosition about what's the action chosen by the user. Make the data source actions the full set on XdndEnter (as we can't know better), and pass the hint in XdndPosition as the user chosen action as it should be. Makes Wayland drop sites aware of the user action as per XDND with X11 drag sources, and still makes modifiers during DnD work. https://gitlab.gnome.org/GNOME/mutter/issues/974 https://gitlab.gnome.org/GNOME/mutter/merge_requests/1005 (cherry picked from commit 090a6ad409ce0ea0bcf30b66cb1048dfdb86ab9e) --- src/wayland/meta-wayland-data-device.c | 6 +++--- src/wayland/meta-wayland-data-device.h | 2 ++ src/wayland/meta-xwayland-dnd.c | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index 53477a533..08940c94b 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -334,9 +334,9 @@ meta_wayland_data_source_set_actions (MetaWaylandDataSource *source, priv->actions_set = TRUE; } -static void -meta_wayland_data_source_set_user_action (MetaWaylandDataSource *source, - enum wl_data_device_manager_dnd_action action) +void +meta_wayland_data_source_set_user_action (MetaWaylandDataSource *source, + uint32_t action) { MetaWaylandDataSourcePrivate *priv = meta_wayland_data_source_get_instance_private (source); diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h index c61c241a5..027dafc54 100644 --- a/src/wayland/meta-wayland-data-device.h +++ b/src/wayland/meta-wayland-data-device.h @@ -121,6 +121,8 @@ uint32_t meta_wayland_data_source_get_current_action (MetaWaylandDataSource *sou void meta_wayland_data_source_set_actions (MetaWaylandDataSource *source, uint32_t dnd_actions); +void meta_wayland_data_source_set_user_action (MetaWaylandDataSource *source, + uint32_t action); void meta_wayland_data_source_set_current_action (MetaWaylandDataSource *source, uint32_t action); diff --git a/src/wayland/meta-xwayland-dnd.c b/src/wayland/meta-xwayland-dnd.c index 31c97da19..7169ca2d9 100644 --- a/src/wayland/meta-xwayland-dnd.c +++ b/src/wayland/meta-xwayland-dnd.c @@ -787,6 +787,10 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor, xdnd_atoms[ATOM_DND_TYPE_LIST]); } + meta_wayland_data_source_set_actions (dnd->source, + WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY | + WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE | + WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK); meta_wayland_drag_grab_set_focus (drag_grab, dnd->focus_surface); return TRUE; } @@ -806,7 +810,7 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor, clutter_event_set_time (motion, dnd->last_motion_time); action = atom_to_action ((Atom) event->data.l[4]); - meta_wayland_data_source_set_actions (dnd->source, action); + meta_wayland_data_source_set_user_action (dnd->source, action); meta_wayland_surface_drag_dest_motion (drag_focus, motion); xdnd_send_status (dnd, (Window) event->data.l[0],