datetime: handle the notification window properly

Dimitrie O. Paun dpaun at rogers.com
Wed Nov 19 13:57:44 CST 2003


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

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 */


-- 
Dimi.




More information about the wine-patches mailing list