Skip to content

Commit

Permalink
even better desktop size detection, now accounts for taskbars / panels
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed May 28, 2018
1 parent a40ab1e commit 3ce906b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/PowderToySDL.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3ce906b

Please sign in to comment.