From: Stefan Csomor Date: Mon, 31 May 2004 14:49:20 +0000 (+0000) Subject: fixes for mouse handling on 10.2 systems X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3a9dc0619f7873947269dc29bd7410f4f80d4f34 fixes for mouse handling on 10.2 systems git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index b30de0aa6d..e97fc6b17a 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -509,7 +509,11 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) ) { EventModifiers modifiers = cEvent.GetParameter(kEventParamKeyModifiers, typeUInt32) ; - HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , windowMouseLocation , + Point clickLocation = windowMouseLocation ; +#if TARGET_API_MAC_OSX + currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ; +#endif + HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation , modifiers , (ControlActionUPP ) -1 ) ; result = noErr ; } @@ -968,14 +972,14 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ; - if ( m_macUsesCompositing ) - { - ::GetRootControl( (WindowRef)m_macWindow, (ControlRef*)&m_macControl ) ; - } - else - { - ::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ; - } +#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 ) ; +#else + ::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ; +#endif // the root control level handleer MacInstallEventHandler() ;