X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/73fe67bd60b57f95dc63809f7843ed2a15928436..5fc01d1326a34223746546326a7f616df8bfa991:/src/mac/carbon/window.cpp?ds=sidebyside diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 28e556b17d..01521d2df9 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 @@ -1361,7 +1373,9 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) wxSize wxWindowMac::DoGetBestSize() const { - /* + if ( m_macIsUserPane || IsTopLevel() ) + return wxWindowBase::DoGetBestSize() ; + Rect bestsize = { 0 , 0 , 0 , 0 } ; short baselineoffset ; int bestWidth, bestHeight ; @@ -1393,8 +1407,7 @@ wxSize wxWindowMac::DoGetBestSize() const bestHeight = 13 ; return wxSize(bestWidth, bestHeight); - */ - return wxWindowBase::DoGetBestSize() ; +// return wxWindowBase::DoGetBestSize() ; } @@ -1417,7 +1430,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags) // ... and don't do anything (avoiding flicker) if it's already ok if ( x == currentX && y == currentY && - width == currentW && height == currentH ) + width == currentW && height == currentH && ( height != -1 && width != -1 ) ) { // TODO REMOVE MacRepositionScrollBars() ; // we might have a real position shift @@ -1694,7 +1707,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 +2318,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 ;