[gtk+] GtkScale: Move marks inward



commit 3d82fc6d7e4a749b3dfc165b55f17e7acf4c81ec
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jun 4 19:58:40 2015 -0400

    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

 gtk/gtkscale.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index f9f228e..ee7f804 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]