From: Stefan Csomor Date: Mon, 29 Mar 2004 14:56:22 +0000 (+0000) Subject: Update Region is not always correct, we use the visible region therefore X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1e8cde71c0a0790ae144d8cc38fe7ab6e25157f0?ds=inline Update Region is not always correct, we use the visible region therefore git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26459 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index f5bfbfaab2..e97959731f 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -133,7 +133,19 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl { case kEventControlDraw : { - RgnHandle updateRgn = cEvent.GetParameter(kEventParamRgnHandle) ; + RgnHandle updateRgn = NULL ; + + wxRegion visRegion = thisWindow->MacGetVisibleRegion() ; + if ( cEvent.GetParameter(kEventParamRgnHandle, &updateRgn) != noErr ) + { + updateRgn = (RgnHandle) visRegion.GetWXHRGN() ; + } + else + { + // unfortunately this update region may be incorrect (tree ctrl sample ) + // so we have to reset it + updateRgn = (RgnHandle) visRegion.GetWXHRGN() ; + } // GrafPtr myport = cEvent.GetParameter(kEventParamGrafPort,typeGrafPtr) ; #if 0 // in case we would need a coregraphics compliant background erase first @@ -1694,7 +1706,15 @@ void wxWindowMac::GetTextExtent(const wxString& string, int *x, int *y, void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect) { #if TARGET_API_MAC_OSX - HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ; + if ( rect == NULL ) + HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ; + else + { + RgnHandle update = NewRgn() ; + SetRectRgn( update , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ; + SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ; + HIViewSetNeedsDisplayInRegion( (ControlRef) m_macControl , update , true ) ; + } #else if ( IsControlVisible( (ControlRef) m_macControl ) ) { @@ -2297,6 +2317,10 @@ wxRegion wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures ) */ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) { + // we let the OS handle root control redraws + if ( m_macControl == MacGetTopLevelWindow()->GetHandle() ) + return false ; + RgnHandle updatergn = (RgnHandle) updatergnr ; bool handled = false ;