Re: create more window data structures before calling WH_CBT hooks.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The right patch attached this time.

Rein.
-- 
Rein Klazes
rklazes@xs4all.nl
--- ./wine/windows/win.c	Tue Dec 11 07:30:05 2001
+++ ./mywine/windows/win.c	Sun Dec 16 14:24:09 2001
@@ -778,6 +778,8 @@
     WIN_SetRectangles( hwndDesktop, &rect, &rect );
     WIN_SetStyle( hwndDesktop, WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS );
 
+    pWndDesktop->pDriverData          = 0;
+ 
     if (!USER_Driver.pCreateWindow( hwndDesktop, &cs, FALSE )) return FALSE;
 
     pWndDesktop->flags |= WIN_NEEDS_ERASEBKGND;
@@ -1068,32 +1070,13 @@
 
     if (wndExtra) memset( wndPtr->wExtra, 0, wndExtra);
 
-    /* Call the WH_CBT hook */
+    /* create some window data structures */
+    wndPtr->pDriverData         = 0;
+    USER_Driver.pCreateWindow( wndPtr->hwndSelf, cs, unicode);
 
     hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
  ? HWND_BOTTOM : HWND_TOP;
 
-    if (HOOK_IsHooked( WH_CBT ))
-    {
-	CBT_CREATEWNDA cbtc;
-        LRESULT ret;
-
-	cbtc.lpcs = cs;
-	cbtc.hwndInsertAfter = hwndLinkAfter;
-        ret = (type == WIN_PROC_32W) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND,
-                                                       (WPARAM)hwnd, (LPARAM)&cbtc)
-                                     : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND,
-                                                       (WPARAM)hwnd, (LPARAM)&cbtc);
-        if (ret)
-	{
-	    TRACE("CBT-hook returned 0\n");
-            free_window_handle( hwnd );
-            CLASS_RemoveWindow( classPtr );
-            WIN_ReleaseWndPtr(wndPtr);
-            return 0;
-	}
-    }
-
     /* Correct the window style - stage 2 */
 
     if (!(cs->style & WS_CHILD))
@@ -1142,6 +1125,29 @@
         }
     }
     else SetWindowLongW( hwnd, GWL_ID, (UINT)cs->hMenu );
+    
+    /* Call the WH_CBT hook */
+    if (HOOK_IsHooked( WH_CBT ))
+    {
+	CBT_CREATEWNDA cbtc;
+        LRESULT ret;
+
+	cbtc.lpcs = cs;
+	cbtc.hwndInsertAfter = hwndLinkAfter;
+        ret = (type == WIN_PROC_32W) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND,
+                                                       (WPARAM)hwnd, (LPARAM)&cbtc)
+                                     : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND,
+                                                       (WPARAM)hwnd, (LPARAM)&cbtc);
+        if (ret)
+	{
+	    TRACE("CBT-hook returned 0\n");
+            free_window_handle( hwnd );
+            CLASS_RemoveWindow( classPtr );
+            WIN_ReleaseWndPtr(wndPtr);
+            return 0;
+	}
+    }
+
     WIN_ReleaseWndPtr( wndPtr );
 
     if (!USER_Driver.pCreateWindow( hwnd, cs, unicode))
--- ./wine/dlls/x11drv/window.c	Mon Oct 22 21:08:34 2001
+++ ./mywine/dlls/x11drv/window.c	Sun Dec 16 14:08:58 2001
@@ -827,26 +827,33 @@
     RECT rect;
     BOOL ret = FALSE;
 
-    if (!(data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)))) return FALSE;
-    data->whole_window  = 0;
-    data->client_window = 0;
-    data->icon_window   = 0;
-    data->hWMIconBitmap = 0;
-    data->hWMIconMask   = 0;
-
     wndPtr = WIN_GetPtr( hwnd );
-    wndPtr->pDriverData = data;
+    if(!wndPtr->pDriverData) {
+        if (!(data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)))){
+            WIN_ReleasePtr( wndPtr );
+            return FALSE;
+        }
+        data->whole_window  = 0;
+        data->client_window = 0;
+        data->icon_window   = 0;
+        data->hWMIconBitmap = 0;
+        data->hWMIconMask   = 0;
+
+        wndPtr->pDriverData = data;
 
-    /* initialize the dimensions before sending WM_GETMINMAXINFO */
-    SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
-    WIN_SetRectangles( hwnd, &rect, &rect );
+        /* initialize the dimensions before sending WM_GETMINMAXINFO */
+        SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
+        WIN_SetRectangles( hwnd, &rect, &rect );
 
-    if (!wndPtr->parent)
-    {
-        create_desktop( display, wndPtr, cs );
+        if (!wndPtr->parent)
+        {
+            create_desktop( display, wndPtr, cs );
+        }
         WIN_ReleasePtr( wndPtr );
         return TRUE;
     }
+
+    data=wndPtr->pDriverData;
 
     if (!create_whole_window( display, wndPtr )) goto failed;
     if (!create_client_window( display, wndPtr )) goto failed;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux