]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't stop dragging in the grid when the mouse leaves the window.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Mar 2010 23:56:47 +0000 (23:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Mar 2010 23:56:47 +0000 (23:56 +0000)
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

src/generic/grid.cpp

index 45cfa65c3f9cb638b1076f8b494e4c00639c3c73..d0675c4d8a2215fc8821925136a9c8fee5c0b222 100644 (file)
@@ -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() )
     {