Bug 91944

Summary: wl_data_source should have an event to indicate completion of a drag session
Product: Wayland Reporter: Michael Catanzaro <mcatanzaro>
Component: waylandAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: carlosg, lantw44, mcatanzaro
Version: 1.5.0   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 91943, 91948    

Description Michael Catanzaro 2015-09-09 20:03:39 UTC
When GTK+ is a drag source, it assumes that a drag session has ended after it handles the data_source.send event. After handling data_source.send, it frees memory associated with the drag session and releases its manual pointer grab, causing data_offer.leave to be immediately sent to the destination client. This causes several incompatibilities with the reference weston-dnd client:

* Unlike weston-dnd, it's impossible to send multiple different types of data in the same session.
* This breaks Wayland clients that request transfer of data before the drop is performed, which is well-supported by weston-dnd.

But GTK+ does this because anything else would be wrong: there is no other way for the drag source to know when the drag session is over, other than to assume that it ends during data_source.send. The weston-dnd client does not have these issues because it has no need for a client-side grab (which must be released when the DnD session is complete) and it simply leaks all memory associated with the DnD sessions (bug #91943), which would be unacceptable for GTK+.

One way to fix this would be to add a new event, wl_data_source.drag_finished, which the compositor would send to the source client at the same time it sends wl_data_device.leave to the destination client. This has already been implemented by Carlos Garnacho in [1] and [2], though it is just a subset of the functionality added in those patches. GTK+ would then be modified to release its grab in response to that event instead.

[1] http://lists.freedesktop.org/archives/wayland-devel/2015-June/022517.html
[2] http://lists.freedesktop.org/archives/wayland-devel/2015-June/022518.html
Comment 1 Michael Catanzaro 2016-03-17 01:56:53 UTC
We now have wl_data_offer::finish

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.