GtkScale: Move marks inward

We don't want scale marks to affect scale sizing and positioning,
so draw them inside the range recangle. This avoids size changes
for marks that don't have labels, at least.

https://bugzilla.gnome.org/show_bug.cgi?id=749650
This commit is contained in:
Matthias Clasen 2015-06-04 19:58:40 -04:00
parent 99e6796dd3
commit 3d82fc6d7e

View File

@ -1127,11 +1127,6 @@ gtk_scale_draw (GtkWidget *widget,
"value-spacing", &value_spacing,
NULL);
/* We need to chain up _first_ so the various geometry members of
* GtkRange struct are updated.
*/
GTK_WIDGET_CLASS (gtk_scale_parent_class)->draw (widget, cr);
if (priv->marks)
{
GtkOrientation orientation;
@ -1161,15 +1156,15 @@ gtk_scale_draw (GtkWidget *widget,
x1 = marks[i];
if (mark->position == GTK_POS_TOP)
{
y1 = range_rect.y;
y2 = y1 - slider_width / 4;
y1 = range_rect.y + slider_width / 4;
y2 = range_rect.y;
min_pos = min_pos_before;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP) - min_sep;
}
else
{
y1 = range_rect.y + range_rect.height;
y2 = y1 + slider_width / 4;
y1 = range_rect.y + range_rect.height - slider_width / 4;
y2 = range_rect.y + range_rect.height;
min_pos = min_pos_after;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM) - min_sep;
}
@ -1213,15 +1208,15 @@ gtk_scale_draw (GtkWidget *widget,
{
if (mark->position == GTK_POS_TOP)
{
x1 = range_rect.x;
x2 = range_rect.x - slider_width / 4;
x1 = range_rect.x + slider_width / 4;
x2 = range_rect.x;
min_pos = min_pos_before;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP) - min_sep;
}
else
{
x1 = range_rect.x + range_rect.width;
x2 = range_rect.x + range_rect.width + slider_width / 4;
x1 = range_rect.x + range_rect.width - slider_width / 4;
x2 = range_rect.x + range_rect.width;
min_pos = min_pos_after;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM) - min_sep;
}
@ -1268,6 +1263,8 @@ gtk_scale_draw (GtkWidget *widget,
g_free (marks);
}
GTK_WIDGET_CLASS (gtk_scale_parent_class)->draw (widget, cr);
if (priv->draw_value)
{
GtkAllocation allocation;