]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix setting the clipping region for a DC when the region is an
authorMattia Barbon <mbarbon@cpan.org>
Sun, 15 Oct 2006 15:51:35 +0000 (15:51 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Sun, 15 Oct 2006 15:51:35 +0000 (15:51 +0000)
actual wxRegion.
  Fix some positioning/sizing bugs, mosting affecting controls
inside scrolled windows.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42033 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/motif/dcclient.cpp
src/motif/window.cpp

index 285e7622d7f6d5299253138843307196b68bf1ba..cb3cfbee407b9be8f46a40191b5796e078e04bc6 100644 (file)
@@ -2066,7 +2066,8 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y,
 {
     wxDC::DoSetClippingRegion( x, y, width, height );
 
-    wxRegion temp(x, y, width, height);
+    wxRegion temp(XLOG2DEV(x), YLOG2DEV(y),
+                  XLOG2DEVREL(width), YLOG2DEVREL(height));
 
     SetDCClipping(temp.GetX11Region());
 
@@ -2086,16 +2087,14 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y,
 
 void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
 {
-    wxRect box = region.GetBox();
-
-    wxDC::DoSetClippingRegion( box.x, box.y, box.width, box.height );
-
     SetDCClipping(region.GetX11Region());
 
     // Needs to work differently for Pixmap: without this,
     // there's a nasty (Display*) m_display bug. 8/12/94
     if (m_window && m_window->GetBackingPixmap())
     {
+        wxRect box = region.GetBox();
+
         XRectangle rects[1];
         rects[0].x = (short)XLOG2DEV_2(box.x);
         rects[0].y = (short)YLOG2DEV_2(box.y);
index 720aff4a408ade01a8f10b1d302fc588e8a02b1f..5f84cf14425131422eab110b180b54d82324acab 100644 (file)
@@ -1259,10 +1259,10 @@ void wxWindow::DoSetSizeIntr(int x, int y, int width, int height,
 
     if ( !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
     {
-        if ( x == -1 )
-            x = oldX;
-        if ( y == -1 )
-            y = oldY;
+        if ( width == -1 )
+            width = oldW;
+        if ( height == -1 )
+            height = oldH;
     }
 
     wxSize size(wxDefaultSize);
@@ -1299,10 +1299,10 @@ void wxWindow::DoSetSizeIntr(int x, int y, int width, int height,
         {
             int flags = 0;
 
-            if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+            if (x != oldX)
                 flags |= wxMOVE_X;
 
-            if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+            if (y != oldY)
                 flags |= wxMOVE_Y;
 
             if (width > 0)
@@ -1429,8 +1429,6 @@ void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h,
     }
     else
     {
-        if( xx < 0 ) xx = 0;
-        if( yy < 0 ) yy = 0;
         if( w < 1 ) w = 1;
         if( h < 1 ) h = 1;