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.
main
Frank Praznik 2023-03-26 12:45:52 -04:00
parent 8c852f4dcf
commit 5a0095d373
1 changed files with 2 additions and 2 deletions

View File

@ -3229,8 +3229,8 @@ void SDL_OnWindowDisplayChanged(SDL_Window *window)
SDL_DisplayID displayID = SDL_GetDisplayForWindowPosition(window); SDL_DisplayID displayID = SDL_GetDisplayForWindowPosition(window);
const SDL_DisplayMode *new_mode = NULL; const SDL_DisplayMode *new_mode = NULL;
if (window->current_fullscreen_mode.pixel_w != 0 || window->current_fullscreen_mode.pixel_h != 0) { if (window->requested_fullscreen_mode.pixel_w != 0 || window->requested_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); 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) { if (new_mode) {