Skip to content
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

fix: WCO pressed background state updates #34840

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion shell/browser/native_window_views_win.cc
Expand Up @@ -11,6 +11,7 @@
#include "shell/browser/browser.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/ui/views/root_view.h"
#include "shell/browser/ui/views/win_frame_view.h"
#include "shell/common/electron_constants.h"
#include "ui/display/display.h"
#include "ui/display/win/screen_win.h"
Expand Down Expand Up @@ -421,7 +422,7 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
}
break;
}
case SIZE_RESTORED:
case SIZE_RESTORED: {
switch (last_window_state_) {
case ui::SHOW_STATE_MAXIMIZED:
last_window_state_ = ui::SHOW_STATE_NORMAL;
Expand All @@ -439,7 +440,15 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
default:
break;
}
// If a given window was minimized/maximized and has since been
// restored, ensure the WCO buttons are set to normal state.
auto* ncv = widget()->non_client_view();
if (IsWindowControlsOverlayEnabled() && ncv) {
auto* frame_view = static_cast<WinFrameView*>(ncv->frame_view());
frame_view->caption_button_container()->ResetWindowControls();
}
break;
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions shell/browser/ui/views/win_caption_button_container.h
Expand Up @@ -46,6 +46,9 @@ class WinCaptionButtonContainer : public views::View,
// time, and both are disabled in tablet UI mode.
void UpdateButtons();

// Reset window button states to STATE_NORMAL.
void ResetWindowControls();

private:
// views::View:
void AddedToWidget() override;
Expand All @@ -55,8 +58,6 @@ class WinCaptionButtonContainer : public views::View,
void OnWidgetBoundsChanged(views::Widget* widget,
const gfx::Rect& new_bounds) override;

void ResetWindowControls();

WinFrameView* const frame_view_;
WinCaptionButton* const minimize_button_;
WinCaptionButton* const maximize_button_;
Expand Down