The hover item was not reset properly in some circumstances, do it now.
Also check for the item being disabled in SetHoverItem() itself instead of
doing it several times before calling it.
Closes #14189.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71210
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void wxAuiToolBar::SetHoverItem(wxAuiToolBarItem* pitem)
{
void wxAuiToolBar::SetHoverItem(wxAuiToolBarItem* pitem)
{
+ if (pitem && (pitem->m_state & wxAUI_BUTTON_STATE_DISABLED))
+ pitem = NULL;
+
wxAuiToolBarItem* former_hover = NULL;
size_t i, count;
wxAuiToolBarItem* former_hover = NULL;
size_t i, count;
if(!GetEventHandler()->ProcessEvent(e) || e.GetSkipped())
CaptureMouse();
if(!GetEventHandler()->ProcessEvent(e) || e.GetSkipped())
CaptureMouse();
+ // Ensure hovered item is really ok, as mouse may have moved during
+ // event processing
+ wxPoint cursor_pos_after_evt = ScreenToClient(wxGetMousePosition());
+ SetHoverItem(FindToolByPosition(cursor_pos_after_evt.x, cursor_pos_after_evt.y));
+
- wxAuiToolBarItem* hitItem = FindToolByPosition(evt.GetX(), evt.GetY());
- if (hitItem && !(hitItem->m_state & wxAUI_BUTTON_STATE_DISABLED))
- {
- SetHoverItem(hitItem);
- }
+ wxAuiToolBarItem* hitItem;
+ hitItem = FindToolByPosition(evt.GetX(), evt.GetY());
+ SetHoverItem(hitItem);
ReleaseMouse();
GetEventHandler()->ProcessEvent(e);
ReleaseMouse();
GetEventHandler()->ProcessEvent(e);
+
+ // Ensure hovered item is really ok, as mouse may have moved during
+ // event processing
+ wxPoint cursor_pos_after_evt = ScreenToClient(wxGetMousePosition());
+ SetHoverItem(FindToolByPosition(cursor_pos_after_evt.x, cursor_pos_after_evt.y));
+
- if (hitItem && (hitItem->m_state & wxAUI_BUTTON_STATE_DISABLED))
- SetHoverItem(NULL);
- else
- SetHoverItem(hitItem);
// tooltips handling
wxAuiToolBarItem* packingHitItem;
// tooltips handling
wxAuiToolBarItem* packingHitItem;