From 759d53cfa0359c00f31839b51a35144e85b5ae3c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 4 Jan 2020 11:07:54 -0500 Subject: [PATCH] wayland: Don't artificially prefer ASK We were always adding ASK to the list of possible actions, and preferring it. This was causing the ask cursor to show up when both the source and the target support ASK, even though it is only meant to happen if you hold the Alt modifier. Instead, use one of the supported actions as preferred action. --- gdk/wayland/gdkdrop-wayland.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/gdk/wayland/gdkdrop-wayland.c b/gdk/wayland/gdkdrop-wayland.c index 2648660b4a..c0c82036dd 100644 --- a/gdk/wayland/gdkdrop-wayland.c +++ b/gdk/wayland/gdkdrop-wayland.c @@ -119,25 +119,27 @@ gdk_wayland_drop_commit_status (GdkWaylandDrop *wayland_drop, GdkDragAction actions) { GdkDisplay *display; - uint32_t dnd_actions; display = gdk_drop_get_display (GDK_DROP (wayland_drop)); - dnd_actions = gdk_to_wl_actions (actions); - if (GDK_WAYLAND_DISPLAY (display)->data_device_manager_version >= WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION) { - if (gdk_drag_action_is_unique (actions)) - { - wl_data_offer_set_actions (wayland_drop->offer, dnd_actions, dnd_actions); - } + uint32_t dnd_actions; + uint32_t preferred_action; + + dnd_actions = gdk_to_wl_actions (actions); + + if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY) + preferred_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; + else if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE) + preferred_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE; + else if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK) + preferred_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK; else - { - wl_data_offer_set_actions (wayland_drop->offer, - dnd_actions | WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK, - WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK); - } + preferred_action = 0; + + wl_data_offer_set_actions (wayland_drop->offer, dnd_actions, preferred_action); } gdk_wayland_drop_drop_set_status (wayland_drop, actions != 0); -- 2.30.2