pager: handle the notification window properly

Dimitrie O. Paun dpaun at rogers.com
Wed Nov 19 14:04:49 CST 2003


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

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);


-- 
Dimi.




More information about the wine-patches mailing list