[gtk+] viewport: Clip contents properly when called via gtk_widget_draw()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] viewport: Clip contents properly when called via gtk_widget_draw()
- Date: Tue, 5 Oct 2010 21:23:47 +0000 (UTC)
commit 04c630d0fd713a683e6a1eb8f3bd7fb9c70a2b1d
Author: Benjamin Otte <otte redhat com>
Date: Tue Oct 5 23:22:25 2010 +0200
viewport: Clip contents properly when called via gtk_widget_draw()
gtk/gtkviewport.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 7f24b54..5988682 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -784,6 +784,21 @@ gtk_viewport_draw (GtkWidget *widget,
gdk_window_get_height (gtk_widget_get_window (widget)));
}
+ if (gtk_cairo_should_draw_window (cr, priv->view_window))
+ {
+ /* This is a cute hack to ensure the contents of bin_window are
+ * restricted to where they are visible. We only need to do this
+ * clipping when called via gtk_widget_draw() and not in expose
+ * events. And when that happens every window (including this one)
+ * should be drawn.
+ */
+ gdk_window_get_position (priv->view_window, &x, &y);
+ cairo_rectangle (cr, x, y,
+ gdk_window_get_width (priv->view_window),
+ gdk_window_get_height (priv->view_window));
+ cairo_clip (cr);
+ }
+
if (gtk_cairo_should_draw_window (cr, priv->bin_window))
{
gdk_window_get_position (priv->bin_window, &x, &y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]