From 1ed21ad3d4d90076f74c2c2fe616938d0c7d6026 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 23 Jun 2015 09:33:30 -0400 Subject: [PATCH] GtkScale: More work on mark spacing Try harder not to push the scale out of balance by marks. With this change, the remaining difference in the drawing is down to asymmetric assets and margins coming out of the theme. To fully support such asymmetric rendering, we need implement baseline alignment for scales. https://bugzilla.gnome.org/show_bug.cgi?id=749650 --- gtk/gtkscale.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index ee7f80435e..1853625652 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -875,31 +875,28 @@ gtk_scale_get_range_border (GtkRange *range, if (priv->marks) { - gint slider_width; gint value_spacing; gint n1, w1, h1, n2, w2, h2; - - gtk_widget_style_get (widget, - "slider-width", &slider_width, - "value-spacing", &value_spacing, - NULL); + gtk_widget_style_get (widget, + "value-spacing", &value_spacing, + NULL); gtk_scale_get_mark_label_size (scale, GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2); if (gtk_orientable_get_orientation (GTK_ORIENTABLE (scale)) == GTK_ORIENTATION_HORIZONTAL) { - if (n1 > 0) - border->top += h1 + value_spacing + slider_width / 4; - if (n2 > 0) - border->bottom += h2 + value_spacing + slider_width / 4; + if (h1 > 0) + border->top += h1 + value_spacing; + if (h2 > 0) + border->bottom += h2 + value_spacing; } else { - if (n1 > 0) - border->left += w1 + value_spacing + slider_width / 4; - if (n2 > 0) - border->right += w2 + value_spacing + slider_width / 4; + if (w1 > 0) + border->left += w1 + value_spacing; + if (w2 > 0) + border->right += w2 + value_spacing; } } }