From 47f6df12b31d3110e667186b53eef73bc69e74e5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 27 Sep 2014 16:12:34 +0000 Subject: [PATCH] Revert "Skip mouse button release events in wxGenericTreeCtrl." This reverts r76094 as it broke label editing in the control. See #16055, closes #16573. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectlg.cpp | 51 +++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index d0cd188fa1..a5e73c39c4 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3709,46 +3709,39 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) #endif } } - else if ( event.LeftUp() || event.RightUp() ) + else if ( (event.LeftUp() || event.RightUp()) && m_isDragging ) { - if ( m_isDragging ) + ReleaseMouse(); + + // erase the highlighting + DrawDropEffect(m_dropTarget); + + if ( m_oldSelection ) { - ReleaseMouse(); + m_oldSelection->SetHilight(true); + RefreshLine(m_oldSelection); + m_oldSelection = NULL; + } - // erase the highlighting - DrawDropEffect(m_dropTarget); + // generate the drag end event + wxTreeEvent eventEndDrag(wxEVT_TREE_END_DRAG, this, item); - if ( m_oldSelection ) - { - m_oldSelection->SetHilight(true); - RefreshLine(m_oldSelection); - m_oldSelection = NULL; - } + eventEndDrag.m_pointDrag = CalcScrolledPosition(pt); - // generate the drag end event - wxTreeEvent eventEndDrag(wxEVT_TREE_END_DRAG, this, item); + (void)GetEventHandler()->ProcessEvent(eventEndDrag); - eventEndDrag.m_pointDrag = CalcScrolledPosition(pt); + m_isDragging = false; + m_dropTarget = NULL; - (void)GetEventHandler()->ProcessEvent(eventEndDrag); - - m_isDragging = false; - m_dropTarget = NULL; - - SetCursor(m_oldCursor); + 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 {