From c2907b8532698d8a60bcecb80c6084b9711a55a9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 18 Jul 2014 16:31:17 -0400 Subject: [PATCH] GtkProgressBar: implement clipping This allows progress bars to have shadows. https://bugzilla.gnome.org/show_bug.cgi?id=733361 --- gtk/gtkprogressbar.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c index e191012fa2..9291982d34 100644 --- a/gtk/gtkprogressbar.c +++ b/gtk/gtkprogressbar.c @@ -28,6 +28,7 @@ #include "gtkprogressbar.h" #include "gtkorientableprivate.h" +#include "gtkwidgetprivate.h" #include "gtkprivate.h" #include "gtkintl.h" @@ -111,6 +112,8 @@ static void gtk_progress_bar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gtk_progress_bar_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); static void gtk_progress_bar_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural); @@ -144,6 +147,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class) gobject_class->finalize = gtk_progress_bar_finalize; widget_class->draw = gtk_progress_bar_draw; + widget_class->size_allocate = gtk_progress_bar_size_allocate; widget_class->get_preferred_width = gtk_progress_bar_get_preferred_width; widget_class->get_preferred_height = gtk_progress_bar_get_preferred_height; @@ -439,6 +443,15 @@ get_current_text (GtkProgressBar *pbar) return g_strdup_printf ("%.0f %%", priv->fraction * 100.0); } +static void +gtk_progress_bar_size_allocate (GtkWidget *widget, + GtkAllocation *allocation) +{ + GTK_WIDGET_CLASS (gtk_progress_bar_parent_class)->size_allocate (widget, allocation); + + _gtk_widget_set_simple_clip (widget); +} + static void gtk_progress_bar_get_preferred_width (GtkWidget *widget, gint *minimum,