<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - wl_data_source should have an event to indicate completion of a drag session"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=91944">91944</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wl_data_source should have an event to indicate completion of a drag session
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Wayland
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>1.5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>wayland
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>wayland-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mcatanzaro@gnome.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 (<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - weston-dnd leaks memory allocated in create_drag_icon()"
   href="show_bug.cgi?id=91943">bug #91943</a>), 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] <a href="http://lists.freedesktop.org/archives/wayland-devel/2015-June/022517.html">http://lists.freedesktop.org/archives/wayland-devel/2015-June/022517.html</a>
[2] <a href="http://lists.freedesktop.org/archives/wayland-devel/2015-June/022518.html">http://lists.freedesktop.org/archives/wayland-devel/2015-June/022518.html</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>