feat: enable Windows Control Overlay on Linux (#42682)
* feat: enable Windows Control Overlay on Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * docs: update documentation for Linux WCO Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: initial symbol painting Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * test: enable WCO tests for Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: add missing Layer include Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: fix gn-check failure Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: enable BrowserWindow.setTitleBarOverlay on Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * test: fix test for maximize event on Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: geometry updating on BrowserWindow.setTitleBarOverlay Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: crash when invalid titleBarStyle set Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: clean up ordering and comments Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * Update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * feat: enable customizing symbolColor Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * docs: correct symbolColor reference Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * chore: remove Chrome-specific padding Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
This commit is contained in:
parent
89d09922f7
commit
342ef8e7e1
24 changed files with 1026 additions and 107 deletions
|
@ -37,8 +37,6 @@ void WinFrameView::Init(NativeWindowViews* window, views::Widget* frame) {
|
|||
if (window->IsWindowControlsOverlayEnabled()) {
|
||||
caption_button_container_ =
|
||||
AddChildView(std::make_unique<WinCaptionButtonContainer>(this));
|
||||
} else {
|
||||
caption_button_container_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,24 +80,23 @@ views::View* WinFrameView::TargetForRect(views::View* root,
|
|||
// Custom system titlebar returns non HTCLIENT value, however event should
|
||||
// be handled by the view, not by the system, because there are no system
|
||||
// buttons underneath.
|
||||
if (!ShouldCustomDrawSystemTitlebar()) {
|
||||
if (!window()->IsWindowControlsOverlayEnabled())
|
||||
return this;
|
||||
}
|
||||
|
||||
auto local_point = rect.origin();
|
||||
ConvertPointToTarget(parent(), caption_button_container_, &local_point);
|
||||
if (!caption_button_container_->HitTestPoint(local_point)) {
|
||||
if (!caption_button_container_->HitTestPoint(local_point))
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
return NonClientFrameView::TargetForRect(root, rect);
|
||||
}
|
||||
|
||||
int WinFrameView::NonClientHitTest(const gfx::Point& point) {
|
||||
if (window_->has_frame())
|
||||
if (window()->has_frame())
|
||||
return frame_->client_view()->NonClientHitTest(point);
|
||||
|
||||
if (ShouldCustomDrawSystemTitlebar()) {
|
||||
if (window()->IsWindowControlsOverlayEnabled()) {
|
||||
// See if the point is within any of the window controls.
|
||||
if (caption_button_container_) {
|
||||
gfx::Point local_point = point;
|
||||
|
@ -168,10 +165,6 @@ bool WinFrameView::IsMaximized() const {
|
|||
return frame()->IsMaximized();
|
||||
}
|
||||
|
||||
bool WinFrameView::ShouldCustomDrawSystemTitlebar() const {
|
||||
return window()->IsWindowControlsOverlayEnabled();
|
||||
}
|
||||
|
||||
void WinFrameView::Layout(PassKey) {
|
||||
LayoutCaptionButtons();
|
||||
if (window()->IsWindowControlsOverlayEnabled()) {
|
||||
|
@ -197,7 +190,7 @@ int WinFrameView::FrameTopBorderThicknessPx(bool restored) const {
|
|||
|
||||
// See comments in BrowserDesktopWindowTreeHostWin::GetClientAreaInsets().
|
||||
const bool needs_no_border =
|
||||
(ShouldCustomDrawSystemTitlebar() && frame()->IsMaximized()) ||
|
||||
(window()->IsWindowControlsOverlayEnabled() && frame()->IsMaximized()) ||
|
||||
frame()->IsFullscreen();
|
||||
if (needs_no_border && !restored)
|
||||
return 0;
|
||||
|
@ -245,7 +238,7 @@ void WinFrameView::LayoutCaptionButtons() {
|
|||
return;
|
||||
|
||||
// Non-custom system titlebar already contains caption buttons.
|
||||
if (!ShouldCustomDrawSystemTitlebar()) {
|
||||
if (!window()->IsWindowControlsOverlayEnabled()) {
|
||||
caption_button_container_->SetVisible(false);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue