<table><tr><td style="">graesslin created this revision.<br />graesslin added reviewers: Plasma on Wayland, KWin.<br />Restricted Application added subscribers: kwin, plasma-devel.<br />Restricted Application added projects: Plasma on Wayland, KWin.</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D1973" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The clipboard sync is done by a dedicated helper binary launched by<br />
KWin. This helper binary is forced to xcb platform to picky-back on<br />
Qt's implementation of the X11 clipboard. In addition it implements<br />
the Wayland clipboard - which is much simpler. Reading the Wayland<br />
clipboard is based on the implementation in QtWayland.</p>

<p>KWin internally knows the DataDeviceInterface belonging to the helper<br />
application. Whenever an xwayland client is focussed, this DataDevice<br />
is allowed to set the selection and KWin manually updates the current<br />
selection in the SeatInterface. By that the sync from X11 to Wayland<br />
is implemented. When afterwards a Wayland client is selected, it's sent<br />
the current selection which references the X clipboard and a data<br />
transfer can be initiated in the normal Wayland way.</p>

<p>For the other direction KWin sends the current selection to the helper's<br />
DataDevice whenever an xwayland window is focused. The helper application<br />
reads the Wayland clipboard and sets it on the X11 clipboard. Thus the<br />
Wayland clipboard is synced to X11.</p>

<p>The approach used here will also be useful for implementing a clipboard<br />
manager (aka klipper).</p>

<p>Currently the implementation is not yet fully completed. We need to<br />
make sure that the helper application gets restarted in case of a crash.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Test cases still missing. I'm not exactly sure how I can test<br />
this. But running the code currently and happily copy/paste.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>rKWIN KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>xclipboard-syncer</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D1973" rel="noreferrer">https://phabricator.kde.org/D1973</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
config-kwin.h.cmake<br />
helpers/CMakeLists.txt<br />
helpers/xclipboardsync/CMakeLists.txt<br />
helpers/xclipboardsync/main.cpp<br />
helpers/xclipboardsync/waylandclipboard.cpp<br />
helpers/xclipboardsync/waylandclipboard.h<br />
keyboard_input.cpp<br />
wayland_server.cpp<br />
wayland_server.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 on Wayland, KWin<br /><strong>Cc: </strong>plasma-devel, kwin, hardening, jensreuterberg, sebas<br /></div>