set window position before displaying it

This commit is contained in:
jacob1
2013-05-03 19:11:44 -04:00
parent 06111ce456
commit d4391cc19e

View File

@@ -546,17 +546,14 @@ int GetModifiers()
// Returns true if the loaded position was set
// Returns false if something went wrong: SDL_GetWMInfo failed or the loaded position was invalid
bool LoadWindowPosition()
bool LoadWindowPosition(int scale)
{
SDL_SysWMinfo sysInfo;
SDL_VERSION(&sysInfo.version);
if (SDL_GetWMInfo(&sysInfo) > 0)
{
RECT rcWindow;
GetWindowRect(sysInfo.window, &rcWindow);
int windowW = rcWindow.right - rcWindow.left - 1;
int windowH = rcWindow.bottom - rcWindow.top - 1;
int windowW = (XRES + BARSIZE) * scale;
int windowH = (YRES + MENUSIZE) * scale;
int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX);
int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX);
@@ -685,12 +682,10 @@ int main(int argc, char * argv[])
tempScale = 1;
int sdlStatus = SDLOpen();
sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
#ifdef WIN
// Must be after SDLSetScreen to account for scale
LoadWindowPosition();
LoadWindowPosition(tempScale);
#endif
sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
#ifdef OGLI
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);