changing handling of mouse-down buttons according to patch 1749825
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47651 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -255,11 +255,15 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
|
|||||||
UInt32 modifiers = cEvent.GetParameter<UInt32>(kEventParamKeyModifiers, typeUInt32) ;
|
UInt32 modifiers = cEvent.GetParameter<UInt32>(kEventParamKeyModifiers, typeUInt32) ;
|
||||||
Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ;
|
Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ;
|
||||||
|
|
||||||
// this parameter are not given for all events
|
// these parameters are not given for all events
|
||||||
EventMouseButton button = 0 ;
|
EventMouseButton button = 0 ;
|
||||||
UInt32 clickCount = 0 ;
|
UInt32 clickCount = 0 ;
|
||||||
|
UInt32 mouseChord = 0;
|
||||||
|
|
||||||
cEvent.GetParameter<EventMouseButton>( kEventParamMouseButton, typeMouseButton , &button ) ;
|
cEvent.GetParameter<EventMouseButton>( kEventParamMouseButton, typeMouseButton , &button ) ;
|
||||||
cEvent.GetParameter<UInt32>( kEventParamClickCount, typeUInt32 , &clickCount ) ;
|
cEvent.GetParameter<UInt32>( kEventParamClickCount, typeUInt32 , &clickCount ) ;
|
||||||
|
// the chord is the state of the buttons pressed currently
|
||||||
|
cEvent.GetParameter<UInt32>( kEventParamMouseChord, typeUInt32 , &mouseChord ) ;
|
||||||
|
|
||||||
wxevent.m_x = screenMouseLocation.h;
|
wxevent.m_x = screenMouseLocation.h;
|
||||||
wxevent.m_y = screenMouseLocation.v;
|
wxevent.m_y = screenMouseLocation.v;
|
||||||
@@ -298,28 +302,19 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
|
|||||||
else if ( g_lastButton == kEventMouseButtonSecondary && g_lastButtonWasFakeRight )
|
else if ( g_lastButton == kEventMouseButtonSecondary && g_lastButtonWasFakeRight )
|
||||||
button = g_lastButton ;
|
button = g_lastButton ;
|
||||||
|
|
||||||
// determine the correct down state, wx does not want a 'down' for a mouseUp event,
|
// Adjust the chord mask to remove the primary button and add the
|
||||||
// while mac delivers this button
|
// secondary button. It is possible that the secondary button is
|
||||||
if ( button != 0 && cEvent.GetKind() != kEventMouseUp )
|
// already pressed, e.g. on a mouse connected to a laptop, but this
|
||||||
{
|
// possibility is ignored here:
|
||||||
switch ( button )
|
if( thisButtonIsFakeRight && ( mouseChord & 1U ) )
|
||||||
{
|
mouseChord = ((mouseChord & ~1U) | 2U);
|
||||||
case kEventMouseButtonPrimary :
|
|
||||||
|
if(mouseChord & 1U)
|
||||||
wxevent.m_leftDown = true ;
|
wxevent.m_leftDown = true ;
|
||||||
break ;
|
if(mouseChord & 2U)
|
||||||
|
|
||||||
case kEventMouseButtonSecondary :
|
|
||||||
wxevent.m_rightDown = true ;
|
wxevent.m_rightDown = true ;
|
||||||
break ;
|
if(mouseChord & 4U)
|
||||||
|
|
||||||
case kEventMouseButtonTertiary :
|
|
||||||
wxevent.m_middleDown = true ;
|
wxevent.m_middleDown = true ;
|
||||||
break ;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// translate into wx types
|
// translate into wx types
|
||||||
switch ( cEvent.GetKind() )
|
switch ( cEvent.GetKind() )
|
||||||
@@ -376,10 +371,14 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
|
|||||||
wxevent.m_linesPerAction = 1;
|
wxevent.m_linesPerAction = 1;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
case kEventMouseEntered :
|
||||||
default :
|
case kEventMouseExited :
|
||||||
|
case kEventMouseDragged :
|
||||||
|
case kEventMouseMoved :
|
||||||
wxevent.SetEventType( wxEVT_MOTION ) ;
|
wxevent.SetEventType( wxEVT_MOTION ) ;
|
||||||
break;
|
break;
|
||||||
|
default :
|
||||||
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user