From f73d1f4f28fd80835f299830063a61a3ee3e3efd Mon Sep 17 00:00:00 2001 From: John Scipione Date: Tue, 24 Apr 2012 21:14:47 -0400 Subject: [PATCH] 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. --- src/apps/deskbar/ExpandoMenuBar.cpp | 12 +++++++++--- src/apps/deskbar/ExpandoMenuBar.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp index 7b4f0c5fc5..eecb285ea9 100644 --- a/src/apps/deskbar/ExpandoMenuBar.cpp +++ b/src/apps/deskbar/ExpandoMenuBar.cpp @@ -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; } diff --git a/src/apps/deskbar/ExpandoMenuBar.h b/src/apps/deskbar/ExpandoMenuBar.h index 8e5c990bb8..a0fbfdf737 100644 --- a/src/apps/deskbar/ExpandoMenuBar.h +++ b/src/apps/deskbar/ExpandoMenuBar.h @@ -109,6 +109,7 @@ class TExpandoMenuBar : public BMenuBar { TTeamMenuItem* fSeparatorItem; TTeamMenuItem* fPreviousDragTargetItem; + TTeamMenuItem* fLastMousedOverItem; BMenuItem* fLastClickItem; static bool sDoMonitor;