From c6525745f241962d7776b665b768b08d3c9cca09 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Mon, 19 Nov 2007 15:29:57 +0000 Subject: [PATCH] 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 | 79 ++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 52 deletions(-) diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 901abc0e151..8740b63f8f5 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; + + if (toolPtr->uFlags & TTF_CENTERTIP) { - 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; - } - 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; - } - else - { - infoPtr->bToolBelow = TRUE; - rect.top += 20; - } - 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.left -= (size.cx / 2); + if (!(style & TTS_BALLOON)) rect.top -= (size.cy / 2); - } + } + infoPtr->bToolBelow = TRUE; - if (toolPtr->uFlags & TTF_IDISHWND) - GetWindowRect ((HWND)toolPtr->uId, &rcTool); + if (!(toolPtr->uFlags & TTF_ABSOLUTE)) + { + if (style & TTS_BALLOON) + rect.left -= BALLOON_STEMINDENT; else { - rcTool = toolPtr->rect; - MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2); - } + RECT rcTool; - /* 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; + 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; + } } } else