[gtk+] progressbar: Change the way the progress gadget gets size
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] progressbar: Change the way the progress gadget gets size
- Date: Wed, 16 Dec 2015 00:55:32 +0000 (UTC)
commit 26d42771efc66a4224e96bd80d9dc13ce8c10220
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 16 01:44:07 2015 +0100
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
gtk/gtkprogressbar.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 7adf76b..587fad5 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]