From 30d6b08271e748e6fd371e58e2acf9aa66410db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 1 Aug 2017 11:34:23 +0200 Subject: [PATCH] scale: Allocate the value next to the slider ... when vertical. Also fixes usage of the uninitialized value_alloc.y. --- gtk/gtkscale.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 28431e77ec..97cd127800 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: