[gnome-contacts: 7/35] egg-list-box: make sure to offset the foucs ring by focus_pad



commit f74b6a0c7194096b281c78468a6e0b5826516726
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 20 16:35:28 2012 +0100

    egg-list-box: make sure to offset the foucs ring by focus_pad
    
    This is what all other GTK widgets usually do; not doing so here
    eventually results in the separator being drawn on top of the focus
    ring.
    We already allocate and request space for it elsewhere in the code.

 egg-list-box.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/egg-list-box.c b/egg-list-box.c
index b75b5be..d0da627 100644
--- a/egg-list-box.c
+++ b/egg-list-box.c
@@ -1046,6 +1046,7 @@ egg_list_box_real_draw (GtkWidget* widget, cairo_t* cr)
   GtkStateFlags state;
   ChildFlags flags[3], *found;
   gint flags_length;
+  gint focus_pad;
   int i;
 
   gtk_widget_get_allocation (GTK_WIDGET (list_box), &allocation);
@@ -1082,7 +1083,13 @@ egg_list_box_real_draw (GtkWidget* widget, cairo_t* cr)
     }
 
   if (gtk_widget_has_visible_focus (GTK_WIDGET (list_box)) && priv->cursor_child != NULL)
-    gtk_render_focus (context, cr, 0, priv->cursor_child->y, allocation.width, priv->cursor_child->height);
+    {
+      gtk_style_context_get_style (context,
+                                   "focus-padding", &focus_pad,
+                                   NULL);
+      gtk_render_focus (context, cr, focus_pad, priv->cursor_child->y + focus_pad,
+                        allocation.width - 2 * focus_pad, priv->cursor_child->height - 2 * focus_pad);
+    }
 
   GTK_WIDGET_CLASS (egg_list_box_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (list_box, 
GTK_TYPE_CONTAINER, GtkContainer), cr);
 


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