comctl32: handle the notification window properly

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

 



And here is a rollup patch with all of the different individual
patches I've sent yesterday, in case you prefer them this way.

ChangeLog
    Make the controls send notifications to the parent window passed
    to it in CREATESTRUCT.  Based on a treeview patch by Igor Grahek.

Index: dlls/comctl32/animate.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/animate.c,v
retrieving revision 1.51
diff -u -r1.51 animate.c
--- dlls/comctl32/animate.c	22 Sep 2003 21:32:34 -0000	1.51
+++ dlls/comctl32/animate.c	19 Nov 2003 05:06:31 -0000
@@ -57,7 +57,8 @@
    /* reference to input stream (file or resource) */
    HGLOBAL 		hRes;
    HMMIO		hMMio;	/* handle to mmio stream */
-   HWND			hWnd;
+   HWND			hwndSelf;
+   HWND			hwndNotify;
    /* information on the loaded AVI file */
    MainAVIHeader	mah;
    AVIStreamHeader	ash;
@@ -88,9 +89,9 @@
 
 static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
 {
-    SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND,
-		 MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
-		 (LPARAM)infoPtr->hWnd);
+    SendMessageA(infoPtr->hwndNotify, WM_COMMAND,
+		 MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif),
+		 (LPARAM)infoPtr->hwndSelf);
 }
 
 static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName)
@@ -149,7 +150,7 @@
 	    infoPtr->hThread = 0;
     }
     if (infoPtr->uTimer) {
-	KillTimer(infoPtr->hWnd, infoPtr->uTimer);
+	KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
 	infoPtr->uTimer = 0;
     }
 
@@ -202,7 +203,7 @@
             infoPtr->hbmPrevFrame = 0;
         }
 	infoPtr->indata = infoPtr->outdata = NULL;
-	infoPtr->hWnd = 0;
+	infoPtr->hwndSelf = 0;
 	infoPtr->hMMio = 0;
 
 	memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
@@ -297,7 +298,7 @@
         infoPtr->transparentColor = GetPixel(hdcMem,0,0);
     }
 
-    if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
+    if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
     {
         HDC hdcFinal = CreateCompatibleDC(hDC);
         HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
@@ -322,11 +323,11 @@
         infoPtr->hbmPrevFrame = hbmFinal;
          }
 
-    if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER)
+    if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
     {
        RECT rect;
 
-       GetWindowRect(infoPtr->hWnd, &rect);
+       GetWindowRect(infoPtr->hwndSelf, &rect);
        nOffsetX = ((rect.right - rect.left) - nWidth)/2;
        nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
     }
@@ -356,9 +357,9 @@
 	return FALSE;
     }
 
-    if ((hDC = GetDC(infoPtr->hWnd)) != 0) {
+    if ((hDC = GetDC(infoPtr->hwndSelf)) != 0) {
 	ANIMATE_PaintFrame(infoPtr, hDC);
-	ReleaseDC(infoPtr->hWnd, hDC);
+	ReleaseDC(infoPtr->hwndSelf, hDC);
     }
 
     if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
@@ -387,15 +388,15 @@
 
     while(1)
     {
-        if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
+        if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
         {
-            hDC = GetDC(infoPtr->hWnd);
+            hDC = GetDC(infoPtr->hwndSelf);
 	    /* sometimes the animation window will be destroyed in between
 	     * by the main program, so a ReleaseDC() error msg is possible */
-            infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(infoPtr->hWnd),
+            infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
 					     WM_CTLCOLORSTATIC, (WPARAM)hDC,
-					     (LPARAM)infoPtr->hWnd);
-            ReleaseDC(infoPtr->hWnd,hDC);
+					     (LPARAM)infoPtr->hwndSelf);
+            ReleaseDC(infoPtr->hwndSelf,hDC);
         }
 
         EnterCriticalSection(&infoPtr->cs);
@@ -689,7 +690,7 @@
     HINSTANCE hInstance = (HINSTANCE)wParam;
 
     ANIMATE_Free(infoPtr);
-    infoPtr->hWnd = hWnd;
+    infoPtr->hwndSelf = hWnd;
 
     if (!lParam) {
 	TRACE("Closing avi!\n");
@@ -787,14 +788,15 @@
 	return 0;
     }
 
