summaryrefslogtreecommitdiff
path: root/hw/xwin/winmultiwindowwndproc.c
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2015-12-01 19:33:38 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2016-01-12 16:22:11 +0000
commit2570658b09a6020b9eea773040ea75944ad4aa39 (patch)
treee9ee422a092d662bd1d5256644c37c0213612abb /hw/xwin/winmultiwindowwndproc.c
parent8fe89267919368369c2c311857efb005cac1d6d9 (diff)
Re-order window creation process
Be a bit more careful to do things in the right order and set the style flags and window state before we show the window. This is probably the right thing to do in any case as it means we can avoid the messy appearance of the window changing style just after it is first shown This is achieved by having WM_CREATE send a WM_WM_CREATE message to our window manager thread, which then does all the work of discovering the windows style. Note that this subtly changes the semantics of winCreateWindowsWindow(): previously the window was visible and drawn before that function returned, now that happens asychronously; I'm not sure if that could cause problems or not...
Diffstat (limited to 'hw/xwin/winmultiwindowwndproc.c')
-rw-r--r--hw/xwin/winmultiwindowwndproc.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 6f3291175..c8a1f5285 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -348,6 +348,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 other local 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 */
@@ -408,18 +422,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
@@ -440,6 +442,11 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) XMING_SIGNATURE);
+ /* Tell our Window Manager thread to style and then show the window */
+ wmMsg.msg = WM_WM_CREATE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
+
return 0;
case WM_INIT_SYS_MENU: