even better desktop size detection, now accounts for taskbars / panels

This commit is contained in:
jacob1
2018-05-28 13:55:49 -04:00
parent a40ab1e50d
commit 3ce906b25d

View File

@@ -164,10 +164,12 @@ int SDLOpen()
int displayIndex = SDL_GetWindowDisplayIndex(sdl_window); int displayIndex = SDL_GetWindowDisplayIndex(sdl_window);
if (displayIndex >= 0) if (displayIndex >= 0)
{ {
SDL_DisplayMode SDLDisplayMode; SDL_Rect rect;
SDL_GetCurrentDisplayMode(0, &SDLDisplayMode); if (!SDL_GetDisplayUsableBounds(displayIndex, &rect))
desktopWidth = SDLDisplayMode.w; {
desktopHeight = SDLDisplayMode.h; desktopWidth = rect.w;
desktopHeight = rect.h;
}
} }
#ifdef WIN #ifdef WIN
@@ -602,7 +604,7 @@ int main(int argc, char * argv[])
SDLOpen(); SDLOpen();
// TODO: mabe make a nice loop that automagically finds the optimal scale // 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; scale = 2;
Client::Ref().SetPref("Scale", 2); Client::Ref().SetPref("Scale", 2);