synching down and up events for the synthetic right mouse handling

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27651 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2004-06-05 16:29:07 +00:00
parent e996f50942
commit 86a9144fd0

View File

@ -252,6 +252,8 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
wxWindow* g_MacLastWindow = NULL ; wxWindow* g_MacLastWindow = NULL ;
static EventMouseButton lastButton = 0 ;
static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
{ {
UInt32 modifiers = cEvent.GetParameter<UInt32>(kEventParamKeyModifiers, typeUInt32) ; UInt32 modifiers = cEvent.GetParameter<UInt32>(kEventParamKeyModifiers, typeUInt32) ;
@ -276,6 +278,14 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
button = kEventMouseButtonSecondary ; button = kEventMouseButtonSecondary ;
} }
// 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
if ( cEvent.GetKind() == kEventMouseDown )
lastButton = button ;
else if ( lastButton )
button = lastButton ;
// determinate the correct down state, wx does not want a 'down' for a mouseUp event, while mac delivers // determinate the correct down state, wx does not want a 'down' for a mouseUp event, while mac delivers
// this button // this button
if ( button != 0 && cEvent.GetKind() != kEventMouseUp ) if ( button != 0 && cEvent.GetKind() != kEventMouseUp )
@ -328,6 +338,8 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
else else
wxevent.SetEventType(wxEVT_MOTION ) ; wxevent.SetEventType(wxEVT_MOTION ) ;
} }
if ( cEvent.GetKind() == kEventMouseUp )
lastButton = 0 ;
} }
ControlRef wxMacFindSubControl( Point location , ControlRef superControl , ControlPartCode *outPart ) ControlRef wxMacFindSubControl( Point location , ControlRef superControl , ControlPartCode *outPart )