From ddc6727b0fbcfb9b6c3a9aea4f097a86c202d396 Mon Sep 17 00:00:00 2001
From: David Gow <[EMAIL REDACTED]>
Date: Fri, 13 Aug 2021 15:14:59 +0800
Subject: [PATCH] Do not generate VIDEORESIZE events on SIZE_CHANGED
The recommended way to handle VIDEORESIZE is with a new
SDL_SetVideoMode() call, and creating a new window generates a
SIZE_CHANGED event, which leads to an infinite loop. The other main case
for SIZE_CHANGED events is when the screen resolution is changed out
from underneath a fullscreen window, and we handle that with the logical
scaling.
So it doesn't appear that there's any use for SIZE_CHANGED events in SDL
1.2 applications. So let's just ignore them. This fixes Drawf Fortress
in bug #127.
---
src/SDL12_compat.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 9b54754..5299567 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -2991,8 +2991,11 @@ EventFilter20to12(void *data, SDL_Event *event20)
break;
case SDL_WINDOWEVENT_RESIZED:
- case SDL_WINDOWEVENT_SIZE_CHANGED:
- FIXME("what's the difference between RESIZED and SIZE_CHANGED?");
+ /* don't generate a VIDEORESIZE event based on SIZE_CHANGED
+ events: the recommended way to handle VIDEORESIZE is
+ with a new SDL_SetVideoMode() call, and creating a new
+ window generates a SIZE_CHANGED event, which leads to an
+ infinite loop. */
/* don't report VIDEORESIZE if we're fullscreen-desktop;
we're doing logical scaling and as far as the app is