[gtk+] scale: Allocate the value next to the slider
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] scale: Allocate the value next to the slider
- Date: Tue, 1 Aug 2017 09:34:33 +0000 (UTC)
commit 30d6b08271e748e6fd371e58e2acf9aa66410db2
Author: Timm Bäder <mail baedert org>
Date: Tue Aug 1 11:34:23 2017 +0200
scale: Allocate the value next to the slider
... when vertical. Also fixes usage of the uninitialized value_alloc.y.
gtk/gtkscale.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 28431e7..97cd127 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -359,13 +359,11 @@ gtk_scale_allocate_value (GtkScale *scale,
case GTK_POS_TOP:
value_alloc.x = slider_alloc.x + (slider_alloc.width - value_alloc.width) / 2;
- value_alloc.x = CLAMP (value_alloc.x, range_alloc.x, range_alloc.x + range_alloc.width -
value_alloc.width);
value_alloc.y = 0;
break;
case GTK_POS_BOTTOM:
value_alloc.x = slider_alloc.x + (slider_alloc.width - value_alloc.width) / 2;
- value_alloc.x = CLAMP (value_alloc.x, range_alloc.x, range_alloc.x + range_alloc.width -
value_alloc.width);
value_alloc.y = range_alloc.height - value_alloc.height;
break;
@@ -374,18 +372,18 @@ gtk_scale_allocate_value (GtkScale *scale,
break;
}
}
- else
+ else /* VERTICAL */
{
switch (priv->value_pos)
{
case GTK_POS_LEFT:
value_alloc.x = 0;
- value_alloc.y = CLAMP (value_alloc.y, range_alloc.y, range_alloc.y + range_alloc.height -
value_alloc.height);
+ value_alloc.y = (slider_alloc.y + (slider_alloc.height / 2)) - value_alloc.height / 2;
break;
case GTK_POS_RIGHT:
value_alloc.x = range_alloc.width - value_alloc.width;
- value_alloc.y = CLAMP (value_alloc.y, range_alloc.y, range_alloc.y + range_alloc.height -
value_alloc.height);
+ value_alloc.y = (slider_alloc.y + (slider_alloc.height / 2)) - value_alloc.height / 2;
break;
case GTK_POS_TOP:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]