fix: snapped restoration after minimization (#48155)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
2a9780141c
commit
3faad259e8
2 changed files with 18 additions and 5 deletions
|
@ -310,6 +310,9 @@ class NativeWindowViews : public NativeWindow,
|
||||||
// Whether the window is currently being moved.
|
// Whether the window is currently being moved.
|
||||||
bool is_moving_ = false;
|
bool is_moving_ = false;
|
||||||
|
|
||||||
|
// Whether or not the window was previously snapped e.g. before minimizing.
|
||||||
|
bool was_snapped_ = false;
|
||||||
|
|
||||||
std::variant<std::monostate, bool, SkColor> accent_color_;
|
std::variant<std::monostate, bool, SkColor> accent_color_;
|
||||||
|
|
||||||
std::optional<gfx::Rect> pending_bounds_change_;
|
std::optional<gfx::Rect> pending_bounds_change_;
|
||||||
|
|
|
@ -462,11 +462,12 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case WM_SYSCOMMAND: {
|
case WM_SYSCOMMAND: {
|
||||||
// Mask is needed to account for double clicking title bar to maximize
|
WPARAM cmd = w_param & 0xFFF0;
|
||||||
WPARAM max_mask = 0xFFF0;
|
// Needed to account for double clicking title bar to maximize.
|
||||||
if (transparent() && ((w_param & max_mask) == SC_MAXIMIZE)) {
|
if (transparent() && (cmd == SC_MAXIMIZE))
|
||||||
return true;
|
return true;
|
||||||
}
|
if (cmd == SC_MINIMIZE)
|
||||||
|
was_snapped_ = IsSnapped();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case WM_INITMENU: {
|
case WM_INITMENU: {
|
||||||
|
@ -519,8 +520,13 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
|
||||||
// multiple times for one resize because of the SetWindowPlacement call.
|
// multiple times for one resize because of the SetWindowPlacement call.
|
||||||
if (w_param == SIZE_MAXIMIZED &&
|
if (w_param == SIZE_MAXIMIZED &&
|
||||||
last_window_state_ != ui::mojom::WindowShowState::kMaximized) {
|
last_window_state_ != ui::mojom::WindowShowState::kMaximized) {
|
||||||
if (last_window_state_ == ui::mojom::WindowShowState::kMinimized)
|
if (last_window_state_ == ui::mojom::WindowShowState::kMinimized) {
|
||||||
|
if (was_snapped_) {
|
||||||
|
SetRoundedCorners(false);
|
||||||
|
was_snapped_ = false;
|
||||||
|
}
|
||||||
NotifyWindowRestore();
|
NotifyWindowRestore();
|
||||||
|
}
|
||||||
last_window_state_ = ui::mojom::WindowShowState::kMaximized;
|
last_window_state_ = ui::mojom::WindowShowState::kMaximized;
|
||||||
NotifyWindowMaximize();
|
NotifyWindowMaximize();
|
||||||
ResetWindowControls();
|
ResetWindowControls();
|
||||||
|
@ -542,6 +548,10 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
|
||||||
last_window_state_ = ui::mojom::WindowShowState::kFullscreen;
|
last_window_state_ = ui::mojom::WindowShowState::kFullscreen;
|
||||||
NotifyWindowEnterFullScreen();
|
NotifyWindowEnterFullScreen();
|
||||||
} else {
|
} else {
|
||||||
|
if (was_snapped_) {
|
||||||
|
SetRoundedCorners(false);
|
||||||
|
was_snapped_ = false;
|
||||||
|
}
|
||||||
last_window_state_ = ui::mojom::WindowShowState::kNormal;
|
last_window_state_ = ui::mojom::WindowShowState::kNormal;
|
||||||
NotifyWindowRestore();
|
NotifyWindowRestore();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue