Add a test case and a fix for the window styles state at the window creation time

Dmitry Timoshkov dmitry at baikal.ru
Fri Jan 30 10:08:19 CST 2004


Hello,

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Add a test case and a fix for the window styles state
    at the window creation time.

diff -u cvs/hq/wine/dlls/user/tests/win.c wine/dlls/user/tests/win.c
--- cvs/hq/wine/dlls/user/tests/win.c	2004-01-25 17:28:40.000000000 +0800
+++ wine/dlls/user/tests/win.c	2004-01-30 23:44:48.000000000 +0800
@@ -556,10 +556,17 @@ static LRESULT CALLBACK cbt_hook_proc(in
     {
 	case HCBT_CREATEWND:
 	{
+	    DWORD style;
 	    CBT_CREATEWNDA *createwnd = (CBT_CREATEWNDA *)lParam;
 	    trace("HCBT_CREATEWND: hwnd %p, parent %p, style %08lx\n",
 		  (HWND)wParam, createwnd->lpcs->hwndParent, createwnd->lpcs->style);
 	    ok(createwnd->hwndInsertAfter == HWND_TOP, "hwndInsertAfter should be always HWND_TOP\n");
+
+	    /* WS_VISIBLE should be turned off yet */
+	    style = createwnd->lpcs->style & ~WS_VISIBLE;
+	    ok(style == GetWindowLongA((HWND)wParam, GWL_STYLE),
+		"style of hwnd and style in the CREATESTRUCT do not match: %08lx != %08lx\n",
+		GetWindowLongA((HWND)wParam, GWL_STYLE), style);
 	    break;
 	}
     }
diff -u cvs/hq/wine/windows/win.c wine/windows/win.c
--- cvs/hq/wine/windows/win.c	2004-01-29 15:56:08.000000000 +0800
+++ wine/windows/win.c	2004-01-30 23:51:22.000000000 +0800
@@ -1133,6 +1133,19 @@ static HWND WIN_CreateWindowEx( CREATEST
     }
     hwnd = wndPtr->hwndSelf;
 
+    wndPtr->flags = (type == WIN_PROC_16) ? 0 : WIN_ISWIN32;
+
+    /* Correct the window style - stage 2 */
+    if (!(cs->style & WS_CHILD))
+    {
+	cs->style |= WS_CLIPSIBLINGS;
+	if (!(cs->style & WS_POPUP))
+	{
+            cs->style |= WS_CAPTION;
+            wndPtr->flags |= WIN_NEED_SIZE;
+	}
+    }
+
     /* Fill the window structure */
 
     wndPtr->tid            = GetCurrentThreadId();
@@ -1146,7 +1159,6 @@ static HWND WIN_CreateWindowEx( CREATEST
     wndPtr->dwExStyle      = cs->dwExStyle;
     wndPtr->wIDmenu        = 0;
     wndPtr->helpContext    = 0;
-    wndPtr->flags          = (type == WIN_PROC_16) ? 0 : WIN_ISWIN32;
     wndPtr->pVScroll       = NULL;
     wndPtr->pHScroll       = NULL;
     wndPtr->userdata       = 0;
@@ -1154,17 +1166,6 @@ static HWND WIN_CreateWindowEx( CREATEST
     wndPtr->hIconSmall     = 0;
     wndPtr->hSysMenu       = (wndPtr->dwStyle & WS_SYSMENU) ? MENU_GetSysMenu( hwnd, 0 ) : 0;
 
-    /* Correct the window style - stage 2 */
-
-    if (!(cs->style & WS_CHILD))
-    {
-	wndPtr->dwStyle |= WS_CLIPSIBLINGS;
-	if (!(cs->style & WS_POPUP))
-	{
-            wndPtr->dwStyle |= WS_CAPTION;
-            wndPtr->flags |= WIN_NEED_SIZE;
-	}
-    }
     SERVER_START_REQ( set_window_info )
     {
         req->handle    = hwnd;






More information about the wine-patches mailing list