[gnome-themes-standard] expanders: use stock GTK arrow rendering for expanders



commit 825af836c15ea54756585f61dfcd716886d5caa1
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Feb 22 14:41:29 2013 -0500

    expanders: use stock GTK arrow rendering for expanders
    
    The +/- boxes we have had for a while were deemed too obtrusive. Revert
    to a more minimal arrow, which removes also the need for a custom C
    override to render them.

 themes/Adwaita/gtk-3.0/adwaita_engine.c |   82 -------------------------------
 themes/Adwaita/gtk-3.0/gtk-widgets.css  |   43 ++++++-----------
 2 files changed, 15 insertions(+), 110 deletions(-)
---
diff --git a/themes/Adwaita/gtk-3.0/adwaita_engine.c b/themes/Adwaita/gtk-3.0/adwaita_engine.c
index 7d9e23d..5ce3a9a 100644
--- a/themes/Adwaita/gtk-3.0/adwaita_engine.c
+++ b/themes/Adwaita/gtk-3.0/adwaita_engine.c
@@ -420,87 +420,6 @@ adwaita_engine_render_extension (GtkThemingEngine *engine,
 }
 
 static void
-adwaita_engine_render_expander (GtkThemingEngine *engine,
-                                cairo_t          *cr,
-                                gdouble           x,
-                                gdouble           y,
-                                gdouble           width,
-                                gdouble           height)
-{
-  GdkRGBA fg;
-  GtkStateFlags state;
-  gdouble side, offset;
-  gint line_width;
-  GtkBorder border;
-  const GtkWidgetPath *path = gtk_theming_engine_get_path (engine);
-
-  side = floor (MIN (width, height));
-
-  if (gtk_widget_path_is_type (path, GTK_TYPE_TREE_VIEW) &&
-      (side == 17))
-    {
-      /* HACK: draw the expander as if it was 11px instead of the allocated 17px,
-       * so that we can have a bit of padding between the view edge and the
-       * expander itself.
-       */
-      x += 3;
-      y += 3;
-      width -= 6;
-      height -= 6;
-      side -= 6;
-    }
-
-  x += width / 2 - side / 2;
-  y += height / 2 - side / 2;
-
-  x = floor (x);
-  y = floor (y);
-
-  /* make sure the rendered side length is always odd */
-  if (((gint) side % 2) == 0)
-    side -= 1.0;
-
-  GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_background
-    (engine, cr, x, y, side, side);
-  GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_frame
-    (engine, cr, x, y, side, side);
-
-  state = gtk_theming_engine_get_state (engine);
-  gtk_theming_engine_get_color (engine, state, &fg);
-  gtk_theming_engine_get_border (engine, state, &border);
-
-  line_width = 1;
-  offset = (1 + line_width / 2.0);
-
-  cairo_save (cr);
-
-  cairo_set_line_width (cr, line_width);
-  cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
-  gdk_cairo_set_source_rgba (cr, &fg);
-
-  cairo_move_to (cr,
-                 x + border.left + offset,
-                 y + side / 2);
-  cairo_line_to (cr,
-                 x + side - (border.right + offset),
-                 y + side / 2);
-
-  if ((state & GTK_STATE_FLAG_ACTIVE) == 0)
-    {
-      cairo_move_to (cr,
-                     x + side / 2,
-                     y + border.top + offset);
-      cairo_line_to (cr,
-                     x + side / 2,
-                     y + side - (border.bottom + offset));
-    }
-
-  cairo_stroke (cr);
-
-  cairo_restore (cr);
-}
-
-static void
 adwaita_engine_class_init (AdwaitaEngineClass *klass)
 {
   GtkThemingEngineClass *engine_class = GTK_THEMING_ENGINE_CLASS (klass);
@@ -511,7 +430,6 @@ adwaita_engine_class_init (AdwaitaEngineClass *klass)
   engine_class->render_arrow = adwaita_engine_render_arrow;
   engine_class->render_focus = adwaita_engine_render_focus;
   engine_class->render_extension = adwaita_engine_render_extension;
-  engine_class->render_expander = adwaita_engine_render_expander;
 }
 
 static void
diff --git a/themes/Adwaita/gtk-3.0/gtk-widgets.css b/themes/Adwaita/gtk-3.0/gtk-widgets.css
index 7bd6e30..a8a7458 100644
--- a/themes/Adwaita/gtk-3.0/gtk-widgets.css
+++ b/themes/Adwaita/gtk-3.0/gtk-widgets.css
@@ -24,6 +24,7 @@
 
     -GtkToolItemGroup-expander-size: 11;
     -GtkExpander-expander-size: 11;
+    -GtkTreeView-expander-size: 11;
 
     -GtkMenu-horizontal-padding: 0;
     -GtkMenu-vertical-padding: 0;
@@ -3480,7 +3481,6 @@ GtkSwitch.slider:insensitive:backdrop {
  ***********************/
 GtkTreeView {
     -GtkTreeView-vertical-separator: 0;
-    -GtkTreeView-expander-size: 17;
 
     -GtkWidget-focus-line-width: 1;
     -GtkWidget-focus-padding: 1;
@@ -3604,51 +3604,38 @@ column-header .button.dnd {
 }
 
 .expander {
-    border-style: solid;
-    border-width: 1px;
-    border-radius: 2px;
-    border-color: shade (@internal_element_color, 1.40);
-
     color: @internal_element_color;
-    background-color: @theme_base_color;
+    border-color: @internal_element_color;
 }
 
 .expander:active {
-    border-style: solid;
-    border-width: 1px;
-
     color: @internal_element_color;
-    border-color: shade (@internal_element_color, 1.40);
-
-    background-color: @theme_base_color;
+    border-color: @internal_element_color;
 }
 
 .expander:hover {
-    border-style: solid;
-    border-width: 1px;
-
-    color: @internal_element_color;
-    border-color: shade (@internal_element_color, 1.40);
-
-    background-color: shade (@theme_bg_color, 1.02);
+    color: @theme_fg_color;
+    border-color: @theme_fg_color;
 }
 
-.expander row {
-    border-radius: 2px;
+.expander:backdrop {
+    color: @theme_unfocused_fg_color;
+    border-color: @theme_unfocused_fg_color;
 }
 
 .expander row:selected,
 .expander row:selected:focus {
-    border-style: solid;
-    border-width: 1px;
-
-    border-color: @expander_row_selected_color;
     color: @expander_row_selected_color;
-    background-color: @theme_selected_bg_color;
+    border-color: @expander_row_selected_color;
+}
+
+.expander row:selected:hover,
+.expander row:selected:focus:hover {
+    color: @theme_selected_fg_color;
+    border-color: @theme_selected_fg_color;
 }
 
 .expander row:selected:backdrop {
-    background-color: @theme_unfocused_selected_bg_color;
     color: @internal_element_color;
     border-color: @internal_element_color;
 }


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