fix: Add support for Wayland window decorations#29618
fix: Add support for Wayland window decorations#29618nornagon merged 7 commits intoelectron:mainfrom
Conversation
|
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
11faf64 to
5ce7123
Compare
|
Right, almost forgot: there are also 2 TODOs in the source, related to an accessibility string define that's present in Chromium but missing here + |
|
One more note I forgot to add (geez I'm good at forgetting things to add to initial PR descriptions): there were a few values that had to be hardcoded from Adwaita's CSS, namely, the box-shadow and border-top-[left/right]-radius. For the latter in particular, my rationale is that both Yaru and Adwaita have a border-radius on the top of the window, thus omitting it would make the windows look out-of-place in what is quite likely the two most oft-used themes (Yaru is Ubuntu's default, Adwaita is the upstream GNOME default). On the other hand, this does mean that it still looks out of place in themes like Adapta that use sharp corners. I'm not sure if there's an ideal solution here, but I think this one is "good enough" for the moment (since there aren't any decorations right now). On an unrelated note, it does seem that the Linux build failures are related to Goma issues, not this PR. |
|
I think this is looking great! I'm planning to build and test this locally but until I get around to do that I was wondering how is this going to affect compositors that support server-side decorations (e.g.: Plasma, sway, etc)? Are they going to get duplicate decorations (one from the compositor and one from the client)? |
|
I believe the server-side decoration protocol requires the client to essentially opt-in:
From some stepping through the source code, it seems like this only occurs if |
5ce7123 to
d45de27
Compare
|
@vially as of the latest commit, it should go back to using SSD on compositors that support it. I couldn't test with KDE, but I did test with Sway, where it appeared to work. |
2779af1 to
68b39d9
Compare
|
following along with excitement. thank you for taking on this complex task @refi64! |
68b39d9 to
b53cc01
Compare
|
From some local testing, I believe this should be usable enough for general use. There are two outstanding open notes:
I believe these issues are not "blocking" per se because:
With this in mind, I'm now marking this PR as ready for review. |
|
Thank you very much for that PR ❤️ As a Gnome on Wayland user i would love to see this getting merged fast, because using Electron apps without any window decorations is "somewhat less than perfect". Edit: Just out of interest: I'm not a desktop dev by any means, but did you need to introduce any GTK related dependencies to make this work? |
Well GNOME/Mutter isn't exactly obscure
Weston, the reference implementation, doesn't - even those that support
Electron already depends on Gtk
Mutter already depends on Gtk |
Maybe I'm wrong about the other points, but at least this one could be right, as explained in this comment :https://gitlab.gnome.org/GNOME/mutter/-/issues/217#note_357576 However this is quite offtopic, so nevermind. |
patches/chromium/ozone_wayland_assume_windows_need_transparency.patch
Outdated
Show resolved
Hide resolved
patches/chromium/ozone_wayland_add_support_for_content_insets.patch
Outdated
Show resolved
Hide resolved
b53cc01 to
b94cf6d
Compare
nornagon
left a comment
There was a problem hiding this comment.
This is quite a large and fairly intricate patch. What are the obstacles to upstreaming this? I'd prefer not to take on a "forever patch" of this scale.
|
@nornagon does Chromium normally take patches for things not used in Chromium itself? I believe upstreaming it is probably doable otherwise, but I'd expect "we're not actively using this" to be a roadblock? |
|
@refi64 It depends, but broadly speaking, no. It's worth trying anyway though, as sometimes you'll get a friendly reviewer and/or you can make a case for why it should be merged anyway (e.g. chromium might use it in the future; it sounds like there is a potential path there based on an argument that their window decorations should be better on wayland?) If upstreaming this patch is a complete dead end, we should explore, in order of preference:
If we can't do any of the above, I am 👎 on this PR. Every patch we take on creates a significant maintenance burden. If landed as-is, this patch would be the largest Chromium patch we are carrying, by a factor of 2. A patch of this size is not worth the ongoing maintenance cost for what it buys, IMO. |
|
Understood, I'll start taking a look into what it would take to upstream this. There are a few patches we're carrying in the Chromium Flatpak I should be upstreaming soon too, I guess this is extra incentive! |
Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Thank you so much! btw is --ozone-platform=wayland still necessary? |
|
Great to see this merged! Just for some clarity though, what's going to be the policy for promoting it from behind a flag? |
|
I am trying this out with Slack, which currently runs on electron 18.1.0 from what I can tell. |
|
I see the exact same behavior. I'm using Arch and am also on GNOME 42. |
|
This issue #33161 |
Description of Change
This implements client-side-drawn window decorations for native Wayland usage. Closes #27522.
Current notes (reasons for WIP mark):
I have not tested this with many GTK themes or on many compositorsHas been now tested with Yaru, Pop's theme, and a few others (CrosAdapta had some glitches but upstream Chromium breaks under it too, so it's not just on us). In addition, on Sway it has been tested to continue using SSD.Menus are, uhh, offset from their correct position? Not clear if this is an issue related to upstream Wayland support...but realistically it's probably on my end.Fixed now. This may also implement drag-and-drop...but right now many drag-and-drop uses on Chromium Wayland instantly crash the whole thing anyway, so I can't even test that part yet.Demo:
Screencast.from.06-09-2021.12.27.26.PM.mp4
Checklist
npm testpassesRelease Notes
Notes: none