[PATCH 7/14] user32: Send the WM_NCCREATE message from user32's CreateWindow

Pierre d'Herbemont pdherbemont at free.fr
Sun Jan 21 17:36:03 CST 2007


---
   dlls/user32/win.c         |   14 ++++++++++++++
   dlls/winex11.drv/window.c |   22 ++++++++++------------
   2 files changed, 24 insertions(+), 12 deletions(-)

-------------- next part --------------
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 043f00c..8e99bc1 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -868,6 +868,7 @@ static HWND WIN_CreateWindowEx( CREATEST
     CBT_CREATEWNDA cbtc;
     CREATESTRUCTA cbcs;
     RECT rect;
+    BOOL ret = FALSE;
 
     TRACE("%s %s ex=%08x style=%08x %d,%d %dx%d parent=%p menu=%p inst=%p params=%p\n",
           unicode ? debugstr_w((LPCWSTR)cs->lpszName) : debugstr_a(cs->lpszName),
@@ -1138,6 +1139,19 @@ static HWND WIN_CreateWindowEx( CREATEST
         if (!USER_Driver->pSetWindowPos( hwnd, 0, &rect, &rect, SWP_NOZORDER, NULL )) return FALSE;
     }
 
+    /* send WM_NCCREATE */
+    TRACE( "hwnd %p cs %d,%d %dx%d\n", hwnd, cs->x, cs->y, cs->cx, cs->cy );
+    if (unicode)
+        ret = SendMessageW( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
+    else
+        ret = SendMessageA( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
+    if (!ret)
+    {
+        WARN("aborted by WM_xxCREATE!\n");
+        WIN_DestroyWindow( hwnd );
+        return 0;
+    }
+
     if (!USER_Driver->pCreateWindow( hwnd, cs, unicode))
     {
         WIN_DestroyWindow( hwnd );
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 53e3c7f..493983b 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1009,6 +1009,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CRE
     struct x11drv_win_data *data;
     HWND insert_after;
     RECT rect;
+    LPWSTR text;
     DWORD style;
     BOOL ret = FALSE;
 
@@ -1031,18 +1032,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CRE
     /* get class or window DC if needed */
     alloc_window_dce( data );
 
-    /* send WM_NCCREATE */
-    TRACE( "hwnd %p cs %d,%d %dx%d\n", hwnd, cs->x, cs->y, cs->cx, cs->cy );
-    if (unicode)
-        ret = SendMessageW( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
-    else
-        ret = SendMessageA( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
-    if (!ret)
-    {
-        WARN("aborted by WM_xxCREATE!\n");
-        return FALSE;
-    }
-
     /* make sure the window is still valid */
     if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
     if (data->whole_window) X11DRV_sync_window_style( display, data );
@@ -1097,6 +1086,15 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CRE
     }
     else WIN_ReleasePtr( wndPtr );
 
+    /* Make sure we've updated the window title if SetWindowText was called
+       before alloc_win_data */
+    if (!(wndPtr = WIN_GetPtr(hwnd)) || wndPtr == WND_OTHER_PROCESS) return FALSE;
+    text = wndPtr->text;
+    WIN_ReleasePtr( wndPtr );
+
+    if(text)
+        X11DRV_SetWindowText(hwnd, text);
+
     /* Show the window, maximizing or minimizing if needed */
 
     style = GetWindowLongW( hwnd, GWL_STYLE );


More information about the wine-patches mailing list