Comment 50 for bug 239462

Revision history for this message
In , Enn (enndeakin) wrote :

Comment on attachment 346420
Patch removing auto-hide timer so that tooltips hide on mousemove (with 7 pixel tolerance)

> NS_IMETHODIMP
> nsXULTooltipListener::MouseOut(nsIDOMEvent* aMouseEvent)
> {
...
> mTooltipTimer->Cancel();
> mTooltipTimer = nsnull;
> return NS_OK;
>+ } else {
>+ HideTooltip();
> }

Won't this hide the tooltip on any mouseout event? If someone puts a tooltip on a toolbar for instance, a mouseout event will fire every time someone moves the mouse out of an element.

>+ // filter out false win32 MouseMove event
> if (mMouseScreenX == newMouseX && mMouseScreenY == newMouseY)
>+ return NS_OK;
>+
>+ // filter out minor movements due to crappy optical mice and shaky hands
>+ // to prevent tooltips from hiding prematurely.
>+ nsCOMPtr<nsIContent> currentTooltip = do_QueryReferent(mCurrentTooltip);
>+
>+ if ((currentTooltip) &&
>+ (abs(mMouseScreenX - newMouseX) <= kTooltipMouseMoveTolerance) &&
>+ (abs(mMouseScreenY - newMouseY) <= kTooltipMouseMoveTolerance))

I don't see any reason to do this. Also, it won't work if someone moves the mouse slowly.

>+ // set a flag so that the tooltip is only displayed once until the mouse
>+ // leaves the node
>+ mTooltipShown = PR_TRUE;

The tooltip may not actually be shown though, if, for example, a popupshowing event prevents it or it's in a hidden tab. Better to do this at the end of LaunchTooltip where a check is done for the popup being open.