wxWindow* g_MacLastWindow = NULL ;
+static EventMouseButton lastButton = 0 ;
+
static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
{
UInt32 modifiers = cEvent.GetParameter<UInt32>(kEventParamKeyModifiers, typeUInt32) ;
{
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
else
wxevent.SetEventType(wxEVT_MOTION ) ;
}
+ if ( cEvent.GetKind() == kEventMouseUp )
+ lastButton = 0 ;
}
ControlRef wxMacFindSubControl( Point location , ControlRef superControl , ControlPartCode *outPart )
adjustR.SetWidth( toplevelWindow->GetMinWidth() ) ;
if ( toplevelWindow->GetMinHeight() != -1 && adjustR.GetHeight() < toplevelWindow->GetMinHeight() )
adjustR.SetHeight( toplevelWindow->GetMinHeight() ) ;
- Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height - bottom , adjustR.x + adjustR.width - right } ;
+ const Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height - bottom , adjustR.x + adjustR.width - right } ;
if ( !EqualRect( &newRect , &adjustedRect ) )
- cEvent.SetParameter( kEventParamCurrentBounds , &adjustedRect ) ;
+ cEvent.SetParameter<Rect>( kEventParamCurrentBounds , &adjustedRect ) ;
}
result = noErr ;
wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ;
UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ;
+ m_peer = new wxMacControl() ;
#if TARGET_API_MAC_OSX
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of
// the content view, so we have to retrieve it explicitely
HIViewFindByID( HIViewGetRoot( (WindowRef) m_macWindow ) , kHIViewWindowContentID ,
- (ControlRef*)&m_macControl ) ;
+ *m_peer ) ;
+ if ( !m_peer->Ok() )
+ {
+ // compatibility mode fallback
+ GetRootControl( (WindowRef) m_macWindow , *m_peer ) ;
+ }
#else
- ::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ;
+ ::CreateRootControl( (WindowRef)m_macWindow , *m_peer ) ;
#endif
// the root control level handleer
MacInstallEventHandler() ;