Repository navigation
Conversation
|
@mitchchn Here's the refactor PR. |
|
@aiddya thank you so much for this, it definitely looks like the right direction and I'm going to test to help inform the Chromium changes. One question I have right away: would it be easy to support rounded corners (on all four edges, not just the top) in |
|
It should be easy on the frame side, once I make a small change in FrameViewLinux. I need to make Edit: On second thought, having |
|
The client view can be masked by setting it to transparent and then designating an opaque region using the same corner values, but yeah, that will happen in the tree host, not the frame. As long as the frame can round the edges and shadows to a provided arbitrary radius that’s fine. |
|
I've updated the CLs and this PR. You should be able to modify |
|
@aiddya works well with client view clipping but I'll save that for a follow-up ;)
|
|
@aiddya this branch already passes all but 2 tests in the BrowserWindow test spec, both to do with WCO: |
|
Great, I'll look into the two remaining failures. |
| trailing_button_container_ = | ||
| AddChildView(std::make_unique<CaptionButtonPlaceholderContainer>()); | ||
|
|
||
| FrameViewLinux::CreateCaptionButtons(); |
There was a problem hiding this comment.
Thinking more about WCO: someday Electron (and maybe Chromium?) may want to draw native-looking buttons for WCO, e.g. using icons from GTK/Qt but without the full titlebar (similar to how WCO works on macOS and Windows). I guess if Electron wanted to experiment with this it would just override this method?
There was a problem hiding this comment.
It'd depend on what the goal is. If the goal is support the full customization possibilities such as control over the icon color, background color, etc., then you'd have to duplicate or patch NavButtonProviderGtk to override icon colors to match the parameters from WCO.
If the goal is to go macOS route of only drawing the icons with a transparent background, you can reuse NavButtonProviderGtk as-is. However, you'd have to contend with contrast issues as the icons may not always have sufficient contrast unlike macOS traffic lights.
After that point, it's just a matter of overriding this to create image buttons and Layout to use views::MaybeUpdateCachedFrameButtonImages, same as NativeFrameViewLinux.
| bg_color = obc; | ||
| } | ||
| leading_button_container_->SetBackground( | ||
| views::CreateSolidBackground(bg_color)); |
There was a problem hiding this comment.
Is a transparent container possible to support if the user sets the color using RGBA? (it works on Windows and helps with frameless views that change color, e.g. dimming when they show modals.)
There was a problem hiding this comment.
Yes, that should be possible. We'd need to have a different way of communicating transparency and default value like optionals.
Replace ClientFrameViewLinux with electron::NativeFrameViewLinux, a thin wrapper over the views::NativeFrameViewLinux base class. The wrapper provides Electron integration, such as draggable region support in NonClientHitTest and the window title updates. ElectronDesktopWindowTreeHostLinux and NativeWindowViews now use FrameViewLinux to query frame geometry and update window states in addition to LinuxFrameLayout. Assisted-By: Claude Opus 4.6, Claude Code
Replace OpaqueFrameView with ElectronFrameViewLinux, rebased on the new Chromium FrameViewLinux base class. This orphans LinuxFrameLayout, which is now removed. ElectronDesktopWindowTreeHostLinux now invokes FrameViewLinux methods on window changes like transparency and shadows. ElectronFrameViewLayoutLinux extends FrameViewLayoutLinux to handle three modes: shadow-only, WCO, and transparent. It overrides frame geometry methods from the base class for these modes and adds a few new ones for WCO. Assisted-By: Claude Opus 4.6, Claude Code
|
@aiddya What are the next steps now that the upstream code is merged? |

Description of Change
This is a PR demonstrating that ClientFrameViewLinux and OpaqueFrameView can be rebased on top of two new proposed classes in Chromium: FrameViewLinux and NativeFrameViewLinux. This change is not meant to land as it is, its only purpose is to seek feedback.
ClientFrameViewLinux has been entirely replaced by a thin wrapper over NativeFrameViewLinux to integrate with Electron. OpaqueFrameView has been rebased on FrameViewLinux as ElectronFrameViewLinux. I chose to rename this class as it handles transparent windows too. ElectronFrameViewLinux handles drawing while ElectronFrameViewLayoutLinux handles layout decisions for frameless (with or without shadow, with or without WCO) and transparent modes. As the base FrameViewLinux class respects user preferences on window controls, ElectronFrameViewLinux has been changed to match. WCO can now show user-configured buttons in either all-trailing, all-leading or a mix of leading and trailing order.
Instead of drawing an inside resize border for frameless without shadow mode, we instead set shadow to none and let the frame border insets collapse to the resize band. This ensures consistent resize behavior across modes, which is a 10 px band all around the client/frame area. It also allows us to do neat things like runtime toggling of shadows, which has now been implemented on Linux.
Checklist
npm testpassesRelease Notes
Notes: none