From 687aedf1ca99fce08575e9d1dd4fd83e3e2c34d6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Mar 2014 13:17:21 +0000 Subject: [PATCH] Skip mouse button release events in wxGenericTreeCtrl. Not doing this prevented the default handling from taking place resulting in internal confusion in GtkNotebook when wxTreeCtrl was placed inside it: the code there set the button being held by user in its mouse press event handler and reset it in its mouse release event handler which was never called because we didn't skip the event, resulting in ignoring the next mouse press in the notebook. Closes #16055. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectlg.cpp | 51 +++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 87d0733ce4..4637767193 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3696,39 +3696,46 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) #endif } } - else if ( (event.LeftUp() || event.RightUp()) && m_isDragging ) + else if ( event.LeftUp() || event.RightUp() ) { - ReleaseMouse(); - - // erase the highlighting - DrawDropEffect(m_dropTarget); - - if ( m_oldSelection ) + if ( m_isDragging ) { - m_oldSelection->SetHilight(true); - RefreshLine(m_oldSelection); - m_oldSelection = NULL; - } + ReleaseMouse(); - // generate the drag end event - wxTreeEvent eventEndDrag(wxEVT_TREE_END_DRAG, this, item); + // erase the highlighting + DrawDropEffect(m_dropTarget); - eventEndDrag.m_pointDrag = CalcScrolledPosition(pt); + if ( m_oldSelection ) + { + m_oldSelection->SetHilight(true); + RefreshLine(m_oldSelection); + m_oldSelection = NULL; + } - (void)GetEventHandler()->ProcessEvent(eventEndDrag); + // generate the drag end event + wxTreeEvent eventEndDrag(wxEVT_TREE_END_DRAG, this, item); - m_isDragging = false; - m_dropTarget = NULL; + eventEndDrag.m_pointDrag = CalcScrolledPosition(pt); - SetCursor(m_oldCursor); + (void)GetEventHandler()->ProcessEvent(eventEndDrag); + + m_isDragging = false; + m_dropTarget = NULL; + + SetCursor(m_oldCursor); #if defined( __WXMSW__ ) || defined(__WXMAC__) || defined(__WXGTK20__) - Update(); + Update(); #else - // TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI) - // instead (needs to be tested!) - wxYieldIfNeeded(); + // TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI) + // instead (needs to be tested!) + wxYieldIfNeeded(); #endif + } + else + { + event.Skip(); + } } else {