diff --git a/Source/i_video.c b/Source/i_video.c index 7008a2d0..6d1a9ad0 100644 --- a/Source/i_video.c +++ b/Source/i_video.c @@ -56,6 +56,9 @@ SDL_Renderer *renderer; SDL_Surface *argbbuffer; SDL_Texture *texture; +// [FG] window size when returning from fullscreen mode +static int window_width, window_height; + ///////////////////////////////////////////////////////////////////////////// // // JOYSTICK // phares 4/3/98 @@ -468,6 +471,13 @@ static void HandleWindowEvent(SDL_WindowEvent *event) { switch (event->event) { + case SDL_WINDOWEVENT_RESIZED: + if (!fullscreen) + { + SDL_GetWindowSize(screen, &window_width, &window_height); + } + break; + // Don't render the screen when the window is minimized: case SDL_WINDOWEVENT_MINIMIZED: @@ -509,9 +519,6 @@ static boolean ToggleFullScreenKeyShortcut(SDL_Keysym *sym) return sym->scancode == SDL_SCANCODE_RETURN && (sym->mod & flags) != 0; } -// [FG] window size when returning from fullscreen mode -static int window_width, window_height; - static void I_ToggleFullScreen(void) { unsigned int flags = 0; @@ -951,8 +958,11 @@ static void I_InitGraphicsMode(void) SDL_SetWindowMinimumSize(screen, v_w, actualheight); // [FG] window size when returning from fullscreen mode - window_width = scalefactor * v_w; - window_height = scalefactor * actualheight; + if (!window_width || !window_height) + { + window_width = scalefactor * v_w; + window_height = scalefactor * actualheight; + } if (!(flags & SDL_WINDOW_FULLSCREEN_DESKTOP)) {