Merge pull request #9645 from dharders/issue6036-fix-windows-fullscreen-startup-toggle

Fix unresponsive app after fullscreen->normal state toggle (Windows)
This commit is contained in:
Kevin Sawicki 2017-06-14 14:10:00 -07:00 committed by GitHub
commit 45dc6fc04f
2 changed files with 44 additions and 0 deletions

View file

@ -480,6 +480,8 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
#if defined(OS_WIN)
// There is no native fullscreen state on Windows.
bool leaving_fullscreen = IsFullscreen() && !fullscreen;
if (fullscreen) {
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
NotifyWindowEnterFullScreen();
@ -505,6 +507,13 @@ 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 (leaving_fullscreen && !IsVisible())
FlipWindowStyle(GetAcceleratedWidget(), true, WS_VISIBLE);
#else
if (IsVisible())
window_->SetFullscreen(fullscreen);