+ if ( m_peer == NULL )
+ return ;
+
+ bool vis = MacIsReallyShown() ;
+ if ( !vis )
+ return ;
+
+ int outerBorder = MacGetLeftBorderSize() ;
+ if ( m_peer->NeedsFocusRect() && m_peer->HasFocus() )
+ outerBorder += 4 ;
+
+ if ( outerBorder == 0 )
+ return ;
+
+ // now we know that we have something to do at all
+
+ // as the borders are drawn on the parent we have to properly invalidate all these areas
+ RgnHandle updateInner = NewRgn() ,
+ updateOuter = NewRgn() ;
+
+ // this rectangle is in HIViewCoordinates under OSX and in Window Coordinates under Carbon
+ Rect rect ;
+ m_peer->GetRect( &rect ) ;
+ RectRgn( updateInner , &rect ) ;
+ InsetRect( &rect , -outerBorder , -outerBorder ) ;
+ RectRgn( updateOuter , &rect ) ;
+ DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+#ifdef __WXMAC_OSX__
+ GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ;
+#else
+ WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ;
+ if ( tlw )
+ InvalWindowRgn( tlw , updateOuter ) ;
+#endif
+ DisposeRgn(updateOuter) ;
+ DisposeRgn(updateInner) ;
+/*
+ RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() ;
+ RectRgn( updateInner , &rect ) ;
+ InsetRect( &rect , -4 , -4 ) ;
+ RectRgn( updateOuter , &rect ) ;
+ DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+ wxPoint parent(0,0);
+ GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
+ parent -= GetParent()->GetClientAreaOrigin() ;
+ OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
+ GetParent()->m_peer->SetNeedsDisplay( true , updateOuter ) ;
+ DisposeRgn(updateOuter) ;
+ DisposeRgn(updateInner) ;
+*/
+/*
+ if ( m_peer )
+ {
+ // deleting a window while it is shown invalidates the region occupied by border or
+ // focus
+
+ if ( IsShown() && ( outerBorder > 0 ) )
+ {
+ // as the borders are drawn on the parent we have to properly invalidate all these areas
+ RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
+
+ Rect rect ;
+
+ m_peer->GetRect( &rect ) ;
+ RectRgn( updateInner , &rect ) ;
+ InsetRect( &rect , -outerBorder , -outerBorder ) ;
+ RectRgn( updateOuter , &rect ) ;
+ DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+ wxPoint parent(0,0);
+ GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
+ parent -= GetParent()->GetClientAreaOrigin() ;
+ OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
+ CopyRgn( updateOuter , updateTotal ) ;
+
+ GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
+ DisposeRgn(updateOuter) ;
+ DisposeRgn(updateInner) ;
+ DisposeRgn(updateTotal) ;
+ }
+ }
+*/
+#if 0
+ Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ;
+
+ int outerBorder = MacGetLeftBorderSize() ;
+ if ( m_peer->NeedsFocusRect() && m_peer->HasFocus() )
+ outerBorder += 4 ;
+
+ if ( vis && ( outerBorder > 0 ) )
+ {
+ // as the borders are drawn on the parent we have to properly invalidate all these areas
+ RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
+
+ Rect rect ;
+
+ m_peer->GetRect( &rect ) ;
+ RectRgn( updateInner , &rect ) ;
+ InsetRect( &rect , -outerBorder , -outerBorder ) ;
+ RectRgn( updateOuter , &rect ) ;
+ DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+ /*
+ wxPoint parent(0,0);
+#if TARGET_API_MAC_OSX
+ // no offsetting needed when compositing
+#else
+ GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
+ parent -= GetParent()->GetClientAreaOrigin() ;
+ OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
+#endif
+ */
+ CopyRgn( updateOuter , updateTotal ) ;
+
+ rect = r ;
+ RectRgn( updateInner , &rect ) ;
+ InsetRect( &rect , -outerBorder , -outerBorder ) ;
+ RectRgn( updateOuter , &rect ) ;
+ DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+/*
+ OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
+*/
+ UnionRgn( updateOuter , updateTotal , updateTotal ) ;
+
+ GetParent()->m_peer->SetNeedsDisplay( updateTotal ) ;
+ DisposeRgn(updateOuter) ;
+ DisposeRgn(updateInner) ;
+ DisposeRgn(updateTotal) ;
+ }
+#endif
+}
+
+void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
+{
+ // this is never called for a toplevel window, so we know we have a parent