levelbar: Don't underallocate block widgets
authorTimm Bäder <mail@baedert.org>
Thu, 29 Jun 2017 13:28:47 +0000 (15:28 +0200)
committerDaniel Boles <dboles@src.gnome.org>
Fri, 4 Aug 2017 00:50:58 +0000 (01:50 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=783649

gtk/gtklevelbar.c

index 7fc12794c45767b1f7f3f50fbc153a8275579219..47ec1ca9c3caea5bc53c212e5236dd643b725cbd 100644 (file)
@@ -458,6 +458,7 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
   GtkAllocation block_area, clip;
   gdouble fill_percentage;
   gboolean inverted;
+  int block_min;
 
   inverted = gtk_level_bar_get_real_inverted (self);
 
@@ -473,9 +474,15 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
   fill_percentage = (self->priv->cur_value - self->priv->min_value) /
     (self->priv->max_value - self->priv->min_value);
 
+  gtk_css_gadget_get_preferred_size (self->priv->block_gadget[inverted ? 1 : 0],
+                                     self->priv->orientation, -1,
+                                     &block_min, NULL,
+                                     NULL, NULL);
+
   if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
     {
       block_area.width = (gint) floor (block_area.width * fill_percentage);
+      block_area.width = MAX (block_area.width, block_min);
 
       if (inverted)
         block_area.x += allocation->width - block_area.width;
@@ -483,6 +490,7 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
   else
     {
       block_area.height = (gint) floor (block_area.height * fill_percentage);
+      block_area.height = MAX (block_area.height, block_min);
 
       if (inverted)
         block_area.y += allocation->height - block_area.height;