WIP: Port klipper to use wayland clipboard
AbandonedPublic

Authored by davidedmundson on May 6 2020, 10:26 AM.

Details

Summary

Wayland has an entire new protocol for getting and setting clipboard
when we don't have focus. Unfortunately this means reinventing
QClipboard from the QPA.

Not mergable as-is, especially the hardcoded line in CMakeLists but
uploaded to show direction.

It uses the newly agreed approach of using QtWayland generated classes
in clients directly rather than writing full pimpl API-fixed wrappers first,
as ultimately that didn't really help do anything.

Code is written so that it can be moved to KWindowSystem if needed by
KDEConnect or others.

Test Plan

Copying and pasting all over the place

Diff Detail

Repository
R120 Plasma Workspace
Branch
davidedmundson/clipboard2
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26774
Build 26792: arc lint + arc unit
davidedmundson created this revision.May 6 2020, 10:26 AM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 6 2020, 10:26 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.May 6 2020, 10:26 AM
zzag added a subscriber: zzag.EditedMay 6 2020, 12:31 PM

+1 in general.

Not mergable as-is, especially the hardcoded line in CMakeLists but uploaded to show direction.

Heh, it seems like we now have a good reason to upstream FindWaylandProtocols.cmake from KWayland to extra-cmake-modules. :-)

Edit: oh, the protocol spec file comes from plasma-wayland-protocolskwayland-server. Never mind.

Isn't this something that should be in QClipboard in an ideal world? Or is that currently not feasible since the protocol is non-standard?

apol added a subscriber: apol.May 6 2020, 12:48 PM

Isn't this something that should be in QClipboard in an ideal world? Or is that currently not feasible since the protocol is non-standard?

It's more that only few processes should be able to monitor the clipboard.
We'll need some of that code for kdeconnect-kde though, in case that's why you're asking.

apol added a comment.May 6 2020, 12:54 PM

+1

klipper/systemclipboard.cpp
63 ↗(On Diff #82074)

Maybe split the DataControl classes into a separate file?

klipper/systemclipboard.h
45 ↗(On Diff #82074)

I'd call it QtClipboard or GenericClipboard. There's nothing X-specific there.

Fix the klipper code to handle detecting null buffer better
X code expected a valid QMimeData object with no contents

cblack added a subscriber: cblack.May 6 2020, 2:34 PM
cblack added inline comments.
klipper/systemclipboard.cpp
61 ↗(On Diff #82106)

Is there a reason this #include is all the way down here instead of at the top of the file?

ngraham added a subscriber: ngraham.May 7 2020, 1:57 AM
ngraham added inline comments.
klipper/CMakeLists.txt
16

I don't seem to have your home directory on my system :)

ngraham added inline comments.May 7 2020, 2:31 AM
klipper/CMakeLists.txt
16

Never mind :)

shuffle files about

davidedmundson abandoned this revision.May 18 2020, 4:12 PM

Moving to invent