win32: correct usage of GetWindowPlacement per MS docs, fixes game window position on Win95/98

This commit is contained in:
Brad Parker 2017-12-24 17:17:36 -05:00
parent 6664f8a772
commit 89bd38918e
2 changed files with 7 additions and 2 deletions

View File

@ -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.

View File

@ -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;