-
Notifications
You must be signed in to change notification settings - Fork 946
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
Add wayland specific code to examples for windows to appear #780
Conversation
Noted that no pixels are drawn to the screen so there can be the effect of a transparent window. I didn't include drawing due to extra code overhead but that can easily be added if required. |
Given this code repeats itself a lot, I'd rather have it in an helper module that each example imports.
So, a possibility would be to have a `helpers` folder in the examples, and this code in `helpers/mod.rs` which is then imported by the examples. (the subfolder is necessary so that cargo does not try to interpret this file as an example to compile)
|
c8f7be3
to
4c6fca8
Compare
Yes that sounds like a better implementation. I still haven't included the drawing though as that would mean handling the resize event on each example to redraw the window. |
@@ -63,7 +63,7 @@ features = [ | |||
|
|||
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies] | |||
wayland-client = { version = "0.21", features = [ "dlopen", "egl", "cursor"] } | |||
smithay-client-toolkit = "0.4.3" | |||
smithay-client-toolkit = { git = "https://github.com/smithay/client-toolkit" } |
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.
Why is the smithay-client-toolkit
dependency changed to refer to the git
version instead of the crates.io
version? I'm pretty sure will prevent us from pushing this update to crates.io
.
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.
This requires changes from SCTK that are not yet released, though given how things are coming, next version of SCTK will be a breaking change (upgrade to wayland-client 0.22).
I plan to make the upgrade as part of the event loop 2.0 refactor, so I'd say this PR should wait until the eventloop 2.0 story is done.
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.
Oh wait, that was... written in original PR comment. Whoops. I guess I should read everything before making these sorts of comments 😅.
use winit::os::unix::WindowExt; | ||
|
||
// Wayland requires the commiting of a surface to display a window | ||
pub fn init_wayland(window: &winit::Window) { |
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.
This is emitting unused_variables
warnings on non-linux platforms. Could you add a let _ = window;
line somewhere to suppress that warning?
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.
For clarity, I'd actually rather move the #[cfg(...)]
in the call site in the examples, so that people can clearly see that this code is for some platform-specific stuff.
Is this PR necessary, now that #835 has been merged? |
Nope 👍 |
Adds wayland specific code to the examples to allow for the windows to appear.
Once a version of SCTK with Smithay/client-toolkit@74316f4 is released the git dependency can be replaced to that.
Fixes #776