status: handle the notification window properly

Dimitrie O. Paun dpaun at rogers.com
Wed Nov 19 14:06:13 CST 2003


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

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:


-- 
Dimi.




More information about the wine-patches mailing list