+ wxRegion visRgn = MacGetVisibleRegion( false ) ;
+ int top = 0 , left = 0 ;
+ MacWindowToRootWindow( &left , &top ) ;
+ WindowRef rootWindow = (WindowRef) MacGetRootWindow() ;
+ RgnHandle updateRgn = NewRgn() ;
+ // getting the update region in macos local coordinates
+ GetWindowUpdateRgn( rootWindow , updateRgn ) ;
+ GrafPtr port ;
+ ::GetPort( &port ) ;
+ ::SetPort( UMAGetWindowPort( rootWindow ) ) ;
+ Point pt = {0,0} ;
+ LocalToGlobal( &pt ) ;
+ ::SetPort( port ) ;
+ OffsetRgn( updateRgn , -pt.h , -pt.v ) ;
+ // translate to window local coordinates
+ OffsetRgn( updateRgn , -left , -top ) ;
+ SectRgn( updateRgn , (RgnHandle) visRgn.GetWXHRGN() , updateRgn ) ;
+ MacRedraw( updateRgn , 0 , true ) ;
+ // for flushing and validating we need macos-local coordinates again
+ OffsetRgn( updateRgn , left , top ) ;