From 3ce906b25d4cce49d7600c8005a00705f8704d7d Mon Sep 17 00:00:00 2001 From: jacob1 Date: Mon, 28 May 2018 13:55:49 -0400 Subject: [PATCH] even better desktop size detection, now accounts for taskbars / panels --- src/PowderToySDL.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index 8f01740e30..c91dc8cdea 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -164,10 +164,12 @@ int SDLOpen() int displayIndex = SDL_GetWindowDisplayIndex(sdl_window); if (displayIndex >= 0) { - SDL_DisplayMode SDLDisplayMode; - SDL_GetCurrentDisplayMode(0, &SDLDisplayMode); - desktopWidth = SDLDisplayMode.w; - desktopHeight = SDLDisplayMode.h; + SDL_Rect rect; + if (!SDL_GetDisplayUsableBounds(displayIndex, &rect)) + { + desktopWidth = rect.w; + desktopHeight = rect.h; + } } #ifdef WIN @@ -602,7 +604,7 @@ int main(int argc, char * argv[]) SDLOpen(); // TODO: mabe make a nice loop that automagically finds the optimal scale - if (Client::Ref().IsFirstRun() && desktopWidth > WINDOWW*2+50 && desktopHeight > WINDOWH*2+50) + if (Client::Ref().IsFirstRun() && desktopWidth > WINDOWW*2+30 && desktopHeight > WINDOWH*2+30) { scale = 2; Client::Ref().SetPref("Scale", 2);