From 5a0095d373e4851a8375df3d4fb5b4002873913a Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sun, 26 Mar 2023 12:45:52 -0400
Subject: [PATCH] video: Try to match the requested video mode when moving
fullscreen windows
Try to match the requested video mode when a fullscreen window is moved to a new display, or it may not be returned to the requested mode if it is moved to a display with no matching mode, then back to the original display.
---
src/video/SDL_video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 5b969281e75c..dd3bcdeefb1d 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -3229,8 +3229,8 @@ void SDL_OnWindowDisplayChanged(SDL_Window *window)
SDL_DisplayID displayID = SDL_GetDisplayForWindowPosition(window);
const SDL_DisplayMode *new_mode = NULL;
- if (window->current_fullscreen_mode.pixel_w != 0 || window->current_fullscreen_mode.pixel_h != 0) {
- new_mode = SDL_GetClosestFullscreenDisplayMode(displayID, window->current_fullscreen_mode.pixel_w, window->current_fullscreen_mode.pixel_h, window->current_fullscreen_mode.refresh_rate);
+ if (window->requested_fullscreen_mode.pixel_w != 0 || window->requested_fullscreen_mode.pixel_h != 0) {
+ new_mode = SDL_GetClosestFullscreenDisplayMode(displayID, window->requested_fullscreen_mode.pixel_w, window->requested_fullscreen_mode.pixel_h, window->requested_fullscreen_mode.refresh_rate);
}
if (new_mode) {