[Scummvm-git-logs] scummvm master -> 2a410768ade88ffb24c798585f173d40654c9bc6
criezy
criezy at scummvm.org
Fri Jul 16 12:22:03 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c1a2d5ba1b OPENGLSDL: Remove getting the supported screen resolutions for SDL2
2a410768ad OPENGLSDL: Fix increasing/decreasing the window size on macOS
Commit: c1a2d5ba1bb8c177c2250949ca354fdb0ff04645
https://github.com/scummvm/scummvm/commit/c1a2d5ba1bb8c177c2250949ca354fdb0ff04645
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-07-16T13:20:38+01:00
Commit Message:
OPENGLSDL: Remove getting the supported screen resolutions for SDL2
Since we use the SDL_WINDOW_FULLSCREEN_DESKTOP with SDL2, we always
use the desktop resolution in fullscreen mode anyway. Cycling
through other resolutions did nothing and was confusing.
Changed paths:
backends/graphics/openglsdl/openglsdl-graphics.cpp
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 6e902b7706..5a1facafb8 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -139,17 +139,12 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(SdlEventSource *eventSource,
#endif
// Retrieve a list of working fullscreen modes
+ Common::Rect desktopRes = _window->getDesktopResolution();
#if SDL_VERSION_ATLEAST(2, 0, 0)
- const int display = _window->getDisplayIndex();
- const int numModes = SDL_GetNumDisplayModes(display);
- for (int i = 0; i < numModes; ++i) {
- SDL_DisplayMode mode;
- if (SDL_GetDisplayMode(display, i, &mode)) {
- continue;
- }
-
- _fullscreenVideoModes.push_back(VideoMode(mode.w, mode.h));
- }
+ // With SDL2 we use the SDL_WINDOW_FULLSCREEN_DESKTOP flag.
+ // Thus SDL always use the desktop resolution and it is useless to try to use something else.
+ // Do nothing here as adding the desktop resolution to _fullscreenVideoModes is done as a fallback.
+ _fullscreenVideoModes.push_back(VideoMode(desktopRes.width(), desktopRes.height()));
#else
const SDL_Rect *const *availableModes = SDL_ListModes(NULL, SDL_OPENGL | SDL_FULLSCREEN);
// TODO: NULL means that there are no fullscreen modes supported. We
@@ -176,8 +171,6 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(SdlEventSource *eventSource,
}
}
- Common::Rect desktopRes = _window->getDesktopResolution();
-
// In case SDL is fine with every mode we will force the desktop mode.
// TODO? We could also try to add some default resolutions here.
if (_fullscreenVideoModes.empty() && !desktopRes.isEmpty()) {
@@ -603,8 +596,8 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
// In case we are in fullscreen we will choose the previous
// or next mode.
- // In case no modes are available we do nothing.
- if (_fullscreenVideoModes.empty()) {
+ // In case no modes are available or we only have one mode we do nothing.
+ if (_fullscreenVideoModes.size() < 2) {
return true;
}
Commit: 2a410768ade88ffb24c798585f173d40654c9bc6
https://github.com/scummvm/scummvm/commit/2a410768ade88ffb24c798585f173d40654c9bc6
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-07-16T13:20:38+01:00
Commit Message:
OPENGLSDL: Fix increasing/decreasing the window size on macOS
Changed paths:
backends/graphics/openglsdl/openglsdl-graphics.cpp
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 5a1facafb8..b99d5d266d 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -636,6 +636,13 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
// window. Then we apply the direction change.
int windowWidth = 0, windowHeight = 0;
getWindowSizeFromSdl(&windowWidth, &windowHeight);
+ // FIXME HACK. I don't like this at all, but macOS requires window size in LoDPI
+ #ifdef __APPLE__
+ uint scale;
+ getDpiScalingFactor(&scale);
+ windowWidth /= scale;
+ windowHeight /= scale;
+ #endif
_graphicsScale = MAX<int>(windowWidth / _lastRequestedWidth, windowHeight / _lastRequestedHeight);
_graphicsScale = MAX<int>(_graphicsScale + direction, 1);
More information about the Scummvm-git-logs
mailing list