From c61414e11bbb2e879017add67d12bd2654949851 Mon Sep 17 00:00:00 2001 From: liusi Date: Thu, 27 Oct 2016 17:14:31 +0800 Subject: [PATCH 1/7] fix for Window hidden behind taskbar after maximize #7672 --- atom/browser/native_window_views.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index d2f2077151e..8575d53abdb 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -572,8 +572,10 @@ void NativeWindowViews::SetContentSizeConstraints( void NativeWindowViews::SetResizable(bool resizable) { #if defined(OS_WIN) - if (thick_frame_) + if (thick_frame_) { FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); + thick_frame_ = !thick_frame_; + } #elif defined(USE_X11) if (resizable != resizable_) { // On Linux there is no "resizable" property of a window, we have to set From c657186920b07b382acb69d2dd53c67211634275 Mon Sep 17 00:00:00 2001 From: liusy182 Date: Sun, 30 Oct 2016 09:50:22 +0800 Subject: [PATCH 2/7] address review comments --- atom/browser/native_window_views.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 8575d53abdb..67069c08351 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -574,7 +574,7 @@ void NativeWindowViews::SetResizable(bool resizable) { #if defined(OS_WIN) if (thick_frame_) { FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); - thick_frame_ = !thick_frame_; + thick_frame_ = false; } #elif defined(USE_X11) if (resizable != resizable_) { From 0e9d973715fff77998bc5d0770e638fe7bb92dcf Mon Sep 17 00:00:00 2001 From: liusi Date: Thu, 3 Nov 2016 12:13:06 +0800 Subject: [PATCH 3/7] toggle thick_frame_ along with resizable change --- atom/browser/native_window_views.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 0ba974ad27d..c41d8bb9468 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -571,10 +571,8 @@ void NativeWindowViews::SetContentSizeConstraints( void NativeWindowViews::SetResizable(bool resizable) { #if defined(OS_WIN) - if (thick_frame_) { - FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); - thick_frame_ = false; - } + FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); + thick_frame_ = resizable; #elif defined(USE_X11) if (resizable != resizable_) { // On Linux there is no "resizable" property of a window, we have to set From a69ee76705fe2b0e036dcced62b8b84432a3bb2e Mon Sep 17 00:00:00 2001 From: liusi Date: Tue, 8 Nov 2016 15:36:37 +0800 Subject: [PATCH 4/7] fix review comments --- atom/browser/native_window_views.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index c41d8bb9468..7475fdefc09 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -571,8 +571,9 @@ void NativeWindowViews::SetContentSizeConstraints( void NativeWindowViews::SetResizable(bool resizable) { #if defined(OS_WIN) - FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); - thick_frame_ = resizable; + if(has_frame()) { + FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); + } #elif defined(USE_X11) if (resizable != resizable_) { // On Linux there is no "resizable" property of a window, we have to set @@ -594,7 +595,7 @@ void NativeWindowViews::SetResizable(bool resizable) { bool NativeWindowViews::IsResizable() { #if defined(OS_WIN) - if (thick_frame_) { + if (has_frame()) { return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME; } else { return CanResize(); From 356d0520ae4476cec147f9ee54e04a6764fe062f Mon Sep 17 00:00:00 2001 From: liusi Date: Fri, 11 Nov 2016 17:57:22 +0800 Subject: [PATCH 5/7] fix linting error --- atom/browser/native_window_views.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 7475fdefc09..898812c9755 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -571,7 +571,7 @@ void NativeWindowViews::SetContentSizeConstraints( void NativeWindowViews::SetResizable(bool resizable) { #if defined(OS_WIN) - if(has_frame()) { + if (has_frame()) { FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); } #elif defined(USE_X11) From 00d9baa605bc57bc180aee23236daa5e876c38d9 Mon Sep 17 00:00:00 2001 From: liusi Date: Tue, 15 Nov 2016 13:23:59 +0800 Subject: [PATCH 6/7] fix linting error --- atom/browser/native_window_views.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 898812c9755..620fb7e797b 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -571,9 +571,8 @@ void NativeWindowViews::SetContentSizeConstraints( void NativeWindowViews::SetResizable(bool resizable) { #if defined(OS_WIN) - if (has_frame()) { + if (has_frame()) FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); - } #elif defined(USE_X11) if (resizable != resizable_) { // On Linux there is no "resizable" property of a window, we have to set @@ -595,11 +594,10 @@ void NativeWindowViews::SetResizable(bool resizable) { bool NativeWindowViews::IsResizable() { #if defined(OS_WIN) - if (has_frame()) { + if (has_frame()) return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME; - } else { + else return CanResize(); - } #else return CanResize(); #endif From b85367113260145c1620984e555c3dbe9cde0b95 Mon Sep 17 00:00:00 2001 From: liusi Date: Thu, 15 Dec 2016 14:01:03 +0800 Subject: [PATCH 7/7] fix fullscreen, maximize, unmaximize --- atom/browser/native_window_views.cc | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 620fb7e797b..3cdf802b9aa 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -425,7 +425,7 @@ bool NativeWindowViews::IsEnabled() { void NativeWindowViews::Maximize() { #if defined(OS_WIN) // For window without WS_THICKFRAME style, we can not call Maximize(). - if (!thick_frame_) { + if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) { restore_bounds_ = GetBounds(); auto display = display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition()); @@ -443,7 +443,7 @@ void NativeWindowViews::Maximize() { void NativeWindowViews::Unmaximize() { #if defined(OS_WIN) - if (!thick_frame_) { + if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) { SetBounds(restore_bounds_, false); return; } @@ -486,19 +486,6 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) { 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 // correctly. window_->SetFullscreen(fullscreen);