Revision 59305 broke click count adjustment with the result that a right-click after a left-click is reported as double-click.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Tim Kosse 2014-08-28 12:29:21 +00:00
parent bd3ff6928e
commit 1124c57a6d

View File

@ -567,6 +567,9 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
break;
}
// Remember value of g_lastButton for later click count adjustment
UInt32 prevLastButton = g_lastButton;
// a control click is interpreted as a right click
bool thisButtonIsFakeRight = false ;
if ( button == 0 && (modifiers & NSControlKeyMask) )
@ -575,10 +578,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
thisButtonIsFakeRight = true ;
}
// otherwise we report double clicks by connecting a left click with a ctrl-left click
if ( clickCount > 1 && button != g_lastButton )
clickCount = 1 ;
// we must make sure that our synthetic 'right' button corresponds in
// mouse down, moved and mouse up, and does not deliver a right down and left up
switch (eventType)
@ -599,6 +598,22 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
else if ( g_lastButton == 1 && g_lastButtonWasFakeRight )
button = g_lastButton ;
// Adjust click count when clicking with different buttons,
// otherwise we report double clicks by connecting a left click with a ctrl-left click
switch (eventType)
{
case NSLeftMouseDown :
case NSRightMouseDown :
case NSOtherMouseDown :
case NSLeftMouseUp :
case NSRightMouseUp :
case NSOtherMouseUp :
clickCount = [nsEvent clickCount];
if ( clickCount > 1 && button != prevLastButton )
clickCount = 1 ;
break;
}
// Adjust the chord mask to remove the primary button and add the
// secondary button. It is possible that the secondary button is
// already pressed, e.g. on a mouse connected to a laptop, but this
@ -619,7 +634,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
case NSLeftMouseDown :
case NSRightMouseDown :
case NSOtherMouseDown :
clickCount = [nsEvent clickCount];
switch ( button )
{
case 0 :
@ -642,7 +656,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
case NSLeftMouseUp :
case NSRightMouseUp :
case NSOtherMouseUp :
clickCount = [nsEvent clickCount];
switch ( button )
{
case 0 :