1
0
Fork 0

Update minimum window size

It's necessary for usecase when game changes resolution while in game.
We don't want to resize the window in such case, just change minimum
size (SDL might decide to update the window size in the result, if new
resolution is higher than current window size).
This commit is contained in:
Patryk Obara 2020-04-12 01:16:14 +02:00 committed by Patryk Obara
parent 7a98ff787f
commit 2ab250d1a1

View file

@ -632,10 +632,6 @@ static SDL_Window *SetWindowMode(SCREEN_TYPES screen_type,
if (resizable) {
SDL_AddEventWatch(watch_sdl_events, sdl.window);
SDL_SetWindowResizable(sdl.window, SDL_TRUE);
const int w = iround(sdl.draw.width * sdl.draw.scalex);
const int h = iround(sdl.draw.height * sdl.draw.scaley);
SDL_SetWindowMinimumSize(sdl.window, w, h);
sdl.desktop.window.resizable = true;
} else {
sdl.desktop.window.resizable = false;
@ -678,6 +674,13 @@ static SDL_Window *SetWindowMode(SCREEN_TYPES screen_type,
}
// Maybe some requested fullscreen resolution is unsupported?
finish:
if (sdl.desktop.window.resizable && !sdl.desktop.switching_fullscreen) {
const int w = iround(sdl.draw.width * sdl.draw.scalex);
const int h = iround(sdl.draw.height * sdl.draw.scaley);
SDL_SetWindowMinimumSize(sdl.window, w, h);
}
HandleVideoResize(width, height);
sdl.update_display_contents = true;
return sdl.window;