diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp index 00343741aa..593a7b0fa8 100644 --- a/src/apps/deskbar/ExpandoMenuBar.cpp +++ b/src/apps/deskbar/ExpandoMenuBar.cpp @@ -45,6 +45,7 @@ All rights reserved. #include #include #include +#include #include "BarApp.h" #include "BarMenuTitle.h" @@ -395,19 +396,43 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message) // force a cleanup _FinishedDrag(); - if (code == B_INSIDE_VIEW) { - TTeamMenuItem* item = TeamItemAtPoint(where); + switch (code) { + case B_ENTERED_VIEW: + case B_INSIDE_VIEW: + { + TTeamMenuItem* item = TeamItemAtPoint(where); + if (item == NULL) { + // item is NULL, break out + fLastMousedOverItem = NULL; + break; + } - if (item != NULL) { - if (!item->DrawLabel() && item != fLastMousedOverItem) { - // set the tooltip - SetToolTip(item->Name()); - } else + if (item->HasLabel()) { + // item has a visible label, set the item and break out fLastMousedOverItem = item; + break; + } + + if (item == fLastMousedOverItem) { + // already set the tooltip for this item, break out + break; + } + + // new item, update the tooltip with the item name + SetToolTip(item->Name()); + + // save the current item for the next MouseMoved() call + fLastMousedOverItem = item; + + break; } + + case B_OUTSIDE_VIEW: + case B_EXITED_VIEW: + fLastMousedOverItem = NULL; + break; } - fLastMousedOverItem = NULL; BMenuBar::MouseMoved(where, code, message); return; } diff --git a/src/apps/deskbar/TeamMenuItem.cpp b/src/apps/deskbar/TeamMenuItem.cpp index 43eeed0cc8..c98b455027 100644 --- a/src/apps/deskbar/TeamMenuItem.cpp +++ b/src/apps/deskbar/TeamMenuItem.cpp @@ -171,14 +171,14 @@ TTeamMenuItem::SetOverrideSelected(bool selected) bool -TTeamMenuItem::DrawLabel() const +TTeamMenuItem::HasLabel() const { return fDrawLabel; } void -TTeamMenuItem::SetDrawLabel(bool drawLabel) +TTeamMenuItem::SetHasLabel(bool drawLabel) { fDrawLabel = drawLabel; } diff --git a/src/apps/deskbar/TeamMenuItem.h b/src/apps/deskbar/TeamMenuItem.h index 1e242a91ec..9ae1ed1548 100644 --- a/src/apps/deskbar/TeamMenuItem.h +++ b/src/apps/deskbar/TeamMenuItem.h @@ -64,8 +64,8 @@ class TTeamMenuItem : public BMenuItem { void SetOverrideHeight(float height); void SetOverrideSelected(bool selected); - bool DrawLabel() const; - void SetDrawLabel(bool drawLabel); + bool HasLabel() const; + void SetHasLabel(bool drawLabel); bool IsExpanded(); void ToggleExpandState(bool resizeWindow);