From: Vadim Zeitlin Date: Fri, 5 Mar 2010 23:56:47 +0000 (+0000) Subject: Don't stop dragging in the grid when the mouse leaves the window. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/98e956503de9035a6c4ef529da7e377b74d59b69 Don't stop dragging in the grid when the mouse leaves the window. Unexpected/unaccounted for mouse leaving and entering events stopped the drag operation currently in progress in wxGrid. And while it was resumed later, this resulted in the mouse being captured only twice but released only once. Fix this by ignoring the leaving and entering events and checking that we don't capture the mouse again. Closes #11662. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 45cfa65c3f..d0675c4d8a 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3765,6 +3765,8 @@ void wxGrid::DoGridDragEvent(wxMouseEvent& event, const wxGridCellCoords& coords if ( isFirstDrag ) { + wxASSERT_MSG( !m_winCapture, "shouldn't capture the mouse twice" ); + m_winCapture = m_gridWin; m_winCapture->CaptureMouse(); } @@ -3944,6 +3946,14 @@ wxGrid::DoGridMouseMoveEvent(wxMouseEvent& WXUNUSED(event), void wxGrid::ProcessGridCellMouseEvent(wxMouseEvent& event) { + if ( event.Entering() || event.Leaving() ) + { + // we don't care about these events but we must not reset m_isDragging + // if they happen so return before anything else is done + event.Skip(); + return; + } + const wxPoint pos = CalcUnscrolledPosition(event.GetPosition()); // coordinates of the cell under mouse @@ -3969,17 +3979,6 @@ void wxGrid::ProcessGridCellMouseEvent(wxMouseEvent& event) m_isDragging = false; m_startDragPos = wxDefaultPosition; - // VZ: if we do this, the mode is reset to WXGRID_CURSOR_SELECT_CELL - // immediately after it becomes WXGRID_CURSOR_RESIZE_ROW/COL under - // wxGTK -#if 0 - if ( event.Entering() || event.Leaving() ) - { - ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL); - m_gridWin->SetCursor( *wxSTANDARD_CURSOR ); - } -#endif // 0 - // deal with various button presses if ( event.IsButton() ) {