diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-01-04 11:07:54 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-01-04 12:51:32 -0500 |
commit | 759d53cfa0359c00f31839b51a35144e85b5ae3c (patch) | |
tree | b74d500586c9214a3ea64c1f307672a289c796c3 /gdk/wayland | |
parent | 814d20d61a6881d1ba8632f485892ef74ad1991d (diff) | |
download | gtk+-759d53cfa0359c00f31839b51a35144e85b5ae3c.tar.gz |
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.
Diffstat (limited to 'gdk/wayland')
-rw-r--r-- | gdk/wayland/gdkdrop-wayland.c | 26 |
1 files 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); |