fix: don't call SetBounds on restore (#19886)

This commit is contained in:
Heilig Benedek 2019-08-26 23:04:20 +02:00 committed by Shelley Vohr
parent cddbddc543
commit d04072d1eb
3 changed files with 20 additions and 67 deletions

View file

@ -409,10 +409,6 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
case WM_SIZE: {
// Handle window state change.
HandleSizeEvent(w_param, l_param);
consecutive_moves_ = false;
last_normal_bounds_before_move_ = last_normal_bounds_;
return false;
}
case WM_MOVING: {
@ -428,15 +424,6 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
}
return false;
}
case WM_MOVE: {
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
if (consecutive_moves_)
last_normal_bounds_ = last_normal_bounds_candidate_;
last_normal_bounds_candidate_ = GetBounds();
consecutive_moves_ = true;
}
return false;
}
case WM_ENDSESSION: {
if (w_param) {
NotifyWindowEndSession();
@ -467,9 +454,6 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
switch (w_param) {
case SIZE_MAXIMIZED: {
last_window_state_ = ui::SHOW_STATE_MAXIMIZED;
if (consecutive_moves_) {
last_normal_bounds_ = last_normal_bounds_before_move_;
}
if (!has_frame()) {
TriggerNCCalcSize(GetAcceleratedWidget());
@ -491,40 +475,27 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
NotifyWindowMinimize();
break;
case SIZE_RESTORED:
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
// Window was resized so we save it's new size.
last_normal_bounds_ = GetBounds();
last_normal_bounds_before_move_ = last_normal_bounds_;
} else {
switch (last_window_state_) {
case ui::SHOW_STATE_MAXIMIZED:
switch (last_window_state_) {
case ui::SHOW_STATE_MAXIMIZED:
last_window_state_ = ui::SHOW_STATE_NORMAL;
NotifyWindowUnmaximize();
if (!has_frame()) {
TriggerNCCalcSize(GetAcceleratedWidget());
}
break;
case ui::SHOW_STATE_MINIMIZED:
if (IsFullscreen()) {
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
NotifyWindowEnterFullScreen();
} else {
last_window_state_ = ui::SHOW_STATE_NORMAL;
NotifyWindowUnmaximize();
if (!has_frame()) {
TriggerNCCalcSize(GetAcceleratedWidget());
}
break;
case ui::SHOW_STATE_MINIMIZED:
if (IsFullscreen()) {
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
NotifyWindowEnterFullScreen();
} else {
last_window_state_ = ui::SHOW_STATE_NORMAL;
// When the window is restored we resize it to the previous known
// normal size.
if (has_frame()) {
SetBounds(last_normal_bounds_, false);
}
NotifyWindowRestore();
}
break;
default:
break;
}
NotifyWindowRestore();
}
break;
default:
break;
}
break;
}