[gtk+] switch: don't use focus-line-width



commit 92d23be47d4c8d6e3c9a57727b2443add0c26f65
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun May 4 20:16:13 2014 +0200

    switch: don't use focus-line-width

 gtk/gtkswitch.c |   28 +++++++---------------------
 1 files changed, 7 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 3c8cb01..e038192 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -179,11 +179,7 @@ gtk_switch_motion (GtkWidget      *widget,
       GtkStyleContext *context;
       GtkStateFlags state;
       GtkBorder padding;
-      gint width, focus_width;
-
-      gtk_widget_style_get (widget,
-                            "focus-line-width", &focus_width,
-                            NULL);
+      gint width;
 
       context = gtk_widget_get_style_context (widget);
       state = gtk_widget_get_state_flags (widget);
@@ -195,7 +191,7 @@ gtk_switch_motion (GtkWidget      *widget,
       
       gtk_widget_get_allocation (widget, &allocation);
 
-      width = allocation.width - 2 * focus_width;
+      width = allocation.width;
 
       /* constrain the handle within the trough width */
       if (position > (width / 2) - padding.right)
@@ -321,7 +317,7 @@ gtk_switch_get_preferred_width (GtkWidget *widget,
   GtkStyleContext *context;
   GtkStateFlags state;
   GtkBorder padding;
-  gint width, slider_width, focus_width;
+  gint width, slider_width;
   PangoLayout *layout;
   PangoRectangle logical_rect;
 
@@ -339,11 +335,8 @@ gtk_switch_get_preferred_width (GtkWidget *widget,
 
   gtk_widget_style_get (widget,
                         "slider-width", &slider_width,
-                        "focus-line-width", &focus_width,
                         NULL);
 
-  slider_width = MAX (slider_width, 3 * focus_width);
-
   /* Translators: if the "on" state label requires more than three
    * glyphs then use MEDIUM VERTICAL BAR (U+2759) as the text for
    * the state
@@ -375,7 +368,7 @@ gtk_switch_get_preferred_height (GtkWidget *widget,
   GtkStyleContext *context;
   GtkStateFlags state;
   GtkBorder padding;
-  gint height, focus_width, slider_width, min_height;
+  gint height, slider_width, min_height;
   PangoLayout *layout;
   PangoRectangle logical_rect;
   gchar *str;
@@ -394,10 +387,9 @@ gtk_switch_get_preferred_height (GtkWidget *widget,
 
   gtk_widget_style_get (widget,
                         "slider-width", &slider_width,
-                        "focus-line-width", &focus_width,
                         NULL);
 
-  min_height = MAX (slider_width * 0.6, 3 * focus_width);
+  min_height = slider_width * 0.6;
 
   str = g_strdup_printf ("%s%s",
                          C_("switch", "ON"),
@@ -614,15 +606,9 @@ gtk_switch_draw (GtkWidget *widget,
 
   if (gtk_widget_has_visible_focus (widget))
     {
-      gint focus_width;
-
-      gtk_widget_style_get (widget,
-                            "focus-line-width", &focus_width,
-                            NULL);
-
       gtk_render_focus (context, cr,
-                        handle.x + focus_width, handle.y + focus_width,
-                        handle.width - focus_width*2, handle.height - focus_width*2);
+                        handle.x, handle.y,
+                        handle.width, handle.height);
     }
 
   return FALSE;


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