-    TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)GetParent(hWnd));
-
     /* store crossref hWnd <-> info structure */
     SetWindowLongA(hWnd, 0, (DWORD)infoPtr);
-    infoPtr->hWnd = hWnd;
+    infoPtr->hwndSelf = hWnd;
+    infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
     infoPtr->transparentColor = ANIMATE_COLOR_NONE;
     infoPtr->hbmPrevFrame = 0;
 
+    TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)infoPtr->hwndNotify);
+
     InitializeCriticalSection(&infoPtr->cs);
 
     return 0;
@@ -819,12 +821,13 @@
 
 static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+    ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
     RECT rect;
     HBRUSH hBrush = 0;
 
     if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     {
-        hBrush = (HBRUSH)SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,
+        hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC,
 				      wParam, (LPARAM)hWnd);
     }
 
@@ -882,7 +885,7 @@
     	if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
         {
             ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
-            infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(hWnd),
+            infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
 						     WM_CTLCOLORSTATIC,
 						     wParam, (LPARAM)hWnd);
         }
@@ -902,7 +905,7 @@
 	    	return DefWindowProcA(hWnd, uMsg, wParam, lParam);
 
             if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
-                infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(hWnd),
+                infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
 							 WM_CTLCOLORSTATIC,
 							 wParam, (LPARAM)hWnd);
 
Index: dlls/comctl32/comboex.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/comboex.c,v
retrieving revision 1.67
diff -u -r1.67 comboex.c
--- dlls/comctl32/comboex.c	22 Sep 2003 21:32:34 -0000	1.67
+++ dlls/comctl32/comboex.c	19 Nov 2003 05:07:08 -0000
@@ -64,6 +64,7 @@
 {
     HIMAGELIST   himl;
     HWND         hwndSelf;         /* my own hwnd */
+    HWND         hwndNotify;       /* my parent hwnd */
     HWND         hwndCombo;
     HWND         hwndEdit;
     WNDPROC      prevEditWndProc;  /* previous Edit WNDPROC value */
@@ -190,11 +191,9 @@
     hdr->hwndFrom = infoPtr->hwndSelf;
     hdr->code = code;
     if (infoPtr->NtfUnicode)
-	return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
-			     (LPARAM)hdr);
+	return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr);
     else
-	return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
-			     (LPARAM)hdr);
+	return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr);
 }
 
 
@@ -935,8 +934,9 @@
     infoPtr->selected = -1;
 
     infoPtr->unicode = IsWindowUnicode (hwnd);
+    infoPtr->hwndNotify = cs->hwndParent;
 
-    i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
+    i = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
     if ((i != NFR_ANSI) && (i != NFR_UNICODE)) {
 	WARN("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
 	i = NFR_ANSI;
@@ -1079,7 +1079,7 @@
     INT cursel, n, oldItem;
     NMCBEENDEDITW cbeend;
     DWORD oldflags;
-    HWND parent = GetParent (infoPtr->hwndSelf);
+    HWND parent = infoPtr->hwndNotify;
 
     TRACE("for command %d\n", command);
 
@@ -1587,7 +1587,7 @@
 static LRESULT COMBOEX_NotifyFormat (COMBOEX_INFO *infoPtr, LPARAM lParam)
 {
     if (lParam == NF_REQUERY) {
-	INT i = SendMessageW(GetParent (infoPtr->hwndSelf),
+	INT i = SendMessageW(infoPtr->hwndNotify,
 			 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
 	infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
     }
@@ -2070,7 +2070,7 @@
 		    /* strings not equal -- indicate edit has changed */
 		    infoPtr->flags |= WCBE_EDITCHG;
 		}
-		SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND,
+		SendMessageW ( infoPtr->hwndNotify, WM_COMMAND,
 			       MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),
 					  CBN_EDITCHANGE),
 			       (LPARAM)infoPtr->hwndSelf);
@@ -2236,9 +2236,9 @@
 
 	case WM_NOTIFY:
 	    if (infoPtr->NtfUnicode)
-		return SendMessageW (GetParent (hwnd), uMsg, wParam, lParam);
+		return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
 	    else
-		return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
+		return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
 
 
 /*   Window messages we need to process */
Index: dlls/comctl32/datetime.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/datetime.c,v
retrieving revision 1.41
diff -u -r1.41 datetime.c
--- dlls/comctl32/datetime.c	22 Sep 2003 21:32:34 -0000	1.41
+++ dlls/comctl32/datetime.c	3 Nov 2003 21:27:15 -0000
@@ -44,6 +44,7 @@
 typedef struct
 {
 	HWND hMonthCal;
+	HWND hwndNotify;
 	HWND hUpdown;
 	SYSTEMTIME date;
 	BOOL dateValid;
@@ -895,11 +896,8 @@
     else
         ShowWindow(infoPtr->hMonthCal, SW_SHOW);
 
-    TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p, mcpp:%p\n",
-              hwnd,infoPtr->hMonthCal,
-              GetParent (infoPtr->hMonthCal),
-              GetDesktopWindow (),
-              GetParent (GetParent (infoPtr->hMonthCal)));
+    TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p\n",
+           hwnd, infoPtr->hMonthCal, infoPtr->hwndNotify, GetDesktopWindow ());
     DATETIME_SendSimpleNotify (hwnd, DTN_DROPDOWN);
   }
 
@@ -1119,7 +1117,7 @@
    dtdtc.dwFlags = GDT_VALID;
 
  MONTHCAL_CopyTime (&infoPtr->date, &dtdtc.st);
- return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
+ return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
                               (WPARAM)dtdtc.nmhdr.idFrom, (LPARAM)&dtdtc);
 }
 
@@ -1127,6 +1125,7 @@
 static BOOL
 DATETIME_SendSimpleNotify (HWND hwnd, UINT code)
 {
+    DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
     NMHDR nmhdr;
 
     TRACE("%x\n",code);
@@ -1134,7 +1133,7 @@
     nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
     nmhdr.code     = code;
 
-    return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
+    return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
                                 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
 }
 
@@ -1225,6 +1224,7 @@
   infoPtr->fieldRect = (RECT *) Alloc (32*sizeof(RECT));
   infoPtr->buflen = (int *) Alloc (32*sizeof(int));
   infoPtr->nrFieldsAllocated = 32;
+  infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
 
   DATETIME_SetFormat (hwnd, 0, 0);
 
@@ -1232,7 +1232,7 @@
     infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0,
 	WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS,
 	0, 0, 0, 0,
-	GetParent(hwnd),
+	infoPtr->hwndNotify,
 	0, 0, 0);
 
   /* initialize info structure */
Index: dlls/comctl32/header.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/header.c,v
retrieving revision 1.61
diff -u -r1.61 header.c
--- dlls/comctl32/header.c	14 Oct 2003 20:13:42 -0000	1.61
+++ dlls/comctl32/header.c	3 Nov 2003 21:34:29 -0000
@@ -199,7 +199,7 @@
 	dis.rcItem     = r;
 	dis.itemData   = phdi->lParam;
         oldBkMode = SetBkMode(hdc, TRANSPARENT);
-	SendMessageA (GetParent (hwnd), WM_DRAWITEM,
+	SendMessageA (infoPtr->hwndNotify, WM_DRAWITEM,
 			(WPARAM)dis.CtlID, (LPARAM)&dis);
         if (oldBkMode != TRANSPARENT)
             SetBkMode(hdc, oldBkMode);
@@ -1287,7 +1287,7 @@
     infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO));
     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
 
-    infoPtr->hwndNotify = GetParent(hwnd);
+    infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
     infoPtr->uNumItem = 0;
     infoPtr->hFont = 0;
     infoPtr->items = 0;
