]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/window.cpp
fixed size patch applied
[wxWidgets.git] / src / mac / carbon / window.cpp
index d0eb532d86e8c07566fa1dba338a0572a6b09912..12f493093a7377f9527a0c6ac8275e1b431b4fb3 100644 (file)
@@ -1606,10 +1606,50 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         }
 #endif
         bool vis = m_peer->IsVisible();
+    
+        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); 
+            GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
+            parent -= GetParent()->GetClientAreaOrigin() ;
+            OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
+            CopyRgn( updateOuter , updateTotal ) ; 
+    
+            rect = r ;
+            RectRgn( updateInner , &rect ) ;
+            InsetRect( &rect , -outerBorder , -outerBorder ) ;
+            RectRgn( updateOuter , &rect ) ;
+            DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+            wxPoint parentorig(0,0); 
+            GetParent()->MacWindowToRootWindow( &parentorig.x , &parentorig.y ) ;
+            parent -= GetParent()->GetClientAreaOrigin() ;
+            OffsetRgn( updateOuter , -parentorig.x , -parentorig.y ) ;
+            UnionRgn( updateOuter , updateTotal , updateTotal ) ; 
+
+            GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
+            DisposeRgn(updateOuter) ;
+            DisposeRgn(updateInner) ;
+            DisposeRgn(updateTotal) ;
+        }
 
         // the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
         if ( vis )
             m_peer->SetVisibility( false , true ) ;
+
         m_peer->SetRect( &r ) ; 
         if ( vis )
             m_peer->SetVisibility( true , true ) ;