From 324602fe2600814044283659a8cc54178e755395 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 26 May 2018 17:38:01 -0400 Subject: [PATCH] adjust for window border when loading window position too fixes window moving up every time on windows, on linux the border size gets reported as 0 so nothing changes there --- src/PowderToySDL.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index a0031bfaf..dbd664455 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -84,7 +84,11 @@ void LoadWindowPosition() { int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX); int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX); - SDL_SetWindowPosition(sdl_window, savedWindowX, savedWindowY); + + int borderTop, borderLeft; + SDL_GetWindowBordersSize(sdl_window, &borderTop, &borderLeft, nullptr, nullptr); + + SDL_SetWindowPosition(sdl_window, savedWindowX + borderLeft, savedWindowY + borderTop); } void SaveWindowPosition()