tab: handle the notification window properly

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


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

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


-- 
Dimi.




More information about the wine-patches mailing list