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/branches/WX_3_0_BRANCH@77491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -559,6 +559,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) )
|
||||
@@ -567,10 +570,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)
|
||||
@@ -591,6 +590,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
|
||||
@@ -611,7 +626,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
||||
case NSLeftMouseDown :
|
||||
case NSRightMouseDown :
|
||||
case NSOtherMouseDown :
|
||||
clickCount = [nsEvent clickCount];
|
||||
switch ( button )
|
||||
{
|
||||
case 0 :
|
||||
@@ -634,7 +648,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
||||
case NSLeftMouseUp :
|
||||
case NSRightMouseUp :
|
||||
case NSOtherMouseUp :
|
||||
clickCount = [nsEvent clickCount];
|
||||
switch ( button )
|
||||
{
|
||||
case 0 :
|
||||
|
Reference in New Issue
Block a user