Skip to content

desktop: Use egui-winit clipboard #15566

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 13, 2024
Merged

Conversation

ColinKinloch
Copy link
Contributor

The egui-winit clipboard implementation provides a nice interface to smithay-clipboard which correctly implements the core wayland selection protocol. It uses arboard as a fallback for other platforms.

It also provides a fake internal clipboard as a final fallback.

#15535

@torokati44
Copy link
Member

What is the resolution of this? 🤔

However in testing it in a flatpak sandbox it still seems to require x11 (XWayland) to access the system clipboard.

@torokati44
Copy link
Member

But: "Look at all those dropped dependencies from Cargo.lock! 🤩"

@ColinKinloch
Copy link
Contributor Author

What is the resolution of this? 🤔

I was using Clipboard::new(None) which just falls back to arboard, to get it to use the wayland protocol it needs access to the wl_display. I was running on fumes at that point.

Look at all those dropped dependencies

It's a little odd, the egui version still uses arboard.

I considered trying to fix arboard but as far as I can see winit has plans for a clipboard interface and I think that's a better place for that code.

@torokati44
Copy link
Member

I was using Clipboard::new(None) which just falls back to arboard, to get it to use the wayland protocol it needs access to the wl_display. I was running on fumes at that point.

Ah, I see. So the "needs X11/XWayland in Flatpack" thing is no longer true this way?

It's a little odd, the egui version still uses arboard.

Yeah, but that has default-features = false set, disablingimage-data support - which we actually don't need at the moment.

@ColinKinloch
Copy link
Contributor Author

ColinKinloch commented Mar 13, 2024

Correct, ruffle can access the clipboard under flatpak with x11 access revoked.
Here's a little script I've been using to test:

#!/usr/bin/env sh

RUST_PREFIX="/lib/sdk/rust-stable"
RUST_ENABLE="${RUST_PREFIX}/enable.sh"
LLVM_ENABLE="/usr/lib/sdk/llvm17/enable.sh"
JAVA_ENABLE="/usr/lib/sdk/openjdk/enable.sh"

flatpak run \
  --device=dri \
  --share=network \
  --socket=pulseaudio \
  --socket=wayland \
  --nosocket=x11 \
  --nosocket=fallback-x11 \
  --share=ipc \
  --command=bash \
  --filesystem="$(pwd)" \
  org.freedesktop.Sdk//23.08 \
  -c "source ${RUST_ENABLE} && source ${LLVM_ENABLE} && source ${JAVA_ENABLE} && cargo ${*}"

@torokati44
Copy link
Member

Awesome - thank you so much!

The `egui-winit` clipboard implementation provides a nice interface to
`smithay-clipboard` which correctly implements the core wayland
selection protocol. It uses `arboard` as a fallback for other platforms.
@torokati44 torokati44 enabled auto-merge (rebase) March 13, 2024 22:17
@torokati44 torokati44 merged commit f472bbc into ruffle-rs:master Mar 13, 2024
@ColinKinloch ColinKinloch deleted the yesclip branch March 13, 2024 22:41
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.

2 participants