progressbar: Change the way the progress gadget gets size

Size of the progress element now grows also when it's close to 0 size.

Previously the size was clamped to the minimum size, now it starts
growing from the minimum size.
So for a 100px trough with a 10px min size progress, the sizes of the
progress element change like this:
        old     new
0%      10      10
5%      10      14
10%     10      19
20%     20      28
50%     50      55
100%    100     100
This commit is contained in:
Benjamin Otte 2015-12-16 01:44:07 +01:00
parent bf130da741
commit 26d42771ef

View File

@ -1068,7 +1068,7 @@ gtk_progress_bar_allocate_trough (GtkCssGadget *gadget,
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = MAX (width, allocation->width / priv->activity_blocks);
alloc.width = width + (allocation->width - width) / priv->activity_blocks;
alloc.x = allocation->x + priv->activity_pos * (allocation->width - alloc.width);
alloc.y = allocation->y + (allocation->height - height) / 2;
alloc.height = height;
@ -1076,7 +1076,7 @@ gtk_progress_bar_allocate_trough (GtkCssGadget *gadget,
else
{
alloc.height = MAX (height, allocation->height / priv->activity_blocks);
alloc.height = height + (allocation->height - height) / priv->activity_blocks;
alloc.y = allocation->y + priv->activity_pos * (allocation->height - alloc.height);
alloc.x = allocation->x + (allocation->width - width) / 2;
alloc.width = width;
@ -1086,7 +1086,7 @@ gtk_progress_bar_allocate_trough (GtkCssGadget *gadget,
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = MAX (width, allocation->width * priv->fraction);
alloc.width = width + (allocation->width - width) * priv->fraction;
alloc.height = height;
alloc.y = allocation->y + (allocation->height - height) / 2;
@ -1098,7 +1098,7 @@ gtk_progress_bar_allocate_trough (GtkCssGadget *gadget,
else
{
alloc.width = width;
alloc.height = MAX (height, allocation->height * priv->fraction);
alloc.height = height + (allocation->height - height) * priv->fraction;
alloc.x = allocation->x + (allocation->width - width) / 2;
if (!inverted)