1
0
Fork 0

wayland/data-offer: Accept final preferrence of drop destination

Quoting the spec for `wl_data_device::drop`:
> If the resulting action is "ask", the action will not be considered
> final. The drag-and-drop destination is expected to perform one last
> wl_data_offer.set_actions request, or wl_data_offer.destroy in order
> to cancel the operation.

We did not respect the action choosen by the drop destination when
it called `wl_data_offer::set_actions` after `wl_data_device::drop`
if a user override was still active. This eventually resulted in
a protocol error in `wl_data_offer::finish`, as the current action
could still be `ask`.

Fix this by only allowing a user override to `ask` before `drop` is
called, thus making sure the final `set_actions` preference is
honored.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1952

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2043>
This commit is contained in:
Robert Mader 2021-10-06 20:08:12 +02:00 committed by Marge Bot
parent 892182e999
commit 33b834c433

View file

@ -276,7 +276,9 @@ data_offer_choose_action (MetaWaylandDataOffer *offer)
return WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
/* If the user is forcing an action, go for it */
if ((user_action & available_actions) != 0)
if ((user_action & available_actions) != 0 &&
!(user_action == WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK &&
meta_wayland_data_source_get_drop_performed (source)))
return user_action;
/* If the dest side has a preferred DnD action, use it */