[gtk+] treeview: respect focus-padding when rendering focus



commit a60ba815d91ca5a6958917c0cbaaa5c09126a9c7
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu May 1 18:07:25 2014 +0200

    treeview: respect focus-padding when rendering focus
    
    Adwaita had a hack to work this around, but now that we're moving focus
    ring rendering into GTK, we can just fix the treeview instead.

 gtk/gtktreeview.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 891a55c..9893c19 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5362,7 +5362,7 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
           tree_view->priv->draw_keyfocus &&
          gtk_widget_has_visible_focus (widget))
         {
-         gint tmp_y, tmp_height;
+         gint tmp_y, tmp_height, focus_pad;
          GtkStateFlags focus_rect_state = 0;
 
           gtk_style_context_save (context);
@@ -5381,10 +5381,14 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
               tmp_height = gtk_tree_view_get_row_height (tree_view, node);
            }
 
+          gtk_style_context_get_style (context,
+                                       "focus-padding", &focus_pad,
+                                       NULL);
+
           gtk_render_focus (context, cr,
-                            0, tmp_y,
-                            gdk_window_get_width (tree_view->priv->bin_window),
-                            tmp_height);
+                            focus_pad, tmp_y + focus_pad,
+                            gdk_window_get_width (tree_view->priv->bin_window) - 2 * focus_pad,
+                            tmp_height - 2 * focus_pad);
 
           gtk_style_context_restore (context);
         }


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