[gtk+] gtkrange: consider css margin on the slider



commit 5108a27e6c4d77bb92b1f80d548b8f6994a68b89
Author: Lapo Calamandrei <calamandrei gmail com>
Date:   Wed Nov 12 17:20:53 2014 +0100

    gtkrange: consider css margin on the slider
    
    Css margin now works on the slider as they do on the trough.
    The margin is not considered in the space allocation as it is for
    the trough, so the slider width will be the set slider-width -
    margins. Spefifying margins on the main widget in the css will
    clearly affect both the trough and the slider, so theme changes are
    needed.

 gtk/gtkrange.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 51898ef..87d3831 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2210,13 +2210,14 @@ gtk_range_draw (GtkWidget *widget,
 
       gtk_style_context_save (context);
       gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);
+      gtk_style_context_get_margin (context, widget_state, &margin);
       gtk_style_context_set_state (context, state);
 
       gtk_render_slider (context, cr,
-                         priv->slider.x,
-                         priv->slider.y,
-                         priv->slider.width,
-                         priv->slider.height,
+                         priv->slider.x + margin.left,
+                         priv->slider.y + margin.top,
+                         priv->slider.width - margin.left - margin.right,
+                         priv->slider.height - margin.top - margin.bottom,
                          priv->orientation);
 
       gtk_style_context_restore (context);


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