foxygit / doom Log in
commit a0b556eb8293d3157b6206a8dfd9d845952a0f65
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Fri May 19 08:29:59 2017 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Fri May 19 08:29:59 2017 +0200

    video: update scaled texture also when switching fullscreen

    This was a logical twist in the previous commit.
---
 src/i_video.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 163b0522..ab31229a 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -320,7 +320,7 @@ static void AdjustWindowSize(void)

 static void HandleWindowEvent(SDL_WindowEvent *event)
 {
-    int i, flags;
+    int i;

     switch (event->event)
     {
@@ -336,15 +336,7 @@ static void HandleWindowEvent(SDL_WindowEvent *event)

         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 @@ void I_FinishUpdate (void)

     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;