diff --git a/CHANGES.md b/CHANGES.md index 9304396eb7..c7eb951003 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -43,6 +43,7 @@ - WINDOWS/XINPUT: Fix crash that occurs in some situations with Steam running and a Steam Controller plugged in. - WINDOWS: Improve version reporting under System Information. - WINDOWS: Support window transparency. +- WINDOWS: Correct usage of GetWindowPlacement per MS docs, fixes game window position on Win95/98. # 1.6.9 - COMMON: Small memory leak. diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 766838e671..b4d13a401b 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -86,8 +86,8 @@ bool g_restore_desktop = false; static bool doubleclick_on_titlebar = false; bool g_inited = false; static bool g_quit = false; -static unsigned g_pos_x = CW_USEDEFAULT; -static unsigned g_pos_y = CW_USEDEFAULT; +static int g_pos_x = CW_USEDEFAULT; +static int g_pos_y = CW_USEDEFAULT; static void *curD3D = NULL; ui_window_win32_t main_window; @@ -513,7 +513,11 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, case WM_QUIT: { WINDOWPLACEMENT placement; + memset(&placement, 0, sizeof(placement)); + placement.length = sizeof(placement); + GetWindowPlacement(main_window.hwnd, &placement); + g_pos_x = placement.rcNormalPosition.left; g_pos_y = placement.rcNormalPosition.top; g_quit = true;