[gnome-themes-standard] focus: tweak the focus ring padding for treeview rows
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-themes-standard] focus: tweak the focus ring padding for treeview rows
- Date: Tue, 9 Aug 2011 10:57:38 +0000 (UTC)
commit eecd19ce475433cd978fcdef86a447250ba055b1
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Aug 9 12:55:08 2011 +0200
focus: tweak the focus ring padding for treeview rows
src/adwaita_engine.c | 19 ++++++++++++++++---
themes/Adwaita/gtk-3.0/gtk-widgets.css | 7 ++++---
2 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 22d3a6b..f055c2f 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -138,7 +138,9 @@ adwaita_engine_render_focus (GtkThemingEngine *engine,
gint border_radius;
gboolean use_dashes;
double dashes[2] = { 2.0, 0.2 };
+ const GtkWidgetPath *path;
+ path = gtk_theming_engine_get_path (engine);
state = gtk_theming_engine_get_state (engine);
gtk_theming_engine_get (engine, state,
"-adwaita-focus-border-color", &border_color,
@@ -153,16 +155,27 @@ adwaita_engine_render_focus (GtkThemingEngine *engine,
"focus-padding", &focus_pad,
NULL);
+ /* as we render the tab smaller than the whole allocation, we need
+ * to recenter and resize the focus on the tab.
+ */
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_NOTEBOOK) &&
gtk_theming_engine_has_region (engine, GTK_STYLE_REGION_TAB, NULL))
{
- /* as we render the tab smaller than the whole allocation, we need
- * to recenter and resize the focus on the tab.
- */
y += 3.0;
height -= 3.0;
}
+ /* the treeview rows don't change allocation when modifying focus-padding,
+ * so we have to move the focus ring inside the allocated area manually.
+ */
+ if (gtk_widget_path_is_type (path, GTK_TYPE_TREE_VIEW))
+ {
+ x += focus_pad;
+ y += focus_pad;
+ width -= 2 * focus_pad;
+ height -= 2 * focus_pad;
+ }
+
cairo_save (cr);
cairo_set_line_width (cr, line_width);
diff --git a/themes/Adwaita/gtk-3.0/gtk-widgets.css b/themes/Adwaita/gtk-3.0/gtk-widgets.css
index fa0896e..198e664 100644
--- a/themes/Adwaita/gtk-3.0/gtk-widgets.css
+++ b/themes/Adwaita/gtk-3.0/gtk-widgets.css
@@ -1176,9 +1176,10 @@ GtkTreeView {
-GtkTreeView-expander-size: 11;
-GtkWidget-focus-line-width: 1;
- -adwaita-focus-border-radius: 0;
- -adwaita-focus-border-dashes: 0;
- -adwaita-focus-border-color: @keyboard_focus_border_a;
+ -GtkWidget-focus-padding: 1;
+ -adwaita-focus-border-radius: 2;
+ -adwaita-focus-border-dashes: 1;
+ -adwaita-focus-border-color: mix(@theme_selected_fg_color, @theme_selected_bg_color, 0.30);
}
GtkTreeView.separator {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]