Fix handling right and middle clicks in vertical wxAuiToolBar

They were wrongly recognized as clicks on the overflow item due to the
hit test check being correct for horizontal toolbars only.

Fix this by using the same, simpler and much more obviously correct,
check that was already used for the left mouse button and just tests if
GetOverflowRect() contains the point.

Closes #26242.
This commit is contained in:
Vadim Zeitlin
2026-02-24 23:14:15 +01:00
parent d0405788c2
commit 00ebfc9275

View File

@@ -2850,16 +2850,10 @@ void wxAuiToolBar::OnRightDown(wxMouseEvent& evt)
return;
}
if (m_overflowSizerItem && m_art)
if (m_overflowSizerItem && m_overflowVisible && m_art)
{
int overflowSize = m_art->GetElementSizeForWindow(wxAUI_TBART_OVERFLOW_SIZE, this);
if (overflowSize > 0 &&
evt.m_x > cli_rect.width - overflowSize &&
evt.m_y >= 0 &&
evt.m_y < cli_rect.height)
{
if (GetOverflowRect().Contains(evt.GetX(), evt.GetY()))
return;
}
}
m_actionPos = wxPoint(evt.GetX(), evt.GetY());
@@ -2922,16 +2916,10 @@ void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt)
return;
}
if (m_overflowSizerItem && m_art)
if (m_overflowSizerItem && m_overflowVisible && m_art)
{
int overflowSize = m_art->GetElementSizeForWindow(wxAUI_TBART_OVERFLOW_SIZE, this);
if (overflowSize > 0 &&
evt.m_x > cli_rect.width - overflowSize &&
evt.m_y >= 0 &&
evt.m_y < cli_rect.height)
{
if (GetOverflowRect().Contains(evt.GetX(), evt.GetY()))
return;
}
}
m_actionPos = wxPoint(evt.GetX(), evt.GetY());