Commit ffad55c6 authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Robert Mader
Browse files

wayland: Handle dragging from/dropping to v1 data device users

Interoperation between wl_data_device_manager v1 and v3 got broken
at some point. Ensure that we resort to the "copy" action if either
the drop site or the drag source are from a client that requested v1.

Closes: GNOME/mutter#965
parent 2212a44c
Pipeline #148201 passed with stages
in 5 minutes and 9 seconds
......@@ -106,6 +106,7 @@ static struct wl_resource * create_and_send_clipboard_offer (MetaWaylandDataDevi
struct wl_resource *target);
static struct wl_resource * create_and_send_primary_offer (MetaWaylandDataDevice *data_device,
struct wl_resource *target);
static struct wl_resource * meta_wayland_data_source_get_resource (MetaWaylandDataSource *source);
static void
unbind_resource (struct wl_resource *resource)
......@@ -138,8 +139,20 @@ data_offer_choose_action (MetaWaylandDataOffer *offer)
MetaWaylandDataSource *source = offer->source;
uint32_t actions, user_action, available_actions;
actions = meta_wayland_data_source_get_actions (source);
user_action = meta_wayland_data_source_get_user_action (source);
if (wl_resource_get_version (offer->resource) <
WL_DATA_OFFER_ACTION_SINCE_VERSION)
return WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
if (wl_resource_get_version (meta_wayland_data_source_get_resource (source)) <
WL_DATA_SOURCE_ACTION_SINCE_VERSION)
{
actions = user_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
}
else
{
actions = meta_wayland_data_source_get_actions (source);
user_action = meta_wayland_data_source_get_user_action (source);
}
available_actions = actions & offer->dnd_actions;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment