From fc5f363ff745bab3b114b73760f4656041f0e950 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Thu, 26 Jan 2023 22:07:34 -0500
Subject: [PATCH] video: Send the new fullscreen size in screen coordinates
After successfully entering fullscreen, send the new fullscreen window dimensions in screen coordinates, not pixels, to avoid a unit mismatch.
---
src/video/SDL_video.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 01aa23629e84..9b8f2f9311b4 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1499,11 +1499,13 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
*/
/* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos,
- * WM_WINDOWPOSCHANGED will send SDL_EVENT_WINDOW_RESIZED). Also, on Windows with DPI scaling enabled,
- * we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch.
+ * WM_WINDOWPOSCHANGED will send SDL_EVENT_WINDOW_RESIZED).
*/
+
+ /* The new fullscreen window size must be sent in screen coordinates, not pixels. */
SDL_SendWindowEvent(other, SDL_EVENT_WINDOW_RESIZED,
- fullscreen_mode.w, fullscreen_mode.h);
+ (int)(fullscreen_mode.w / fullscreen_mode.display_scale),
+ (int)(fullscreen_mode.h / fullscreen_mode.display_scale));
#endif
} else {
SDL_OnWindowResized(other);