mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
SDL: Use the current screen resolution when switching to fullscreen
Previously we used the resolution of the first screen. Fixes being unable to switch to fullscreen when using two screens with different resolutions.
This commit is contained in:
parent
99c7d96991
commit
93929be2c1
@ -72,6 +72,24 @@ Common::Rect ResVmSdlGraphicsManager::getPreferredFullscreenResolution() {
|
||||
uint preferredWidth = _capabilities.desktopWidth;
|
||||
uint preferredHeight = _capabilities.desktopHeight;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
// When using SDL2, we can query the desktop resolution for the screen our window sits in
|
||||
int displayIndex = -1;
|
||||
|
||||
SDL_Window *sdlWindow = _window->getSDLWindow();
|
||||
if (sdlWindow) {
|
||||
displayIndex = SDL_GetWindowDisplayIndex(sdlWindow);
|
||||
}
|
||||
|
||||
if (displayIndex >= 0) {
|
||||
SDL_DisplayMode displayMode;
|
||||
if (!SDL_GetDesktopDisplayMode(displayIndex, &displayMode)) {
|
||||
preferredWidth = displayMode.w;
|
||||
preferredHeight = displayMode.h;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ... unless the user has set a resolution in the configuration file
|
||||
const Common::String &fsres = ConfMan.get("fullscreen_res");
|
||||
if (fsres != "desktop") {
|
||||
|
Loading…
Reference in New Issue
Block a user