Merge pull request #7765 from liusy182/maximize-fix

fix for Window hidden behind taskbar after maximize #7672
This commit is contained in:
Kevin Sawicki 2017-01-09 09:47:39 -08:00 committed by GitHub
commit e5aad9857d

View file

@ -426,7 +426,7 @@ bool NativeWindowViews::IsEnabled() {
void NativeWindowViews::Maximize() { void NativeWindowViews::Maximize() {
#if defined(OS_WIN) #if defined(OS_WIN)
// For window without WS_THICKFRAME style, we can not call Maximize(). // For window without WS_THICKFRAME style, we can not call Maximize().
if (!thick_frame_) { if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
restore_bounds_ = GetBounds(); restore_bounds_ = GetBounds();
auto display = auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition()); display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
@ -444,7 +444,7 @@ void NativeWindowViews::Maximize() {
void NativeWindowViews::Unmaximize() { void NativeWindowViews::Unmaximize() {
#if defined(OS_WIN) #if defined(OS_WIN)
if (!thick_frame_) { if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
SetBounds(restore_bounds_, false); SetBounds(restore_bounds_, false);
return; return;
} }
@ -487,19 +487,6 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
NotifyWindowLeaveFullScreen(); NotifyWindowLeaveFullScreen();
} }
// For window without WS_THICKFRAME style, we can not call SetFullscreen().
if (!thick_frame_) {
if (fullscreen) {
restore_bounds_ = GetBounds();
auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
SetBounds(display.bounds(), false);
} else {
SetBounds(restore_bounds_, false);
}
return;
}
// We set the new value after notifying, so we can handle the size event // We set the new value after notifying, so we can handle the size event
// correctly. // correctly.
window_->SetFullscreen(fullscreen); window_->SetFullscreen(fullscreen);
@ -572,7 +559,7 @@ void NativeWindowViews::SetContentSizeConstraints(
void NativeWindowViews::SetResizable(bool resizable) { void NativeWindowViews::SetResizable(bool resizable) {
#if defined(OS_WIN) #if defined(OS_WIN)
if (thick_frame_) if (has_frame())
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME);
#elif defined(USE_X11) #elif defined(USE_X11)
if (resizable != resizable_) { if (resizable != resizable_) {
@ -595,11 +582,10 @@ void NativeWindowViews::SetResizable(bool resizable) {
bool NativeWindowViews::IsResizable() { bool NativeWindowViews::IsResizable() {
#if defined(OS_WIN) #if defined(OS_WIN)
if (thick_frame_) { if (has_frame())
return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME; return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME;
} else { else
return CanResize(); return CanResize();
}
#else #else
return CanResize(); return CanResize();
#endif #endif