Index: Xsharp/InputOutputWidget.cs =================================================================== RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/InputOutputWidget.cs,v retrieving revision 1.11 diff -u -r1.11 InputOutputWidget.cs --- Xsharp/InputOutputWidget.cs 21 Sep 2005 23:29:33 -0000 1.11 +++ Xsharp/InputOutputWidget.cs 12 Oct 2005 00:44:04 -0000 @@ -41,6 +41,7 @@ internal InputOutputWidget nextExpose; private Region invalidateRegion; internal InputOutputWidget nextInvalidate; + private bool drawBackground = true; /// /// Constructs a new @@ -170,6 +171,30 @@ } /// + /// Get or set whether the background should be drawn before OnPaint is invoked. + /// + /// + /// + /// + /// + /// If this property is false, the background may not necessarily be drawn (by the server) + /// before the user painting commences. If this property is true, the background + /// is guaranteed to always be drawn by the server before user painting commences. + /// + /// + public bool DrawBackground + { + get + { + return drawBackground; + } + set + { + drawBackground = value; + } + } + + /// /// Get or set the foreground color for this widget. /// /// @@ -227,9 +252,7 @@ (display, window, ToPixel(value)); if(mapped && AncestorsMapped) { - Xlib.XClearArea(display, window, - 0, 0, (uint)0, (uint)0, - XBool.True); + Invalidate(); } } finally @@ -296,9 +319,7 @@ } if(mapped && AncestorsMapped) { - Xlib.XClearArea(display, window, - 0, 0, (uint)0, (uint)0, - XBool.True); + Invalidate(); } } finally @@ -478,13 +499,61 @@ // No point redrawing if we are unmapped. if(handle != XDrawable.Zero && mapped && AncestorsMapped) { - ClearRegion(region, XBool.True); + Invalidate(region); } - - // Dispose the region that we no longer require. - region.Dispose(); } } + + /* + *

Invalidate the whole widget and flush the request

+ */ + private void Invalidate() + { + Invalidate(0, 0, width, height); + } + + /* + *

Invalidate the given region and flush the request

+ */ + private void Invalidate(int x, int y, int width, int height) + { + Region region = new Region(); + + region.Union(x, y, width, height); + + Invalidate(region); + } + + /* + *

Invalidate the given region and flush the request

+ */ + private void Invalidate(Region region) + { + if (drawBackground) + { + ClearRegion(region, XBool.True); + } + else + { + /* Don't flush to the X server cause we don't want it to draw + the background */ + + region.Intersect(0, 0, width, height); + + if (exposeRegion == null) + { + exposeRegion = region; + + dpy.AddPendingExpose(this); + } + else + { + exposeRegion.Union(region); + + region.Dispose(); + } + } + } /// /// Process a color theme change for this widget. Index: System.Drawing.Xsharp/DrawingWindow.cs =================================================================== RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing.Xsharp/DrawingWindow.cs,v retrieving revision 1.29 diff -u -r1.29 DrawingWindow.cs --- System.Drawing.Xsharp/DrawingWindow.cs 21 Sep 2005 23:29:33 -0000 1.29 +++ System.Drawing.Xsharp/DrawingWindow.cs 12 Oct 2005 00:44:04 -0000 @@ -46,6 +46,7 @@ this.sink = sink; this.toolkit = toolkit; this.AutoMapChildren = false; + this.DrawBackground = false; }