[rhythmbox] segmented-bar: fix rendering when inside a container



commit 11705daf5021918d4e1bcd5ea3b3d65a3af7683b
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat May 7 00:25:34 2011 +1000

    segmented-bar: fix rendering when inside a container
    
    This is just a hack, we should fix the rendering code so it works
    when there's a pre-existing translation on the cairo context.

 widgets/rb-segmented-bar.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/widgets/rb-segmented-bar.c b/widgets/rb-segmented-bar.c
index f41c1aa..395bb3d 100644
--- a/widgets/rb-segmented-bar.c
+++ b/widgets/rb-segmented-bar.c
@@ -778,23 +778,23 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
 }
 
 static gboolean
-rb_segmented_bar_draw (GtkWidget *widget, cairo_t *context)
+rb_segmented_bar_draw (GtkWidget *widget, cairo_t *context_)
 {
 	RBSegmentedBar *bar;
 	RBSegmentedBarPrivate *priv;
 	GtkAllocation allocation;
 	cairo_pattern_t *bar_pattern;
+	cairo_t *context;
 
 	g_return_val_if_fail (RB_IS_SEGMENTED_BAR (widget), FALSE);
-	/* what?
-	if (gtk_widget_is_drawable (widget) == FALSE) {
-		return FALSE;
-	}
-	*/
 
 	bar = RB_SEGMENTED_BAR (widget);
 	priv = RB_SEGMENTED_BAR_GET_PRIVATE (bar);
 
+	/* XXX should use the context passed in, but this currently
+	 * doesn't work properly with pre-existing translation
+	 */
+	context = gdk_cairo_create (gtk_widget_get_window (widget));
 	if (priv->reflect) {
 		cairo_push_group (context);
 	}
@@ -867,6 +867,7 @@ rb_segmented_bar_draw (GtkWidget *widget, cairo_t *context)
 		rb_segmented_bar_render_labels (bar, context);
 	}
 	cairo_pattern_destroy (bar_pattern);
+	cairo_destroy (context);
 
 	return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]