Index: dlls/comctl32/hotkey.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/hotkey.c,v
retrieving revision 1.27
diff -u -r1.27 hotkey.c
--- dlls/comctl32/hotkey.c	22 Sep 2003 21:32:34 -0000	1.27
+++ dlls/comctl32/hotkey.c	19 Nov 2003 02:38:57 -0000
@@ -38,6 +38,7 @@
 typedef struct tagHOTKEY_INFO
 {
     HWND  hwndSelf;
+    HWND  hwndNotify;
     HFONT hFont;
     BOOL  bFocus;
     INT   nHeight;
@@ -222,6 +223,7 @@
     infoPtr->HotKey = infoPtr->InvComb = infoPtr->InvMod = infoPtr->CurrMod = 0;
     infoPtr->CaretPos = 2;
     infoPtr->hwndSelf = hwnd;
+    infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
     LoadStringW(COMCTL32_hModule, HKY_NONE, infoPtr->strNone, 15);
 
     /* get default font height */
@@ -252,7 +254,7 @@
     RECT   rc;
 
     hBrush =
-	(HBRUSH)SendMessageW (GetParent (infoPtr->hwndSelf), WM_CTLCOLOREDIT,
+	(HBRUSH)SendMessageW (infoPtr->hwndNotify, WM_CTLCOLOREDIT,
 				wParam, (LPARAM)infoPtr->hwndSelf);
     if (hBrush)
 	hBrush = (HBRUSH)GetStockObject (WHITE_BRUSH);
Index: dlls/comctl32/ipaddress.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/ipaddress.c,v
retrieving revision 1.34
diff -u -r1.34 ipaddress.c
--- dlls/comctl32/ipaddress.c	22 Sep 2003 21:32:33 -0000	1.34
+++ dlls/comctl32/ipaddress.c	3 Nov 2003 21:04:14 -0000
@@ -61,6 +61,7 @@
 typedef struct
 {
     HWND	Self;
+    HWND	Notify;
     IPPART_INFO	Part[4];
 } IPADDRESS_INFO;
 
@@ -82,7 +83,7 @@
 
     TRACE("(command=%x)\n", command);
 
-    return SendMessageW (GetParent (hwnd), WM_COMMAND,
+    return SendMessageW (infoPtr->Notify, WM_COMMAND,
              MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd);
 }
 
@@ -99,7 +100,7 @@
     nmip.iField = field;
     nmip.iValue = value;
 
-    SendMessageW (GetParent (infoPtr->Self), WM_NOTIFY,
+    SendMessageW (infoPtr->Notify, WM_NOTIFY,
                   (WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip);
 
     TRACE("<-- %d\n", nmip.iValue);
@@ -149,7 +150,7 @@
 }
 
 
-static LRESULT IPADDRESS_Create (HWND hwnd)
+static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
 {
     IPADDRESS_INFO *infoPtr;
     RECT rcClient, edit;
@@ -173,6 +174,7 @@
     edit.bottom = rcClient.bottom - 2;
 
     infoPtr->Self = hwnd;
+    infoPtr->Notify = lpCreate->hwndParent;
 
     for (i = 0; i < 4; i++) {
 	IPPART_INFO* part = &infoPtr->Part[i];
@@ -508,7 +510,7 @@
     switch (uMsg)
     {
 	case WM_CREATE:
-	    return IPADDRESS_Create (hwnd);
+	    return IPADDRESS_Create (hwnd, (LPCREATESTRUCTA)lParam);
 
 	case WM_DESTROY:
 	    return IPADDRESS_Destroy (infoPtr);
Index: dlls/comctl32/monthcal.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/monthcal.c,v
retrieving revision 1.42
diff -u -r1.42 monthcal.c
--- dlls/comctl32/monthcal.c	22 Sep 2003 21:32:33 -0000	1.42
+++ dlls/comctl32/monthcal.c	19 Nov 2003 05:35:32 -0000
@@ -104,6 +104,7 @@
     RECT days;		/* calendar area */
     RECT weeknums;	/* week numbers at left side */
     RECT todayrect;	/* `today: xx/xx/xx' text rect */
+    HWND hwndNotify;    /* Window to receive the notifications */
     HWND hWndYearEdit;  /* Window Handle of edit box to handle years */
     HWND hWndYearUpDown;/* Window Handle of updown box to handle years */
 } MONTHCAL_INFO, *LPMONTHCAL_INFO;
@@ -1304,7 +1305,7 @@
     nmds.cDayState	= infoPtr->monthRange;
     nmds.prgDayState	= Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
 
-    SendMessageA(GetParent(hwnd), WM_NOTIFY,
+    SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
     (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
     for(i=0; i<infoPtr->monthRange; i++)
       infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1335,7 +1336,7 @@
     nmds.prgDayState	= Alloc
                         (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
 
-    SendMessageA(GetParent(hwnd), WM_NOTIFY,
+    SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
         (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
     for(i=0; i<infoPtr->monthRange; i++)
        infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1489,7 +1490,7 @@
     MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
     MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
 
-    SendMessageA(GetParent(hwnd), WM_NOTIFY,
+    SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
            (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
 
     MONTHCAL_CopyTime(&ht.st, &selArray[0]);
@@ -1555,9 +1556,9 @@
   nmhdr.hwndFrom = hwnd;
   nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
   nmhdr.code     = NM_RELEASEDCAPTURE;
-  TRACE("Sent notification from %p to %p\n", hwnd, GetParent(hwnd));
+  TRACE("Sent notification from %p to %p\n", hwnd, infoPtr->hwndNotify);
 
-  SendMessageA(GetParent(hwnd), WM_NOTIFY,
+  SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
                                 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
 
   nmsc.nmhdr.hwndFrom = hwnd;
@@ -1566,7 +1567,7 @@
   MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
   MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
 
-  SendMessageA(GetParent(hwnd), WM_NOTIFY,
+  SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
            (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
 
   /* redraw if necessary */
@@ -1880,6 +1881,8 @@
     ERR( "pointer assignment error!\n");
     return 0;
   }
+
+  infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
 
   infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
   GetObjectA(infoPtr->hFont, sizeof(LOGFONTA), &logFont);
Index: dlls/comctl32/pager.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/pager.c,v
retrieving revision 1.45
diff -u -r1.45 pager.c
--- dlls/comctl32/pager.c	22 Sep 2003 21:32:33 -0000	1.45
+++ dlls/comctl32/pager.c	19 Nov 2003 05:39:44 -0000
@@ -44,6 +44,7 @@
 typedef struct
 {
     HWND   hwndChild;  /* handle of the contained wnd */
+    HWND   hwndNotify; /* handle of the parent wnd */
     BOOL   bNoResize;  /* set when created with CCS_NORESIZE */
     COLORREF clrBk;    /* background color */
     INT    nBorder;    /* border size for the control */
@@ -325,6 +326,7 @@
 static void
 PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth)
 {
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
     NMPGCALCSIZE nmpgcs;
     ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
     nmpgcs.hdr.hwndFrom = hwnd;
@@ -333,7 +335,7 @@
     nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
     nmpgcs.iWidth = getWidth ? *size : 0;
     nmpgcs.iHeight = getWidth ? 0 : *size;
-    SendMessageA (GetParent (hwnd), WM_NOTIFY,
+    SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
                   (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs);
 
     *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight;
@@ -795,7 +797,7 @@
         }
         nmpgScroll.iScroll -= 2*infoPtr->nButtonSize;
 
-        SendMessageA (GetParent(hwnd), WM_NOTIFY,
+        SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
                     (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll);
 
         TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll);
@@ -843,6 +845,7 @@
 
     /* set default settings */
     infoPtr->hwndChild = NULL;
+    infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
     infoPtr->bNoResize = dwStyle & CCS_NORESIZE;
     infoPtr->clrBk = GetSysColor(COLOR_BTNFACE);
     infoPtr->nBorder = 0;
@@ -1177,7 +1180,7 @@
         nmhdr.hwndFrom = hwnd;
         nmhdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
         nmhdr.code = NM_RELEASEDCAPTURE;
-        SendMessageA (GetParent(hwnd), WM_NOTIFY,
+        SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
                         (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
     }
 
@@ -1267,7 +1270,7 @@
 		nmhdr.hwndFrom = hwnd;
 		nmhdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
 		nmhdr.code = NM_RELEASEDCAPTURE;
-		SendMessageA (GetParent(hwnd), WM_NOTIFY,
+		SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
 			      (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
 	    }
 	}
@@ -1575,7 +1578,7 @@
 
         case WM_NOTIFY:
         case WM_COMMAND:
-            return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
+            return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
 
         default:
             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
Index: dlls/comctl32/status.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/status.c,v
retrieving revision 1.63
diff -u -r1.63 status.c
--- dlls/comctl32/status.c	21 Oct 2003 23:43:14 -0000	1.63
+++ dlls/comctl32/status.c	19 Nov 2003 05:15:55 -0000
@@ -67,6 +67,7 @@
 typedef struct
 {
     HWND              Self;
+    HWND              Notify;
     WORD              numParts;
     UINT              height;
     BOOL              simple;
@@ -170,8 +171,7 @@
 	    dis.hDC = hdc;
 	    dis.rcItem = r;
 	    dis.itemData = (INT)part->text;
-	    SendMessageW (GetParent (infoPtr->Self), WM_DRAWITEM,
-		    (WPARAM)dis.CtlID, (LPARAM)&dis);
+	    SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis);
     }
     else
 	{
@@ -561,7 +561,7 @@
 	INT  width, x, y;
 	RECT parent_rect;
 
-	GetClientRect (GetParent (infoPtr->Self), &parent_rect);
+	GetClientRect (infoPtr->Notify, &parent_rect);
 	infoPtr->height = height + VERT_BORDER;
 	width = parent_rect.right - parent_rect.left;
 	x = parent_rect.left;
@@ -779,7 +779,7 @@
     nmhdr.hwndFrom = infoPtr->Self;
     nmhdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
     nmhdr.code = SBN_SIMPLEMODECHANGE;
-    SendMessageW (GetParent (infoPtr->Self), WM_NOTIFY, 0, (LPARAM)&nmhdr);
+    SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
     InvalidateRect(infoPtr->Self, NULL, FALSE);
     return TRUE;
 }
@@ -829,13 +829,14 @@
     SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
 
     infoPtr->Self = hwnd;
+    infoPtr->Notify = lpCreate->hwndParent;
     infoPtr->numParts = 1;
     infoPtr->parts = 0;
     infoPtr->simple = FALSE;
     infoPtr->clrBk = CLR_DEFAULT;
     infoPtr->hFont = 0;
 
-    i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
+    i = SendMessageW(infoPtr->Notify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
     infoPtr->NtfUnicode = (i == NFR_UNICODE);
 
     GetClientRect (hwnd, &rect);
@@ -923,7 +924,7 @@
     }
 
     if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */
-        GetClientRect (GetParent (hwnd), &rect);
+        GetClientRect (infoPtr->Notify, &rect);
         width = rect.right - rect.left;
         infoPtr->height = textHeight + 4 + VERT_BORDER;
         SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
@@ -1074,7 +1075,7 @@
     if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE;
 
     /* width and height don't apply */
-    GetClientRect (GetParent(infoPtr->Self), &parent_rect);
+    GetClientRect (infoPtr->Notify, &parent_rect);
     width = parent_rect.right - parent_rect.left;
     x = parent_rect.left;
     y = parent_rect.bottom - infoPtr->height;
@@ -1100,13 +1101,14 @@
 static LRESULT
 STATUSBAR_SendNotify (HWND hwnd, UINT code)
 {
+    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
     NMHDR  nmhdr;
 
     TRACE("code %04x\n", code);
     nmhdr.hwndFrom = hwnd;
     nmhdr.idFrom = GetWindowLongW (hwnd, GWL_ID);
     nmhdr.code = code;
-    SendMessageW (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
+    SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
     return 0;
 }
 
@@ -1220,7 +1222,7 @@
 
 	case WM_NCLBUTTONUP:
 	case WM_NCLBUTTONDOWN:
-    	    PostMessageW (GetParent (hwnd), msg, wParam, lParam);
+    	    PostMessageW (infoPtr->Notify, msg, wParam, lParam);
 	    return 0;
 
 	case WM_NOTIFYFORMAT:
Index: dlls/comctl32/tab.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/tab.c,v
retrieving revision 1.88
diff -u -r1.88 tab.c
--- dlls/comctl32/tab.c	31 Oct 2003 00:06:42 -0000	1.88
+++ dlls/comctl32/tab.c	19 Nov 2003 19:35:01 -0000
@@ -59,6 +59,7 @@
 
 typedef struct
 {
+  HWND       hwndNotify;      /* notification window (parent) */
   UINT       uNumItem;        /* number of tab items */
   UINT       uNumRows;	      /* number of tab rows */
   INT        tabHeight;       /* height of the tab row */
@@ -118,13 +119,14 @@
 static BOOL
 TAB_SendSimpleNotify (HWND hwnd, UINT code)
 {
+    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     NMHDR nmhdr;
 
     nmhdr.hwndFrom = hwnd;
     nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
     nmhdr.code = code;
 
-    return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
+    return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
             (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr);
 }
 
@@ -1526,7 +1528,7 @@
     /*
      * send the draw message
      */
-    SendMessageA( GetParent(hwnd), WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
+    SendMessageA( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
   }
   else
   {
@@ -3001,6 +3003,7 @@
 
   SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
 
+  infoPtr->hwndNotify      = ((LPCREATESTRUCTW)lParam)->hwndParent;
   infoPtr->uNumItem        = 0;
   infoPtr->uNumRows        = 0;
   infoPtr->uHItemPadding   = 6;
@@ -3044,7 +3047,7 @@
       nmttc.hdr.code = NM_TOOLTIPSCREATED;
       nmttc.hwndToolTips = infoPtr->hwndToolTip;
 
-      SendMessageA (GetParent (hwnd), WM_NOTIFY,
+      SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
 		    (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc);
     }
   }
@@ -3113,6 +3116,7 @@
 static LRESULT WINAPI
 TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
 
     TRACE("hwnd=%p msg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);
     if (!TAB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
@@ -3243,7 +3247,7 @@
       return TAB_LButtonUp (hwnd, wParam, lParam);
 
     case WM_NOTIFY:
-      return SendMessageA(GetParent(hwnd), WM_NOTIFY, wParam, lParam);
+      return SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam);
 
     case WM_RBUTTONDOWN:
       return TAB_RButtonDown (hwnd, wParam, lParam);
Index: dlls/comctl32/toolbar.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.143
diff -u -r1.143 toolbar.c
--- dlls/comctl32/toolbar.c	5 Nov 2003 00:35:28 -0000	1.143
+++ dlls/comctl32/toolbar.c	19 Nov 2003 19:38:45 -0000
@@ -4715,7 +4715,7 @@
     infoPtr->nButtonDown = -1;
     infoPtr->nOldHit = -1;
     infoPtr->nHotItem = -2; /* It has to be initially different from nOldHit */
-    infoPtr->hwndNotify = GetParent (hwnd);
+    infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
     infoPtr->bTransparent = (dwStyle & TBSTYLE_TRANSPARENT);
     infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST));
     infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE : DT_CENTER;
@@ -5453,7 +5453,7 @@
     INT i;
 
     if (lParam == NF_REQUERY) {
-	i = SendMessageA(GetParent(infoPtr->hwndSelf),
+	i = SendMessageA(infoPtr->hwndNotify,
 			 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
 	if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
 	    ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
@@ -5649,6 +5649,8 @@
 static LRESULT WINAPI
 ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
+
     TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
 	  hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
 
@@ -6002,13 +6004,7 @@
 	case WM_DRAWITEM:
 	case WM_MEASUREITEM:
 	case WM_VKEYTOITEM:
-	    {
-                TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-                if(infoPtr != NULL)
-                    return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
-                else
-                    return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
-            }
+            return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
 
 	/* We see this in Outlook Express 5.x and just does DefWindowProc */
         case PGM_FORWARDMOUSE:
Index: dlls/comctl32/tooltips.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/tooltips.c,v
retrieving revision 1.60
diff -u -r1.60 tooltips.c
--- dlls/comctl32/tooltips.c	22 Sep 2003 21:32:33 -0000	1.60
+++ dlls/comctl32/tooltips.c	19 Nov 2003 04:38:26 -0000
@@ -1902,12 +1902,11 @@
 
 
 static LRESULT
-TOOLTIPS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     TOOLTIPS_INFO *infoPtr;
     NONCLIENTMETRICSA nclm;
     INT nResult;
-    HWND hParent;
 
     /* allocate memory for info structure */
     infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO));
@@ -1930,21 +1929,16 @@
 
     TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L);
 
-    hParent = GetParent(hwnd);
-    if (hParent) {
-        nResult = (INT) SendMessageA (hParent, WM_NOTIFYFORMAT,
+    nResult = (INT) SendMessageA (lpcs->hwndParent, WM_NOTIFYFORMAT,
 				  (WPARAM)hwnd, (LPARAM)NF_QUERY);
-        if (nResult == NFR_ANSI) {
-            infoPtr->bNotifyUnicode = FALSE;
+    if (nResult == NFR_ANSI) {
+        infoPtr->bNotifyUnicode = FALSE;
 	TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
-        }
-        else if (nResult == NFR_UNICODE) {
-	    infoPtr->bNotifyUnicode = TRUE;
-	    TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
-        }
-        else {
-	    ERR (" -- WM_NOTIFYFORMAT returns: error!\n");
-        }
+    } else if (nResult == NFR_UNICODE) {
+        infoPtr->bNotifyUnicode = TRUE;
+	TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
+    } else {
+        TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
     }
 
     SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
@@ -2371,7 +2365,7 @@
 
 
 	case WM_CREATE:
-	    return TOOLTIPS_Create (hwnd, wParam, lParam);
+	    return TOOLTIPS_Create (hwnd, (LPCREATESTRUCTW)lParam);
 
 	case WM_DESTROY:
 	    return TOOLTIPS_Destroy (hwnd, wParam, lParam);
Index: dlls/comctl32/treeview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.132
diff -u -r1.132 treeview.c
--- dlls/comctl32/treeview.c	20 Nov 2003 04:19:59 -0000	1.132
+++ dlls/comctl32/treeview.c	20 Nov 2003 06:16:37 -0000
@@ -4718,7 +4718,7 @@
 /* Create/Destroy *******************************************************/
 
 static LRESULT
-TREEVIEW_Create(HWND hwnd)
+TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     RECT rcClient;
     TREEVIEW_INFO *infoPtr;
@@ -4797,7 +4797,7 @@
     infoPtr->root->iLevel = -1;
     infoPtr->root->visibleOrder = -1;
 
-    infoPtr->hwndNotify = GetParent(hwnd);
+    infoPtr->hwndNotify = lpcs->hwndParent;
 #if 0
     infoPtr->bTransparent = ( GetWindowLongA( hwnd, GWL_STYLE) & TBSTYLE_FLAT);
 #endif
@@ -5179,7 +5179,7 @@
     else
     {
 	if (uMsg == WM_CREATE)
-	    TREEVIEW_Create(hwnd);
+	    TREEVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam);
 	else
 	    goto def;
     }
Index: dlls/comctl32/updown.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/updown.c,v
retrieving revision 1.55
diff -u -r1.55 updown.c
--- dlls/comctl32/updown.c	22 Sep 2003 21:32:33 -0000	1.55
+++ dlls/comctl32/updown.c	3 Nov 2003 21:05:17 -0000
@@ -48,6 +48,7 @@
 typedef struct
 {
     HWND      Self;            /* Handle to this up-down control */
+    HWND      Notify;          /* Handle to the parent window */
     UINT      AccelCount;      /* Number of elements in AccelVect */
     UDACCEL*  AccelVect;       /* Vector containing AccelCount elements */
     INT       AccelIndex;      /* Current accel index, -1 if not accel'ing */
@@ -562,8 +563,7 @@
     ni.hdr.hwndFrom = infoPtr->Self;
     ni.hdr.idFrom   = GetWindowLongW (infoPtr->Self, GWL_ID);
     ni.hdr.code = UDN_DELTAPOS;
-    if (!SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY,
-		   (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
+    if (!SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
         /* Parent said: OK to adjust */
 
         /* Now adjust value with (maybe new) delta */
@@ -574,10 +574,8 @@
     }
 
     /* Also, notify it. This message is sent in any case. */
-    SendMessageW( GetParent(infoPtr->Self),
-		  dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
-		  MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal),
-		  (LPARAM)infoPtr->Self);
+    SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
+		  MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), (LPARAM)infoPtr->Self);
 }
 
 /***********************************************************************
@@ -616,7 +614,7 @@
 	hdr.hwndFrom = infoPtr->Self;
 	hdr.idFrom   = GetWindowLongW (infoPtr->Self, GWL_ID);
 	hdr.code = NM_RELEASEDCAPTURE;
-	SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);
+	SendMessageW(infoPtr->Notify, WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);
 	ReleaseCapture();
     }
 
@@ -720,6 +718,7 @@
 
 	    /* initialize the info struct */
 	    infoPtr->Self = hwnd;
+	    infoPtr->Notify = ((LPCREATESTRUCTA)lParam)->hwndParent;
 	    infoPtr->AccelCount = 0;
 	    infoPtr->AccelVect = 0;
 	    infoPtr->AccelIndex = -1;
@@ -798,7 +797,7 @@
 	    if ( (infoPtr->Flags & FLAG_MOUSEIN) &&
 		 (infoPtr->Flags & FLAG_ARROW) ) {
 
-	    	SendMessageW( GetParent(hwnd),
+	    	SendMessageW( infoPtr->Notify,
 			      dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
                   	      MAKELONG(SB_ENDSCROLL, infoPtr->CurVal),
 			      (LPARAM)hwnd);


-- 
Dimi.



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

  Powered by Linux