parent
8c31c7fb59
commit
4d02fc58fa
2 changed files with 36 additions and 16 deletions
|
@ -283,6 +283,8 @@ NativeWindowViews::NativeWindowViews(
|
||||||
else
|
else
|
||||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||||
|
|
||||||
|
last_normal_size_ = gfx::Size(widget_size_);
|
||||||
|
|
||||||
if (!has_frame()) {
|
if (!has_frame()) {
|
||||||
// Set Window style so that we get a minimize and maximize animation when
|
// Set Window style so that we get a minimize and maximize animation when
|
||||||
// frameless.
|
// frameless.
|
||||||
|
@ -851,23 +853,35 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
|
||||||
NotifyWindowMinimize();
|
NotifyWindowMinimize();
|
||||||
break;
|
break;
|
||||||
case SIZE_RESTORED:
|
case SIZE_RESTORED:
|
||||||
if (last_window_state_ == ui::SHOW_STATE_NORMAL)
|
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
|
||||||
return;
|
// Window was resized so we save it's new size.
|
||||||
|
last_normal_size_ = GetSize();
|
||||||
switch (last_window_state_) {
|
} else {
|
||||||
case ui::SHOW_STATE_MAXIMIZED:
|
switch (last_window_state_) {
|
||||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
case ui::SHOW_STATE_MAXIMIZED:
|
||||||
NotifyWindowUnmaximize();
|
|
||||||
break;
|
|
||||||
case ui::SHOW_STATE_MINIMIZED:
|
|
||||||
if (IsFullscreen()) {
|
|
||||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
|
||||||
NotifyWindowEnterFullScreen();
|
|
||||||
} else {
|
|
||||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||||
NotifyWindowRestore();
|
|
||||||
}
|
// When the window is restored we resize it to the previous known
|
||||||
break;
|
// normal size.
|
||||||
|
NativeWindow::SetSize(last_normal_size_);
|
||||||
|
|
||||||
|
NotifyWindowUnmaximize();
|
||||||
|
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.
|
||||||
|
NativeWindow::SetSize(last_normal_size_);
|
||||||
|
|
||||||
|
NotifyWindowRestore();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,6 +176,12 @@ class NativeWindowViews : public NativeWindow,
|
||||||
|
|
||||||
ui::WindowShowState last_window_state_;
|
ui::WindowShowState last_window_state_;
|
||||||
|
|
||||||
|
// There's an issue with restore on Windows, that sometimes causes the Window
|
||||||
|
// to receive the wrong size (#2498). To circumvent that, we keep tabs on the
|
||||||
|
// size of the window while in the normal state (not maximized, minimized or
|
||||||
|
// fullscreen), so we restore it correctly.
|
||||||
|
gfx::Size last_normal_size_;
|
||||||
|
|
||||||
// In charge of running taskbar related APIs.
|
// In charge of running taskbar related APIs.
|
||||||
TaskbarHost taskbar_host_;
|
TaskbarHost taskbar_host_;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue