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
This commit is contained in:
Mattia Barbon
2006-10-15 15:51:35 +00:00
parent 653752be8a
commit 9fd8f2dd3d
2 changed files with 10 additions and 13 deletions

View File

@@ -2066,7 +2066,8 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y,
{ {
wxDC::DoSetClippingRegion( x, y, width, height ); 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()); SetDCClipping(temp.GetX11Region());
@@ -2086,16 +2087,14 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y,
void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region ) void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
{ {
wxRect box = region.GetBox();
wxDC::DoSetClippingRegion( box.x, box.y, box.width, box.height );
SetDCClipping(region.GetX11Region()); SetDCClipping(region.GetX11Region());
// Needs to work differently for Pixmap: without this, // Needs to work differently for Pixmap: without this,
// there's a nasty (Display*) m_display bug. 8/12/94 // there's a nasty (Display*) m_display bug. 8/12/94
if (m_window && m_window->GetBackingPixmap()) if (m_window && m_window->GetBackingPixmap())
{ {
wxRect box = region.GetBox();
XRectangle rects[1]; XRectangle rects[1];
rects[0].x = (short)XLOG2DEV_2(box.x); rects[0].x = (short)XLOG2DEV_2(box.x);
rects[0].y = (short)YLOG2DEV_2(box.y); rects[0].y = (short)YLOG2DEV_2(box.y);

View File

@@ -1259,10 +1259,10 @@ void wxWindow::DoSetSizeIntr(int x, int y, int width, int height,
if ( !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) if ( !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
{ {
if ( x == -1 ) if ( width == -1 )
x = oldX; width = oldW;
if ( y == -1 ) if ( height == -1 )
y = oldY; height = oldH;
} }
wxSize size(wxDefaultSize); wxSize size(wxDefaultSize);
@@ -1299,10 +1299,10 @@ void wxWindow::DoSetSizeIntr(int x, int y, int width, int height,
{ {
int flags = 0; int flags = 0;
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (x != oldX)
flags |= wxMOVE_X; flags |= wxMOVE_X;
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (y != oldY)
flags |= wxMOVE_Y; flags |= wxMOVE_Y;
if (width > 0) if (width > 0)
@@ -1429,8 +1429,6 @@ void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h,
} }
else else
{ {
if( xx < 0 ) xx = 0;
if( yy < 0 ) yy = 0;
if( w < 1 ) w = 1; if( w < 1 ) w = 1;
if( h < 1 ) h = 1; if( h < 1 ) h = 1;