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
This commit is contained in:
parent
08805610c8
commit
5219b1ea57
1 changed files with 15 additions and 8 deletions
|
@ -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
|
// 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
|
// basically worthless. So we'll just try to keep things closeish to the
|
||||||
// maximum for now.
|
// maximum for now.
|
||||||
SDL_DisplayMode displayMode;
|
Common::Rect desktopRes = getDesktopResolution();
|
||||||
SDL_GetDesktopDisplayMode(0, &displayMode);
|
|
||||||
if (!fullscreenFlags) {
|
if (!fullscreenFlags) {
|
||||||
displayMode.w -= 20;
|
int top, left, bottom, right;
|
||||||
displayMode.h -= 30;
|
#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) {
|
if (width > desktopRes.right) {
|
||||||
width = displayMode.w;
|
width = desktopRes.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > displayMode.h) {
|
if (height > desktopRes.bottom) {
|
||||||
height = displayMode.h;
|
height = desktopRes.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_window || oldNonUpdateableFlags != newNonUpdateableFlags) {
|
if (!_window || oldNonUpdateableFlags != newNonUpdateableFlags) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue