-
Notifications
You must be signed in to change notification settings - Fork 15.7k
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
feat: add window shadow for frameless window on Wayland and WCO on Linux #41840
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. |
f284719
to
9285c84
Compare
@codebytere Seems this is not very compatible with #41769. How can we handle drop shadow when WCO is enabled? |
c62047b
to
5a73bd5
Compare
Update: I've added support |
@codebytere I've added an implementation of GTK native WCO in 6ece5db. Would you plz have a look at it? IMO it looks more integrated with system look & feel. PS: I copied some code from your implementation. Please don't mind that :) |
BTW I found |
@ruihe774 Thanks so much for implementing this, this is amazing work! Could I ask you to rebase this PR against main so we can get the tests running green again? 🙂 We have another PR that is about to land (#41769) - if you wouldn't mind rebasing after that PR lands, that would be great! Also more than happy to work with you to resolve that once it lands. |
@VerteDinde As I've pointed out earlier, I'm afraid that these two PRs are not very compatible, in that they are implementing WCO in different ways. I'd like to have a discussion about how we can deal with it, but the OP of that PR has not responded. |
426f5e1
to
48cb85d
Compare
I've done rebasing. The build fails for Windows. I'll fix it later. |
48cb85d
to
982d376
Compare
@ruihe774 after some discussion myself and Deepak have come to the tentative conclusion that it's likely more
which should be split into two PRs. I understand my PR adds some duplication and extra code, but the longer-term plan would be to combine the two classes where possible. At the moment, the need for this feature outweighs the cost of some medium-term duplication. The other issue is that this class is more than two years old, and is notably lesser tested owing to its being Wayland-only thus far and being an opt-in feature even beyond that. I agree with @deepak1556's comment over on my PR that we should look to DRY out the code, but the severe drift between these changes and upstream leaves me concerned about the ability to accomplish the intended goal of prod use of WCO on linux without potentially introducing a host of new bugs from the drift. We'd like to continue working with you to land this code - in the short term, could you split out the window shadow changes? |
Well,
I wonder what is the long-term solution to implement WCO: draw by ourselves (what you've implemented), or draw by GTK (my implementation)?
I'm OK for that. But there's still question: how can I add window shadow to your FWIW, I think we'd better pause the merge of #41769 until we come up with a consensus. |
I think this what we want for WCO so that controls can adjust properly to the system theme. I guess the question now is the reliability of the implementations,
Would like some more opinion from linux experts /cc @ckerr |
FWIW, if WCO drawed by GTK is the ultimate goal, my another concern about #41769 is that after it is merged, the users (I mean, app developers) will get used to the self-drawing WCO, and we may break things when we ultimately switch to GTK-drawing WCO. To be clear, I'm not against unifying code and |
I don't think it's a good idea to use GTK just to draw the window controls. GTK does not offer stable APIs for drawing window frames and controls to external surfaces, so Chromium has to use lots of workarounds to make it happen. Supporting arbitrary GTK themes is a lot of work even when using GTK directly and GNOME developers have given up on it. When you add in the need to support overriding colors, it would not be worth it anymore. I think the best path forward for a more native look and feel is to pick a particular GTK theme like Adwaita or Yaru and use its window control icons in
|
I shall make it clear that it is not GTK that is actually drawing window frames. The actual stuff behind the scene is that
Electron on macOS does not support
"Supporting arbitrary GTK themes" is not my goal in this PR.
I cannot agree with "this should be much simpler". Anyway, this should be done for IMO, I think this is acceptable:
|
Having read both PRs, both look well-written. And any volunteer who has the interest, skill, and patience to dig into Electron's + Chromium's codebase and patching system is someone we should encourage! So @ruihe774 however this gets resolved, I hope you feel welcome to stick around and submit future PRs. Right now I am leaning more towards 41769, not because of any issues with the code in the PR, but more out of uncertainty in our pre-existing Wayland codebase and the way that 41769 builds on Chrome code instead. This is a bigger-picture problem than either PR; as a project we should improve our Wayland testing. If there are other maintainers who feel strongly about either PR, TBH I could be talked into either one. |
I am also leaning towards the idea of 41769; but not its implementation of WCO. The self-drawing WCO looks alien in Linux platform. I'd prefer a WCO with native look & feel. For forward compatibility, I am against the shipping of the WCO implementation in 41769. |
@ruihe774 revisiting the WCO story, given our custom titlebar implementation matches Chrome it seems better to borrow the WCO implementation. Although the rendering is not native it seems to have worked well for upstream, so I am in favor of merging #41769. This PR addressing the window shadow issue should still be accepted, if you can isolate the change that would be great. |
I'm happy to see a WCO implementation is landed.
Maybe I can try later. |
Description of Change
This PR fixes #39664.
To reproduce, create a
BrowserWindow
withframe: false
, and pass--ozone-platform=wayland
as a commandline argument.Before
After
Checklist
npm test
passesRelease Notes
Notes: Fixed drop shadow for frameless window on Wayland.