sdl12-compat: Don't report window resize events for fullscreen-desktop windows.

From 5e80b2924590040cf2c1805be8942cc2bfb2b172 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 30 Apr 2021 16:47:15 -0400
Subject: [PATCH] Don't report window resize events for fullscreen-desktop
 windows.

The app doesn't know we're doing logical scaling, so it thinks the window
size never changes, so just drop these events.

Fixes #45.
---
 src/SDL12_compat.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 14ed9d6..140c1fa 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -2275,6 +2275,20 @@ EventFilter20to12(void *data, SDL_Event *event20)
                 case SDL_WINDOWEVENT_RESIZED:
                 case SDL_WINDOWEVENT_SIZE_CHANGED:
                     FIXME("what's the difference between RESIZED and SIZE_CHANGED?");
+
+                    /* don't report VIDEORESIZE if we're fullscreen-desktop;
+                       we're doing logical scaling and as far as the app is
+                       concerned the window doesn't change. */
+                    if (!VideoWindow20) {
+                        FIXME("we should probably drop a lot of these events.");
+                        break;  /* there's no window? Drop this event. */
+                    } else {
+                        const Uint32 flags = SDL20_GetWindowFlags(VideoWindow20);
+                        if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
+                            break;
+                        }
+                    }
+
                     event12.type = SDL12_VIDEORESIZE;
                     event12.resize.w = event20->window.data1;
                     event12.resize.h = event20->window.data2;