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
This commit is contained in:
Vadim Zeitlin
2010-03-05 23:56:47 +00:00
parent 2d6bba4118
commit 98e956503d

View File

@@ -3765,6 +3765,8 @@ void wxGrid::DoGridDragEvent(wxMouseEvent& event, const wxGridCellCoords& coords
if ( isFirstDrag ) if ( isFirstDrag )
{ {
wxASSERT_MSG( !m_winCapture, "shouldn't capture the mouse twice" );
m_winCapture = m_gridWin; m_winCapture = m_gridWin;
m_winCapture->CaptureMouse(); m_winCapture->CaptureMouse();
} }
@@ -3944,6 +3946,14 @@ wxGrid::DoGridMouseMoveEvent(wxMouseEvent& WXUNUSED(event),
void wxGrid::ProcessGridCellMouseEvent(wxMouseEvent& 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()); const wxPoint pos = CalcUnscrolledPosition(event.GetPosition());
// coordinates of the cell under mouse // coordinates of the cell under mouse
@@ -3969,17 +3979,6 @@ void wxGrid::ProcessGridCellMouseEvent(wxMouseEvent& event)
m_isDragging = false; m_isDragging = false;
m_startDragPos = wxDefaultPosition; 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 // deal with various button presses
if ( event.IsButton() ) if ( event.IsButton() )
{ {