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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remember value of g_lastButton for later click count adjustment
|
||||||
|
UInt32 prevLastButton = g_lastButton;
|
||||||
|
|
||||||
// a control click is interpreted as a right click
|
// a control click is interpreted as a right click
|
||||||
bool thisButtonIsFakeRight = false ;
|
bool thisButtonIsFakeRight = false ;
|
||||||
if ( button == 0 && (modifiers & NSControlKeyMask) )
|
if ( button == 0 && (modifiers & NSControlKeyMask) )
|
||||||
@@ -567,10 +570,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
|||||||
thisButtonIsFakeRight = true ;
|
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
|
// 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
|
// mouse down, moved and mouse up, and does not deliver a right down and left up
|
||||||
switch (eventType)
|
switch (eventType)
|
||||||
@@ -591,6 +590,22 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
|||||||
else if ( g_lastButton == 1 && g_lastButtonWasFakeRight )
|
else if ( g_lastButton == 1 && g_lastButtonWasFakeRight )
|
||||||
button = g_lastButton ;
|
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
|
// Adjust the chord mask to remove the primary button and add the
|
||||||
// secondary button. It is possible that the secondary button is
|
// secondary button. It is possible that the secondary button is
|
||||||
// already pressed, e.g. on a mouse connected to a laptop, but this
|
// 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 NSLeftMouseDown :
|
||||||
case NSRightMouseDown :
|
case NSRightMouseDown :
|
||||||
case NSOtherMouseDown :
|
case NSOtherMouseDown :
|
||||||
clickCount = [nsEvent clickCount];
|
|
||||||
switch ( button )
|
switch ( button )
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
@@ -634,7 +648,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
|||||||
case NSLeftMouseUp :
|
case NSLeftMouseUp :
|
||||||
case NSRightMouseUp :
|
case NSRightMouseUp :
|
||||||
case NSOtherMouseUp :
|
case NSOtherMouseUp :
|
||||||
clickCount = [nsEvent clickCount];
|
|
||||||
switch ( button )
|
switch ( button )
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
|
Reference in New Issue
Block a user