protocol: disallow re-using wl_data_source

As pointed out in [1], re-using a wl_data_source for multiple start_drag or
set_selection requests has bad consequences, because this object has events
that allo tracking the state of a selection/drag-and-drop operation. Tracking
two operations at the same time isn't possible with this interface.

[1]: https://lists.freedesktop.org/archives/wayland-devel/2019-January/039936.html

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Simon Ser 2019-02-20 14:03:55 +01:00
parent cdd890a6f8
commit 307b23626d

View file

@ -847,6 +847,7 @@
<enum name="error"> <enum name="error">
<entry name="role" value="0" summary="given wl_surface has another role"/> <entry name="role" value="0" summary="given wl_surface has another role"/>
<entry name="used_source" value="1" summary="source has already been used"/>
</enum> </enum>
<request name="start_drag"> <request name="start_drag">
@ -876,6 +877,10 @@
The input region is ignored for wl_surfaces with the role of a The input region is ignored for wl_surfaces with the role of a
drag-and-drop icon. drag-and-drop icon.
The given source may not be used in any further set_selection or
start_drag requests. Attempting to reuse a previously-used source
may send a used_source error.
</description> </description>
<arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the eventual transfer"/> <arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the eventual transfer"/>
<arg name="origin" type="object" interface="wl_surface" summary="surface where the drag originates"/> <arg name="origin" type="object" interface="wl_surface" summary="surface where the drag originates"/>
@ -889,6 +894,10 @@
to the data from the source on behalf of the client. to the data from the source on behalf of the client.
To unset the selection, set the source to NULL. To unset the selection, set the source to NULL.
The given source may not be used in any further set_selection or
start_drag requests. Attempting to reuse a previously-used source
may send a used_source error.
</description> </description>
<arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the selection"/> <arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the selection"/>
<arg name="serial" type="uint" summary="serial number of the event that triggered this request"/> <arg name="serial" type="uint" summary="serial number of the event that triggered this request"/>