-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix clipboard on Wayland #1613
Fix clipboard on Wayland #1613
Conversation
wouldn't it make more sense to make this PR to |
Maybe. I'll try preparing and submitting a PR to them. Anyway, |
Let's merge this fix into |
901fe64
to
489bf15
Compare
egui-winit/src/lib.rs
Outdated
#[cfg(unix)] | ||
let wayland_display = window.wayland_display(); | ||
#[cfg(not(unix))] | ||
let wayland_display = None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be wrapped in conditional compilation too, as Windows won't have the wayland_display()
function that comes from a platform dependent trait. I'll try compiling this on a Windows machine later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added Windows and Max to the CI matrix (in #1631), so if you merge in master
to this PR branch the CI will test for you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! A welcome change. Rebased master
. I guess I need a maintainer approval to get it the CI running as I'm a first-time contributor.
So it seems the new CI checks works! The problem with |
cargo check --target wasm32-unknown-unknown emits
|
I see now why |
I think this issue is unrelated to this PR. The same happens with the |
arboard advertises that it works with Wayland, but in reality it only works with Wayland terminal applications. To make the clipboard work with applications that draw Wayland surfaces, arboard isn't going to work. Copypasta does support Wayland's graphical clipboard, but the usage isn't documented. However, for the reasons mentioned in emilk#1474 the move from Copypasta to arboard makes sense. To resolve the issue, this commit brings in an optional dependency smithay-clipboard, that is a crate that correctly handles the Wayland clipboard in graphical applications. It is used by default if a Wayland window handle is found. If for some reason the handle to the Wayland window handle cannot be fetched, arboard is used as a backup.
I would prefer if you made new commits instead of squashing. New commits means I can see the changes since the previous one! I always squash on merge anyway, so don't worry about making a pretty history. |
You can use the |
Today I learned! thanks :) Still, commits has the benefit of giving a description of the change as well. But it seems all good now! |
Hi, primary maintainer of
@Detegr I think that we'd be willing to accept a similar contribution to this that lets users control the window surface used for both X11 and Wayland in |
arboard advertises that it works with Wayland, but in reality it only works with Wayland terminal applications. To make the clipboard work with applications that draw Wayland surfaces, arboard isn't going to work.
Copypasta does support Wayland's graphical clipboard, but the usage isn't documented. However, for the reasons mentioned in #1474 the move from Copypasta to arboard makes sense.
To resolve the issue, this commit brings in an optional dependency smithay-clipboard, that is a crate that correctly handles the Wayland clipboard in graphical applications. It is used by default if a Wayland window handle is found. If for some reason the handle to the Wayland window handle cannot be fetched, arboard is used as a backup.
It feels a bit wrong adding the
wayland_display
argument tofrom_pixels_per_point
, but I couldn't figure out any better alternatives. Maybe pass the whole window to it?Fixes #1612