summaryrefslogtreecommitdiff
path: root/gtk/gtkhandlebox.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-09-14 16:42:16 +0200
committerBenjamin Otte <otte@redhat.com>2010-09-26 15:11:42 +0200
commit45744d9a5fa4e51963a3abc1793cabdb51e42211 (patch)
tree38853e6f18fcfbd2826ca7f794f531a94a74a31d /gtk/gtkhandlebox.c
parent0acec382c8deacabac089b70131e6ea531f936e1 (diff)
downloadgtk+-45744d9a5fa4e51963a3abc1793cabdb51e42211.tar.gz
Change semantics of the draw signal
Previously, we tried to move the context's origin to the widget's top left location, no matter what window the paint was happening on. Now we only do that for child windows of the widget's window and leave the context untouched for windows that the widget has created outside its own hierarchy. In those casses, we also don't clip the context to the widget's allocation. Includes fixes to GtkHandlebox for this effect and fixes all known issues with it. These semantics assume that gtk_widget_draw() should only draw the parts of a widget that are inside child windows and not draw stuff that is located in completely different GdkWindows. In the handlebox case, it means that it should only draw the handle when it is attached, but not when it isn't. We'll likely need a special draw function for the detached handlebox if we want to draw it.
Diffstat (limited to 'gtk/gtkhandlebox.c')
-rw-r--r--gtk/gtkhandlebox.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index 0cef90f51b..4253fb50e3 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -927,20 +927,13 @@ gtk_handle_box_paint (GtkWidget *widget,
GtkHandleBoxPrivate *priv = hb->priv;
GtkBin *bin = GTK_BIN (widget);
GtkWidget *child;
- gint x, y, width, height;
+ gint width, height;
GdkRectangle rect;
gint handle_position;
GtkOrientation handle_orientation;
handle_position = effective_handle_position (hb);
- cairo_save (cr);
-
- gdk_window_get_origin (gtk_widget_get_window (widget), &x, &y);
- cairo_translate (cr, -x, -y);
- gdk_window_get_origin (priv->bin_window, &x, &y);
- cairo_translate (cr, x, y);
-
gdk_drawable_get_size (priv->bin_window, &width, &height);
gtk_cairo_paint_box (gtk_widget_get_style (widget),
@@ -991,8 +984,6 @@ gtk_handle_box_paint (GtkWidget *widget,
rect.x, rect.y, rect.width, rect.height,
handle_orientation);
- cairo_restore (cr);
-
child = gtk_bin_get_child (bin);
if (child != NULL && gtk_widget_get_visible (child))
GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->draw (widget, cr);
@@ -1010,8 +1001,7 @@ gtk_handle_box_draw (GtkWidget *widget,
if (priv->child_detached)
gtk_handle_box_draw_ghost (hb, cr);
}
-
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
+ else if (gtk_cairo_should_draw_window (cr, priv->bin_window))
gtk_handle_box_paint (widget, cr);
return FALSE;