diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2013-06-06 20:08:33 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2013-06-06 20:09:56 -0300 |
commit | 4e9fd1a6be45c708174e1ca62f1be2cf587cbd0a (patch) | |
tree | d218ac845dae5fa19a8d09797396f33bfcdcbd8e | |
parent | e82687bcc90c1122ecf376a790e9b366e2b69fcd (diff) | |
download | glade-4e9fd1a6be45c708174e1ca62f1be2cf587cbd0a.tar.gz |
Fixed drag icon rendering bug. for some reason we need a cairo save/restore
around our custom draw methods otherwise the children rendering get affected
by our modifications to the cairo matrix.
-rw-r--r-- | gladeui/glade-design-layout.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c index 1d39521b..6b844843 100644 --- a/gladeui/glade-design-layout.c +++ b/gladeui/glade-design-layout.c @@ -1902,7 +1902,7 @@ glade_design_layout_finalize (GObject *object) } static gboolean -on_drag_icon_draw (GtkWidget *widget, cairo_t *cr, GladeDesignLayout *layout) +on_drag_icon_draw (GtkWidget *widget, cairo_t *cr) { GtkStyleContext *context = gtk_widget_get_style_context (widget); cairo_pattern_t *gradient; @@ -1910,6 +1910,17 @@ on_drag_icon_draw (GtkWidget *widget, cairo_t *cr, GladeDesignLayout *layout) gint x, y, w, h; gdouble h2; GdkRGBA bg; + + /* Not needed acording to GtkWidget:draw documentation + * But seems like there is a bug when used as a drag_icon that makes the + * cairo translation used here persist when drawind children. + */ + cairo_save (cr); + + /* Clear BG */ + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + cairo_paint (cr); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); gtk_widget_get_allocation (widget, &alloc); x = alloc.x; @@ -1944,6 +1955,7 @@ on_drag_icon_draw (GtkWidget *widget, cairo_t *cr, GladeDesignLayout *layout) cairo_fill (cr); cairo_pattern_destroy (gradient); + cairo_restore (cr); return FALSE; } |