From 9fd8f2dd3df305448a0c2d56508c04e26385a76d Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Sun, 15 Oct 2006 15:51:35 +0000 Subject: [PATCH] Fix setting the clipping region for a DC when the region is an 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 | 9 ++++----- src/motif/window.cpp | 14 ++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 285e7622d7..cb3cfbee40 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -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); diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 720aff4a40..5f84cf1442 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -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; -- 2.47.2