X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/30e77b5c9ff09da4e65445d3a03081d375f49845..6ac23e25b85468c7885f6ab43ca0a45f6458af2e:/src/mac/carbon/utils.cpp diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index 4c829e6ca5..69a34ceec5 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -50,9 +50,13 @@ #include #endif +#ifdef __DARWIN__ +#include +#else #include #include #include +#endif #endif // wxUSE_GUI #include "wx/mac/private.h" // includes mac headers @@ -93,7 +97,7 @@ static int DoGetOSVersion(int *majorVsn, int *minorVsn) // debugging support // ---------------------------------------------------------------------------- -#if defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400) +#if defined(__WXDEBUG__) && defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400) // MetroNub stuff doesn't seem to work in CodeWarrior 5.3 Carbon builds... @@ -1107,10 +1111,25 @@ void wxMacControl::SetDrawingEnabled( bool enable ) bool wxMacControl::GetNeedsDisplay() const { #if TARGET_API_MAC_OSX - return HIViewGetNeedsDisplay( m_controlRef ) ; -#else - return false ; + if ( m_isCompositing ) + { + return HIViewGetNeedsDisplay( m_controlRef ) ; + } + else #endif + { + if ( !IsVisible() ) + return false ; + + Rect controlBounds ; + GetControlBounds( m_controlRef, &controlBounds ) ; + RgnHandle rgn = NewRgn() ; + GetWindowRegion ( GetControlOwner( m_controlRef ) , kWindowUpdateRgn , rgn ) ; + Boolean intersect = RectInRgn ( &controlBounds , rgn ) ; + DisposeRgn( rgn ) ; + return intersect ; + } + } #endif @@ -1223,6 +1242,8 @@ void wxMacControl::SetRect( Rect *r ) Rect controlBounds = *r ; + // since the rect passed in is always (even in non-compositing) relative + // to the (native) parent, we have to adjust to window relative here wxMacControl* parent = m_peer->GetParent()->GetPeer() ; if( parent->m_isRootControl == false ) { @@ -1351,12 +1372,29 @@ void wxMacControl::InvalidateWithChildren() #endif } -void wxMacControl::ScrollRect( const wxRect &r , int dx , int dy ) +void wxMacControl::ScrollRect( wxRect *r , int dx , int dy ) { + wxASSERT( r != NULL ) ; #if TARGET_API_MAC_OSX - HIRect scrollarea = CGRectMake( r.x , r.y , r.width , r.height) ; - HIViewScrollRect ( m_controlRef , &scrollarea , dx ,dy ) ; + if ( m_isCompositing ) + { + HIRect scrollarea = CGRectMake( r->x , r->y , r->width , r->height) ; + HIViewScrollRect ( m_controlRef , &scrollarea , dx ,dy ) ; + } + else #endif + { + Rect bounds ; + GetControlBounds( m_controlRef , &bounds ) ; + bounds.left += r->x ; + bounds.top += r->y ; + bounds.bottom = bounds.top + r->height ; + bounds.right = bounds.left + r->width ; + wxMacWindowClipper clip( m_peer ) ; + RgnHandle updateRgn = NewRgn() ; + ::ScrollRect( &bounds , dx , dy , updateRgn ) ; + InvalWindowRgn( GetControlOwner( m_controlRef ) , updateRgn ) ; + } }