From 2e1bc743734cc1e1043c8f2c9497a5a172507bc9 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 1 Dec 2015 19:33:38 +0000 Subject: [PATCH] hw/xwin: Set convenience variables for WM_CREATE as well Set convenience variables in winTopLevelWindowProc() for WM_CREATE as well. --- hw/xwin/winmultiwindowwndproc.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 1cac4a9f4..48e9f9dd8 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -322,6 +322,20 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) lParam); #endif + /* + If this is WM_CREATE, set up the Windows window properties which point to + X window information, before we populate local convenience variables... + */ + if (message == WM_CREATE) { + SetProp(hwnd, + WIN_WINDOW_PROP, + (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams); + SetProp(hwnd, + WIN_WID_PROP, + (HANDLE) (INT_PTR)winGetWindowID(((LPCREATESTRUCT) lParam)-> + lpCreateParams)); + } + /* Check if the Windows window property for our X window pointer is valid */ if ((pWin = GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) { /* Our X window pointer is valid */ @@ -382,18 +396,6 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Branch on message type */ switch (message) { case WM_CREATE: - - /* */ - SetProp(hwnd, - WIN_WINDOW_PROP, - (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams); - - /* */ - SetProp(hwnd, - WIN_WID_PROP, - (HANDLE) (INT_PTR) winGetWindowID(((LPCREATESTRUCT) lParam)-> - lpCreateParams)); - /* * Make X windows' Z orders sync with Windows windows because * there can be AlwaysOnTop windows overlapped on the window