From d6fd667bc19986e20f7ca33976061d57d89bc41c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 31 May 2004 14:05:51 +0000 Subject: [PATCH] LocalToGlobal/GlobalToLocal Conversions with Carbon API, cleanup, hittesting corrected for 10.2 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/toplevel.cpp | 38 +++++++++---------------------------- src/mac/carbon/uma.cpp | 16 ---------------- 2 files changed, 9 insertions(+), 45 deletions(-) diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 2434341adf..b30de0aa6d 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -351,7 +351,7 @@ ControlRef wxMacFindSubControl( Point location , ControlRef superControl , Contr if ( IsControlVisible( sibling ) ) { Rect r ; - GetControlBounds( sibling , &r ) ; + UMAGetControlBoundsInWindowCoords( sibling , &r ) ; if ( MacPtInRect( location , &r ) ) { ControlHandle child = wxMacFindSubControl( location , sibling , outPart ) ; @@ -359,7 +359,12 @@ ControlRef wxMacFindSubControl( Point location , ControlRef superControl , Contr return child ; else { - *outPart = TestControl( sibling , location ) ; + Point testLocation = location ; +#if TARGET_API_MAC_OSX + testLocation.h -= r.left ; + testLocation.v -= r.top ; +#endif + *outPart = TestControl( sibling , testLocation ) ; return sibling ; } } @@ -397,12 +402,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev if ( window ) { - // calculate window relative coordinates - GrafPtr port; - ::GetPort( &port ) ; - ::SetPort( UMAGetWindowPort(window ) ) ; - ::GlobalToLocal( &windowMouseLocation ) ; - ::SetPort( port ) ; + QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ; if ( wxTheApp->s_captureWindow && wxTheApp->s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent ) { @@ -789,25 +789,6 @@ void wxTopLevelWindowMac::Maximize(bool maximize) wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ; wxMacWindowClipper clip (this); ZoomWindow( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , false ) ; -/* - Rect r ; - GDHandle device = NULL ; - verify_noerr( GetWindowGreatestAreaDevice( (WindowRef) m_macWindow , kWindowContentRgn , - &device , NULL ) ; - verify_noerr( GetAvailableWindowPositioningBounds( GetMainDevice() , &r ) ) ; - - Rect tempRect ; - GrafPtr port ; - GetPort( &port ) ; - Point pt = { 0, 0 } ; - SetPortWindowPort((WindowRef)m_macWindow) ; - LocalToGlobal( &pt ) ; - SetPort( port ) ; - - GetWindowPortBounds((WindowRef)m_macWindow, &tempRect ) ; - SetSize( pt.h , pt.v , tempRect.right-tempRect.left , - tempRect.bottom-tempRect.top, wxSIZE_USE_EXISTING); -*/ } bool wxTopLevelWindowMac::IsMaximized() const @@ -1223,8 +1204,7 @@ static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect) { GetWindowPortBounds(window, inRect); Point pt = {inRect->left, inRect->top}; - SetPort((GrafPtr) GetWindowPort(window)); - LocalToGlobal(&pt); + QDLocalToGlobalPoint( GetWindowPort(window) , &pt ) ; inRect->top = pt.v; inRect->left = pt.h; inRect->bottom += pt.v; diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index 8b81cbcebf..7e8542e4d5 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -636,22 +636,6 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow, return err ; } -// events -void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) -{ - wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) inWindow) ) ; - RgnHandle updateRgn = NewRgn() ; - GetWindowUpdateRgn( inWindow , updateRgn ) ; - - Point zero = { 0 , 0 } ; - LocalToGlobal( &zero ) ; - OffsetRgn( updateRgn , -zero.h , -zero.v ) ; - - UpdateControls( inWindow , inRgn ) ; - InvalWindowRgn( inWindow, updateRgn) ; - DisposeRgn( updateRgn ) ; -} - bool UMAIsWindowFloating( WindowRef inWindow ) { WindowClass cl ; -- 2.45.2