protocol: disallow re-using wl_data_source

Submitted by Simon Ser on Feb. 20, 2019, 1:08 p.m.

Details

Message ID FTNNdqWRN0Wf-G3gOQbw_jv8NHxViOHkSYfSrTenxefZeEgqhJFzyAfecnVj0YQx9jGhJfPQEh6ngCnEZcheMJgnxQGrxBlVB4vvnUeoXi0=@emersion.fr
State Superseded
Headers show
Series "protocol: disallow re-using wl_data_source" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Simon Ser Feb. 20, 2019, 1:08 p.m.
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>
---

This is an attempt to at least get this issue into the patchwork queue, so that
it's isn't completely lost in limbo. :)

 protocol/wayland.xml | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 27c07c8..efcfff9 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -765,6 +765,7 @@ 
 
     <enum name="error">
       <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>
 
     <request name="start_drag">
@@ -796,6 +797,10 @@ 
 	wl_surface is no longer used as the icon surface. When the use
 	as an icon ends, the current and pending input regions become
 	undefined, and the wl_surface is unmapped.
+
+	The given source may not be used in any further set_selection or
+	start_drag requests. Attempting to use a previously used
+	source is a protocol error.
       </description>
       <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"/>
@@ -809,6 +814,10 @@ 
 	to the data from the source on behalf of the client.
 
 	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 use a previously used
+	source is a protocol error.
       </description>
       <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"/>