[PATCH] [bug9233] Missing tooltips

Jason Edmeades jason.edmeades at googlemail.com
Mon Aug 13 17:57:05 CDT 2007


The problem here is that when a toolbar is requested for the tooltip text,
if it doesnt return anything then native will ask the parent instead. By
passing the call onto the parent, the tooltips now appear correctly.
---
 dlls/comctl32/tooltips.c |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index 9dd1970..3b41dda 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -314,7 +314,7 @@ static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO
     ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOA));
     ttnmdi.hdr.hwndFrom = hwnd;
     ttnmdi.hdr.idFrom = toolPtr->uId;
-    ttnmdi.hdr.code = TTN_GETDISPINFOA;
+    ttnmdi.hdr.code = TTN_GETDISPINFOA; /* == TTN_NEEDTEXTA */
     ttnmdi.lpszText = (LPSTR)&ttnmdi.szText;
     ttnmdi.uFlags = toolPtr->uFlags;
     ttnmdi.lParam = toolPtr->lParam;
@@ -332,7 +332,6 @@ static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO
         }
     }
     else if (ttnmdi.lpszText == 0) {
-        /* no text available */
         infoPtr->szTipText[0] = '\0';
     }
     else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
@@ -347,6 +346,22 @@ static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO
         ERR("recursive text callback!\n");
         infoPtr->szTipText[0] = '\0';
     }
+
+    /* no text available - try calling parent instead as per native */
+    /* FIXME: Unsure if SETITEM should save the value or not        */
+    if (infoPtr->szTipText[0] == 0x00) {
+
+        SendMessageW(GetParent(toolPtr->hwnd), WM_NOTIFY,
+                    (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);
+
+        if (IS_INTRESOURCE(ttnmdi.lpszText)) {
+            LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
+                   infoPtr->szTipText, INFOTIPSIZE);
+        } else if (ttnmdi.lpszText &&
+                   ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
+            Str_GetPtrAtoW(ttnmdi.lpszText, infoPtr->szTipText, INFOTIPSIZE);
+        }
+    }
 }
 
 static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr)
@@ -357,7 +372,7 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO
     ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOW));
     ttnmdi.hdr.hwndFrom = hwnd;
     ttnmdi.hdr.idFrom = toolPtr->uId;
-    ttnmdi.hdr.code = TTN_GETDISPINFOW;
+    ttnmdi.hdr.code = TTN_GETDISPINFOW; /* == TTN_NEEDTEXTW */
     ttnmdi.lpszText = (LPWSTR)&ttnmdi.szText;
     ttnmdi.uFlags = toolPtr->uFlags;
     ttnmdi.lParam = toolPtr->lParam;
@@ -375,7 +390,6 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO
         }
     }
     else if (ttnmdi.lpszText == 0) {
-        /* no text available */
         infoPtr->szTipText[0] = '\0';
     }
     else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) {
@@ -390,6 +404,23 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO
         ERR("recursive text callback!\n");
         infoPtr->szTipText[0] = '\0';
     }
+
+    /* no text available - try calling parent instead as per native */
+    /* FIXME: Unsure if SETITEM should save the value or not        */
+    if (infoPtr->szTipText[0] == 0x00) {
+
+        SendMessageW(GetParent(toolPtr->hwnd), WM_NOTIFY,
+                    (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);
+
+        if (IS_INTRESOURCE(ttnmdi.lpszText)) {
+            LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
+                   infoPtr->szTipText, INFOTIPSIZE);
+        } else if (ttnmdi.lpszText &&
+                   ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) {
+            Str_GetPtrW(ttnmdi.lpszText, infoPtr->szTipText, INFOTIPSIZE);
+        }
+    }
+
 }
 
 static void
-- 
1.5.0




More information about the wine-patches mailing list