<div>graesslin created this revision.<br />
graesslin added reviewers: Plasma, sebas.<br />
Herald added a project: Plasma.<br />
Herald added a subscriber: plasma-devel.</div><br /><div><strong>REVISION SUMMARY</strong><div><p>How drag'n'drop works on Wayland:<br />
When a surface has a pointer grab and a button pressed on the surface<br />
(implicit grab) the client can initiate a drag'n'drop operation on the<br />
data device. For this the client needs to provide a data source<br />
describing the data to be transmitted with the drag'n'drop operation.</p>
<p>When a drag'n'drop operation is active all pointer events are interpreted<br />
as part of the drag'n'drop operation, the pointer device is grabbed.<br />
Pointer events are no longer sent to the focused pointer but to the<br />
focused data device. When the pointer moves to another surface an<br />
enter event is sent to a data device for that surface and a leave<br />
event is sent to the data device previously focused. An enter event<br />
carries a data offer which is created from the data source for the<br />
operation.</p>
<p>During pointer motion there is a feedback mechanism. The data offer<br />
can signal to the data source that it can or cannot accept the data<br />
at the current pointer position. This can be used by the client being<br />
dragged from to update the cursor.</p>
<p>The drag'n'drop operation ends with the implicit grab being removed,<br />
that is the pressed pointer button which triggered the operation gets<br />
released. The server sends a drop event to the focused data device.</p>
<p>The data transfer can now be started. For that the receiving client<br />
creates a pipe and passes the file descriptor through the data offer<br />
to the sending data source. The sending client will write into the<br />
file descriptor and close it to finish the transfer.</p>
<p>Drag'n'drop could also be initiated through a touch device grab, but<br />
this is not yet implemented.</p>
<p>The implementation in this change focuses on the adjustments for pointer.<br />
For the user of the library drag'n'drop is implemented in the<br />
SeatInterface. Signals are emitted whenever drag is started or ended.<br />
The interaction for pointer events hardly changes. Motion, button press<br />
and button release can still be indicated in the same way. If a button<br />
release removes the implicit grab the drop is automatically performed,<br />
without the user of the library having to do anything.</p>
<p>The only change during drag and drop for the library user is that<br />
setFocusedPointerSurface is blocked. To update the current drag target<br />
the library user should use setDragTarget. Sending the enter/leave to the<br />
data device gets performed automatically.</p>
<p>The data device which triggered the drag and drop operation is exposed<br />
in the SeatInterface. The user of the library should make sure to render<br />
the additional drag icon provided on the data device. At least QtWayland<br />
based applications will freeze during drag and drop if the icon doesn't<br />
get rendered.</p>
<p>The implementation is currently still lacking the client side and due to<br />
that also auto test. It's currently only tested with QtWayland clients.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>rKWAYLAND KWayland</div></div></div><br /><div><strong>BRANCH</strong><div><div>drag-n-drop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D1046" rel="noreferrer">https://phabricator.kde.org/D1046</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/server/datadevice_interface.cpp<br />
src/server/datadevice_interface.h<br />
src/server/dataoffer_interface.cpp<br />
src/server/datasource_interface.cpp<br />
src/server/pointer_interface.cpp<br />
src/server/seat_interface.cpp<br />
src/server/seat_interface.h<br />
src/server/seat_interface_p.h</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>graesslin, Plasma, sebas<br /><strong>Cc: </strong>plasma-devel<br /></div>