[Scummvm-git-logs] scummvm master -> 5219b1ea57c32f16d4d9dac4ceb8a6246376e23a
SupSuper
supsuper at gmail.com
Thu Apr 29 04:27:14 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5219b1ea57 SDL: Get the window decoration size from the backend
Commit: 5219b1ea57c32f16d4d9dac4ceb8a6246376e23a
https://github.com/scummvm/scummvm/commit/5219b1ea57c32f16d4d9dac4ceb8a6246376e23a
Author: SupSuper (supsuper at gmail.com)
Date: 2021-04-29T04:44:55+01:00
Commit Message:
SDL: Get the window decoration size from the backend
It's been 5 years since SDL 2.0.5, I think it's safe to use
Changed paths:
backends/platform/sdl/sdl-window.cpp
diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index 1799948513..2ec160ddb4 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -296,19 +296,26 @@ bool SdlWindow::createOrUpdateWindow(int width, int height, uint32 flags) {
// the documentation says it only works on X11 anyway, which means it is
// basically worthless. So we'll just try to keep things closeish to the
// maximum for now.
- SDL_DisplayMode displayMode;
- SDL_GetDesktopDisplayMode(0, &displayMode);
+ Common::Rect desktopRes = getDesktopResolution();
if (!fullscreenFlags) {
- displayMode.w -= 20;
- displayMode.h -= 30;
+ int top, left, bottom, right;
+#if SDL_VERSION_ATLEAST(2, 0, 5)
+ if (!_window || SDL_GetWindowBordersSize(_window, &top, &left, &bottom, &right) < 0)
+#endif
+ {
+ left = right = 10;
+ top = bottom = 15;
+ }
+ desktopRes.right -= (left + right);
+ desktopRes.bottom -= (top + bottom);
}
- if (width > displayMode.w) {
- width = displayMode.w;
+ if (width > desktopRes.right) {
+ width = desktopRes.right;
}
- if (height > displayMode.h) {
- height = displayMode.h;
+ if (height > desktopRes.bottom) {
+ height = desktopRes.bottom;
}
if (!_window || oldNonUpdateableFlags != newNonUpdateableFlags) {
More information about the Scummvm-git-logs
mailing list