Skip to content

desktop: Make clipboard support optional #15535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

ColinKinloch
Copy link
Contributor

On Wayland ruffle uses https://github.com/YaLTeR/wl-clipboard-rs which only supports wlr-data-control-unstable-v1 which is not intended to be supported by all compositors.

There are options with better support https://wayland.app/protocols/primary-selection-unstable-v1 but until it's implemented in wl-clipboard-rs ruffle will crash for want of clipboard access.

For most platforms this MR wont effect anything. On platforms without clipboard support it'll quietly fail to set and get the clipboard.

Fixes #15213

Mutter doesn't intend to support it: https://gitlab.gnome.org/GNOME/mutter/-/issues/524

@ColinKinloch ColinKinloch force-pushed the noclip branch 2 times, most recently from ea2dabb to b7a8592 Compare March 12, 2024 18:09
@evilpie evilpie enabled auto-merge (rebase) March 12, 2024 19:16
On wayland ruffle only supports `wlr-data-control-unstable-v1` which is
not intended to be supported by all compositors.
Copy link
Member

@torokati44 torokati44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
We really should get to the bottom of this Wayland protocol mess someday...

@evilpie
Copy link
Collaborator

evilpie commented Mar 12, 2024

Thank you! We really should get to the bottom of this Wayland protocol mess someday...

Second! I really hope wl-clipboard-rs or arboard can figure this out for us 😃

@evilpie evilpie merged commit 787b6f5 into ruffle-rs:master Mar 12, 2024
@torokati44
Copy link
Member

Well, of course... 😅
Or smithay-clipboard, that we're currently directly using.

@torokati44
Copy link
Member

Oh, and welcome, new contributor! 👋 😄

@torokati44
Copy link
Member

torokati44 commented Mar 12, 2024

Speaking of - could you please raise this to https://github.com/Smithay/smithay-clipboard/issues as well, @ColinKinloch?
Seems like you have a better understanding of all these protocols and their implementation statuses than us...

@ColinKinloch
Copy link
Contributor Author

could you please raise this to smithay-clipboard

Smithays fine, I'm currently looking into whether I can use it in place of arboard.

On that, do you have any example swf files that access the clipboard?

@torokati44
Copy link
Member

I meant the wlr-data-control-unstable-v1 vs. primary-selection-unstable-v1 thing.
Sounded to me like these are alternatives of each other...?

@torokati44
Copy link
Member

On that, do you have any example swf files that access the clipboard?

Yeah, see: #6476 (comment)
Proper link in this comment, steps to reach clipboard usage in the original description.

@ColinKinloch
Copy link
Contributor Author

In wayland the clipboard is defined in the core protocol by wl_data_device::selection and wl_data_device::set_selection.

wlr-data-control-unstable-v1 seems to be for creating a "clipboard manager" which seems to be a client that is allowed to manage the clipboard.

"primary selection" refers to the ability to use middle click to paste the last highlighted text.

egui_winit::clipboard::Clipboard seems like an easy option as it's already in the dependency tree and wraps both arboard and smithay-clipboard. However in testing it in a flatpak sandbox it still seems to require x11 (XWayland) to access the system clipboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Ruffle Crashes trying to run a game on Wayland
3 participants