Skip to content

Commit

Permalink
Workaround maximized+fullscreen on Windows
Browse files Browse the repository at this point in the history
On Windows, in maximized+fullscreen state, disabling fullscreen mode
unexpectedly triggers the "restored" then "maximized" events, leaving
the window in a weird state (maximized according to the events, but not
maximized visually).

Moreover, apply_pending_resize() asserts that fullscreen is disabled.

To avoid the issue, if fullscreen is set, just ignore the "restored"
event.
  • Loading branch information
rom1v committed May 12, 2020
1 parent 6dc113e commit b19d708
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,13 @@ screen_handle_window_event(struct screen *screen,
screen->maximized = true;
break;
case SDL_WINDOWEVENT_RESTORED:
if (screen->fullscreen) {
// On Windows, in maximized+fullscreen, disabling fullscreen
// mode unexpectedly triggers the "restored" then "maximized"
// events, leaving the window in a weird state (maximized
// according to the events, but not maximized visually).
break;
}
screen->maximized = false;
apply_pending_resize(screen);
break;
Expand Down

0 comments on commit b19d708

Please sign in to comment.