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
This commit is contained in:
Carlos Garnacho 2020-01-17 19:32:08 +01:00 committed by Robert Mader
parent a6c195b05c
commit 090a6ad409
3 changed files with 10 additions and 4 deletions

View File

@ -345,9 +345,9 @@ meta_wayland_data_source_set_actions (MetaWaylandDataSource *source,
priv->actions_set = TRUE;
}
static void
void
meta_wayland_data_source_set_user_action (MetaWaylandDataSource *source,
enum wl_data_device_manager_dnd_action action)
uint32_t action)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);

View File

@ -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);

View File

@ -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],