fix maximize restore issue caused by restore window size change
This commit is contained in:
parent
a769996b8d
commit
db671702df
2 changed files with 19 additions and 3 deletions
|
@ -214,6 +214,16 @@ class NativeWindowViews : public NativeWindow,
|
|||
// fullscreen), so we restore it correctly.
|
||||
gfx::Rect last_normal_bounds_;
|
||||
|
||||
// last_normal_bounds_ may or may not require update on WM_MOVE. When a window
|
||||
// is maximized, it is moved (WM_MOVE) to maximum size first and then sized
|
||||
// (WM_SIZE). In this case, last_normal_bounds_ should not update. We keep
|
||||
// last_normal_bounds_candidate_ as a candidate which will become valid
|
||||
// last_normal_bounds_ if the moves are consecutive with no WM_SIZE event in
|
||||
// between.
|
||||
gfx::Rect last_normal_bounds_candidate_;
|
||||
|
||||
bool consecutive_moves_;
|
||||
|
||||
// In charge of running taskbar related APIs.
|
||||
TaskbarHost taskbar_host_;
|
||||
|
||||
|
|
|
@ -111,18 +111,24 @@ bool NativeWindowViews::PreHandleMSG(
|
|||
return taskbar_host_.HandleThumbarButtonEvent(LOWORD(w_param));
|
||||
return false;
|
||||
|
||||
case WM_SIZE:
|
||||
case WM_SIZE: {
|
||||
consecutive_moves_ = false;
|
||||
// Handle window state change.
|
||||
HandleSizeEvent(w_param, l_param);
|
||||
return false;
|
||||
|
||||
}
|
||||
case WM_MOVING: {
|
||||
if (!movable_)
|
||||
::GetWindowRect(GetAcceleratedWidget(), (LPRECT)l_param);
|
||||
return false;
|
||||
}
|
||||
case WM_MOVE: {
|
||||
last_normal_bounds_ = GetBounds();
|
||||
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;
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue