-
-
Notifications
You must be signed in to change notification settings - Fork 862
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
Better decorations in wayland #4970
base: main
Are you sure you want to change the base?
Conversation
How do you feel about also rebasing/revising this one? I think it will help with a couple of outstanding issues! |
f581278
to
8a608ea
Compare
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.
Thank you!
FWIW, under KDE Plasma I experience this with this pr; the window briefly appears and then we immediately terminate:
$ ./target/debug/wezterm -n --config 'window_decorations="RESIZE"'
Io error: Broken pipe (os error 32)
07:24:04.792 ERROR wezterm_gui > running message loop: Io error: Broken pipe (os error 32); terminating
@@ -2,6 +2,8 @@ | |||
//! in smithay_client_toolkit 0.11 which is Copyright (c) 2018 Victor Berger | |||
//! and provided under the terms of the MIT license. | |||
|
|||
// TODO: update this for SCTK 0.18 and use this instead of the FallbackFrame |
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.
What do we need to do here now that we're on SCTK 0.19? Does it need to be part of this PR?
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.
No, it doesn't need to be, and probably shouldn't be part of this PR.
Basically it would need to be re-written to implement the DecorationsFrame trait.
Alternatively, just delete this and use the adwaita implementation instead.
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 kinda like the idea of adwaita: feels like less of a chore for us to maintain over here
huh. not sure why my changes would result in a pipe error. I might be able to look into it later. |
363f55c
to
ac6dbe1
Compare
window/src/os/wayland/window.rs
Outdated
let outer_size = frame.add_borders(w, h); | ||
let (x, y) = frame.location(); | ||
window.set_window_geometry( | ||
x.try_into().unwrap(), |
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 still experience the broken pipe error with the latest version of this PR. Sometimes though, I see a panic trigger here; I think this is a secondary symptom during teardown, but I'd like to see it handled better. I put a dbg! around x
and in the case of the panic its value is -4
, but set_window_geometry wants unsigned values, which is the cause of this particular panic.
Probably to do something like x.max(0).try_into().unwrap()
here instead? to ensure that we don't have a negative value, same for y
?
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.
hmm, so the x and y values are actually expected to be negative.
As far as I understand, the way this works is the origin (0,0) is the top left of the inner surface. But you set the window geometry to have a negative x and y, to tell the compositor that the outer window should have space for the decorations.
Looking at examples of using the wayland_csd_decorations crate, it looks like it can be worked around by using window.xdg_surface().set_window_geometry
instead of the set_window_geometry
on the sctk XdgSurface.
I just pushed a fix for that panic. I might get a chance to test it more this weekend.
Well. On Sway, I don't get the pipe error, but it is extremely buggy. Resizing doesn't seem to work at all. Possibly I messed something when resolving conflicts. I'm not sure when I'll have the time to dig deeper into this. I wouldn't object if someone else wanted to pick this up, otherwise, I'll put this on my todo list to fix. |
This is an attempt to improve window decorations on wayland. It waits to create the window decorations until we get a configure event from the compositor, so that we can know whether the compositor wants us to use CSD or not.