Cache the lastMousedOverItem before showing tooltip.

Optimization, only update the tooltip if not the same as the cached
last moused over item. That way the same application name won't
keep getting set over and over again.
This commit is contained in:
John Scipione 2012-04-24 21:14:47 -04:00
parent 1f0c9f183e
commit f73d1f4f28
2 changed files with 10 additions and 3 deletions

View File

@ -395,12 +395,18 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message)
_FinishedDrag();
if (code == B_INSIDE_VIEW) {
// set the tooltip
TTeamMenuItem* item = TeamItemAtPoint(where);
if (item != NULL && !item->DrawLabel() && item->Name() != '\0')
SetToolTip(item->Name());
if (item != NULL) {
if (!item->DrawLabel() && item != fLastMousedOverItem) {
// set the tooltip
SetToolTip(item->Name());
} else
fLastMousedOverItem = item;
}
}
fLastMousedOverItem = NULL;
BMenuBar::MouseMoved(where, code, message);
return;
}

View File

@ -109,6 +109,7 @@ class TExpandoMenuBar : public BMenuBar {
TTeamMenuItem* fSeparatorItem;
TTeamMenuItem* fPreviousDragTargetItem;
TTeamMenuItem* fLastMousedOverItem;
BMenuItem* fLastClickItem;
static bool sDoMonitor;