Rob Shearman : comctl32: Fix the tooltips behaviour when TTF_ABSOLUTE isn' t specified.

Alexandre Julliard julliard at winehq.org
Tue Nov 20 10:54:50 CST 2007


Module: wine
Branch: master
Commit: c6525745f241962d7776b665b768b08d3c9cca09
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c6525745f241962d7776b665b768b08d3c9cca09

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon Nov 19 15:29:57 2007 +0000

comctl32: Fix the tooltips behaviour when TTF_ABSOLUTE isn't specified.

This does not mean to use the current cursor position. Instead, it means
that the left hand edge of balloon tips doesn't have to be exactly the
co-ordinate passed in (i.e. the stem can be as vertical as possible) and
it means non-balloon tips can use smart placement.

---

 dlls/comctl32/tooltips.c |   73 +++++++++++++++-------------------------------
 1 files changed, 24 insertions(+), 49 deletions(-)

diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index 901abc0..8740b63 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -573,64 +573,39 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr, BOOL track_activate)
 
     if (track_activate)
     {
-        if (toolPtr->uFlags & TTF_ABSOLUTE)
-        {
-            rect.left = infoPtr->xTrackPos;
-            rect.top  = infoPtr->yTrackPos;
-            ptfx = rect.left;
+        rect.left = infoPtr->xTrackPos;
+        rect.top  = infoPtr->yTrackPos;
+        ptfx = rect.left;
 
-            if (toolPtr->uFlags & TTF_CENTERTIP)
-            {
-                rect.left -= (size.cx / 2);
-                if (!(style & TTS_BALLOON))
-                    rect.top  -= (size.cy / 2);
-            }
-            infoPtr->bToolBelow = TRUE;
+        if (toolPtr->uFlags & TTF_CENTERTIP)
+        {
+            rect.left -= (size.cx / 2);
+            if (!(style & TTS_BALLOON))
+                rect.top  -= (size.cy / 2);
         }
-        else
+        infoPtr->bToolBelow = TRUE;
+
+        if (!(toolPtr->uFlags & TTF_ABSOLUTE))
         {
-            RECT rcTool;
+            if (style & TTS_BALLOON)
+                rect.left -= BALLOON_STEMINDENT;
+            else
+            {
+                RECT rcTool;
 
-		GetCursorPos ((LPPOINT)&rect);
-		if (style & TTS_BALLOON)
-		{
-                ptfx = rect.left;
-                if (rect.top - size.cy >= 0)
-                {
-                    rect.top -= size.cy;
-                    infoPtr->bToolBelow = FALSE;
-                }
+                if (toolPtr->uFlags & TTF_IDISHWND)
+                    GetWindowRect ((HWND)toolPtr->uId, &rcTool);
                 else
                 {
-                    infoPtr->bToolBelow = TRUE;
-                    rect.top += 20;
+                    rcTool = toolPtr->rect;
+                    MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
                 }
-                rect.left = max(0, rect.left - BALLOON_STEMINDENT);
-		}
-		else
-		{
-		rect.top += 20;
-		    infoPtr->bToolBelow = TRUE;
-            }
 
-            if (toolPtr->uFlags & TTF_CENTERTIP)
-            {
-                rect.left -= (size.cx / 2);
-                rect.top  -= (size.cy / 2);
-            }
-
-            if (toolPtr->uFlags & TTF_IDISHWND)
-                GetWindowRect ((HWND)toolPtr->uId, &rcTool);
-            else
-            {
-                rcTool = toolPtr->rect;
-                MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
+                /* smart placement */
+                if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
+                    (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
+                    rect.left = rcTool.right;
             }
-
-            /* smart placement */
-            if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
-                (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
-                rect.left = rcTool.right;
         }
     }
     else




More information about the wine-cvs mailing list