shithub: choc

Download patch

ref: a0b556eb8293d3157b6206a8dfd9d845952a0f65
parent: 1c5c9b248a2080152ccf7f2f17f830b541987257
author: Fabian Greffrath <[email protected]>
date: Fri May 19 04:29:59 EDT 2017

video: update scaled texture also when switching fullscreen

This was a logical twist in the previous commit.

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -320,7 +320,7 @@
 
 static void HandleWindowEvent(SDL_WindowEvent *event)
 {
-    int i, flags;
+    int i;
 
     switch (event->event)
     {
@@ -336,15 +336,7 @@
 
         case SDL_WINDOWEVENT_RESIZED:
             need_resize = true;
-            // When the window is resized (we're not in fullscreen mode),
-            // save the new window size.
-            flags = SDL_GetWindowFlags(screen);
-            if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0)
-            {
-                SDL_GetWindowSize(screen, &window_width, &window_height);
-
-                last_resize_time = SDL_GetTicks();
-            }
+            last_resize_time = SDL_GetTicks();
             break;
 
         // Don't render the screen when the window is minimized:
@@ -719,11 +711,19 @@
 
     if (need_resize && SDL_GetTicks() > last_resize_time + 500)
     {
-        // Adjust the window by resizing again so that the window
-        // is the right aspect ratio.
-        AdjustWindowSize();
-        SDL_SetWindowSize(screen, window_width, window_height);
+        int flags;
+        // When the window is resized (we're not in fullscreen mode),
+        // save the new window size.
+        flags = SDL_GetWindowFlags(screen);
+        if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0)
+        {
+            SDL_GetWindowSize(screen, &window_width, &window_height);
 
+            // Adjust the window by resizing again so that the window
+            // is the right aspect ratio.
+            AdjustWindowSize();
+            SDL_SetWindowSize(screen, window_width, window_height);
+        }
         CreateUpscaledTexture(false);
         need_resize = false;
         palette_to_set = true;