From 4c09b357a758c7186d0dcc50bfa0d5a363d058be Mon Sep 17 00:00:00 2001 From: dharders Date: Thu, 1 Jun 2017 14:38:51 +1000 Subject: [PATCH] :checkered_flag: Fix #6036. Ensure window is visible after fullscreen toggle --- atom/browser/native_window_views.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 242f112128..afa1dcceb6 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -480,6 +480,8 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) { #if defined(OS_WIN) // There is no native fullscreen state on Windows. + bool fullscreen_to_normal_detected = IsFullscreen() && !fullscreen; + if (fullscreen) { last_window_state_ = ui::SHOW_STATE_FULLSCREEN; NotifyWindowEnterFullScreen(); @@ -505,6 +507,16 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) { // We set the new value after notifying, so we can handle the size event // correctly. window_->SetFullscreen(fullscreen); + + // If restoring from fullscreen and the window isn't visible, force visible, + // else a non-responsive window shell could be rendered. + // (this situation may arise when app starts with fullscreen: true) + // Note: the following must be after "window_->SetFullscreen(fullscreen);" + if (fullscreen_to_normal_detected && !IsVisible()) { + LONG frame_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE); + frame_style |= WS_VISIBLE; + ::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, frame_style); + } #else if (IsVisible()) window_->SetFullscreen(fullscreen);