scale: Allocate the value next to the slider

... when vertical. Also fixes usage of the uninitialized value_alloc.y.
This commit is contained in:
Timm Bäder
2017-08-01 11:34:23 +02:00
parent ffc15bf922
commit 30d6b08271

View File

@@ -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: