SDL: wayland: Avoid duplicate resize events when entering fullscreen

From 780b031b1b453bcd9d635d0bb51e938b5109ac43 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Fri, 12 Aug 2022 16:39:39 -0500
Subject: [PATCH] wayland: Avoid duplicate resize events when entering
 fullscreen

---
 src/video/wayland/SDL_waylandwindow.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index a94063d9362..f5fe5e6f584 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -631,14 +631,12 @@ handle_configure_xdg_toplevel(void *data,
          * UPDATE: Nope, sure enough a compositor sends 0,0. This is a known bug:
          * https://bugs.kde.org/show_bug.cgi?id=444962
          */
-        if (!FullscreenModeEmulation(window)) {
-            if (width != 0 && height != 0 && (window->w != width || window->h != height)) {
-                window->w = width;
-                window->h = height;
-                wind->needs_resize_event = SDL_TRUE;
-            }
-        } else {
-            GetFullScreenDimensions(window, &window->w, &window->h, NULL, NULL);
+        if (FullscreenModeEmulation(window)) {
+            GetFullScreenDimensions(window, &width, &height, NULL, NULL);
+        }
+        if (width != 0 && height != 0 && (window->w != width || window->h != height)) {
+            window->w = width;
+            window->h = height;
             wind->needs_resize_event = SDL_TRUE;
         }
 
@@ -834,8 +832,6 @@ decoration_frame_configure(struct libdecor_frame *frame,
             GetFullScreenDimensions(window, &width, &height, NULL, NULL);
         }
 
-        wind->needs_resize_event = SDL_TRUE;
-
         /* This part is good though. */
         if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
             scale_factor = driverdata->scale_factor;