From 00ebfc927568fb948122ec4bebdd35adfb88598d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 24 Feb 2026 23:14:15 +0100 Subject: [PATCH] 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. --- src/aui/auibar.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index 5bcb6fd1be..0645776371 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -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());