diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2013-10-10 21:29:12 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2013-10-11 11:22:46 +0400 |
commit | 4feb6cd3e3d26ca2d6d3c458241aa467cd8d35b7 (patch) | |
tree | c3beb89324cd9ea009912fb5325690037e55c8a6 /Xwt.Gtk | |
parent | e7f611802d8cf6682bd1f8b14b25e5595b0f7195 (diff) |
[GTK] Canvas now doesn't clear the background
Canvas will now respect the bacground of the container on which it is
rendered as long as no mouse events are required.
Diffstat (limited to 'Xwt.Gtk')
-rw-r--r-- | Xwt.Gtk/Xwt.GtkBackend/CanvasBackend.cs | 7 | ||||
-rw-r--r-- | Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/CanvasBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/CanvasBackend.cs index 4c36301b..93d51069 100644 --- a/Xwt.Gtk/Xwt.GtkBackend/CanvasBackend.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/CanvasBackend.cs @@ -104,6 +104,7 @@ namespace Xwt.GtkBackend GtkWorkarounds.FixContainerLeak (this); WidgetFlags |= Gtk.WidgetFlags.AppPaintable; + VisibleWindow = false; } public void SetAllocation (Gtk.Widget w, Rectangle rect) @@ -146,9 +147,11 @@ namespace Xwt.GtkBackend if (!lastAllocation.Equals (allocation)) ((IWidgetSurface)Backend.Frontend).Reallocate (); lastAllocation = allocation; + var dx = VisibleWindow ? 0 : allocation.X; + var dy = VisibleWindow ? 0 : allocation.Y; foreach (var cr in children) { var r = cr.Value; - cr.Key.SizeAllocate (new Gdk.Rectangle ((int)r.X, (int)r.Y, (int)r.Width, (int)r.Height)); + cr.Key.SizeAllocate (new Gdk.Rectangle (dx + (int)r.X, dy + (int)r.Y, (int)r.Width, (int)r.Height)); } } @@ -181,6 +184,8 @@ namespace Xwt.GtkBackend } else { ctx.Context = Gdk.CairoHelper.Create (GdkWindow); } + if (!VisibleWindow) + ctx.Context.Translate (Allocation.X, Allocation.Y); return ctx; } } diff --git a/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs index 92557e5a..e6674420 100644 --- a/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs @@ -463,6 +463,10 @@ namespace Xwt.GtkBackend // widgets such as Label which doesn't have its own gdk window if (eventBox == null && EventsRootWidget.IsNoWindow) { + if (EventsRootWidget is Gtk.EventBox) { + ((Gtk.EventBox)EventsRootWidget).VisibleWindow = true; + return; + } eventBox = new Gtk.EventBox (); eventBox.Visible = Widget.Visible; eventBox.Sensitive = Widget.Sensitive; |