From 86a9144fd0a042f0ecb6ebd0c748b5a33341159a Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 5 Jun 2004 16:29:07 +0000 Subject: [PATCH] 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 --- src/mac/carbon/toplevel.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 1770e2a08c..7a1976ac09 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -252,6 +252,8 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event wxWindow* g_MacLastWindow = NULL ; +static EventMouseButton lastButton = 0 ; + static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) { UInt32 modifiers = cEvent.GetParameter(kEventParamKeyModifiers, typeUInt32) ; @@ -275,6 +277,14 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) { 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 // this button @@ -328,6 +338,8 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) else wxevent.SetEventType(wxEVT_MOTION ) ; } + if ( cEvent.GetKind() == kEventMouseUp ) + lastButton = 0 ; } ControlRef wxMacFindSubControl( Point location , ControlRef superControl , ControlPartCode *outPart )