[gnome-themes-standard] progressbars: use CSS multiple backgrounds to render pattern



commit 3ce26d02f2a577c20a6b2255cc77df82f873ca94
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri May 11 23:06:32 2012 -0400

    progressbars: use CSS multiple backgrounds to render pattern

 src/adwaita_engine.c                   |   27 ------------------
 themes/Adwaita/gtk-3.0/gtk-widgets.css |   46 ++++++++++++++-----------------
 2 files changed, 21 insertions(+), 52 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 44b6253..3f85046 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -455,28 +455,6 @@ adwaita_engine_render_activity (GtkThemingEngine *engine,
     (engine, cr,
      x, y, width, height);
 
-  if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_PROGRESSBAR))
-    {
-      cairo_pattern_t *pattern = NULL;
-
-      gtk_theming_engine_get (engine, state,
-                              "-adwaita-progressbar-pattern", &pattern,
-                              NULL);
-
-      if (pattern != NULL)
-        {
-          cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-          cairo_scale (cr, 20, 20);
-          cairo_set_source (cr, pattern);
-          cairo_scale (cr, 1.0 / 20, 1.0 / 20);
-
-          cairo_rectangle (cr, x, y, width, height);
-          cairo_fill (cr);
-
-          cairo_pattern_destroy (pattern);
-        }
-    }
-
   cairo_restore (cr);
 }
 
@@ -636,11 +614,6 @@ adwaita_engine_class_init (AdwaitaEngineClass *klass)
                                                               "Focus border uses dashes",
                                                               "Focus border uses dashes",
                                                               FALSE, 0));
-  gtk_theming_engine_register_property (ADWAITA_NAMESPACE, NULL,
-                                        g_param_spec_boxed ("progressbar-pattern",
-                                                            "Progressbar pattern",
-                                                            "Progressbar pattern",
-                                                            CAIRO_GOBJECT_TYPE_PATTERN, 0));
 }
 
 static void
diff --git a/themes/Adwaita/gtk-3.0/gtk-widgets.css b/themes/Adwaita/gtk-3.0/gtk-widgets.css
index 917c25c..e0a3231 100644
--- a/themes/Adwaita/gtk-3.0/gtk-widgets.css
+++ b/themes/Adwaita/gtk-3.0/gtk-widgets.css
@@ -268,8 +268,6 @@ GtkTreeView.separator:backdrop,
     color: @theme_selected_fg_color;
 
     /* border-image defined in -assets variant */
-
-    -adwaita-progressbar-pattern: none;
 }
 
 .entry:selected {
@@ -519,24 +517,27 @@ GtkProgressBar {
 .progressbar row:hover,
 .progressbar row:selected,
 .progressbar row:selected:focus {
-    background-image: -gtk-gradient (linear,
+    background-image: linear-gradient(to left top,
+                                      alpha (@progressbar_pattern, 0.25),
+                                      alpha (@progressbar_pattern, 0.25) 25%,
+                                      transparent 25%,
+                                      transparent 50%,
+                                      alpha (@progressbar_pattern, 0.25) 50%,
+                                      alpha (@progressbar_pattern, 0.25) 75%,
+                                      transparent 75%,
+                                      transparent),
+                      -gtk-gradient (linear,
                                      left top, left bottom,
                                      from (@progressbar_background_a),
                                      color-stop (0.75, @progressbar_background_b),
                                      to (shade(@progressbar_background_a, 0.85)));
+    background-size: 40px 40px;
 
     border-radius: 3px;
     border-width: 1px;
     border-style: solid;
     border-color: @progressbar_border;
     box-shadow: inset 1px 1px alpha(white, 0.2), inset -1px -1px alpha(white, 0.1);
-
-    -adwaita-progressbar-pattern: -gtk-gradient (linear,
-                                                 left top, right bottom,
-                                                 from (alpha (@progressbar_pattern, 0.00)),
-                                                 color-stop (0.49, alpha (@progressbar_pattern, 0.00)),
-                                                 color-stop (0.50, alpha (@progressbar_pattern, 0.25)),
-                                                 to (alpha (@progressbar_pattern, 0.25)));
 }
 
 .progressbar row:selected,
@@ -545,18 +546,20 @@ GtkProgressBar {
 }
 
 .progressbar.vertical {
-    background-image: -gtk-gradient (linear,
+    background-image: linear-gradient(to right top,
+                                      alpha (@progressbar_pattern, 0.25),
+                                      alpha (@progressbar_pattern, 0.25) 25%,
+                                      transparent 25%,
+                                      transparent 50%,
+                                      alpha (@progressbar_pattern, 0.25) 50%,
+                                      alpha (@progressbar_pattern, 0.25) 75%,
+                                      transparent 75%,
+                                      transparent),
+                      -gtk-gradient (linear,
                                      left top, right top,
                                      from (@progressbar_background_a),
                                      color-stop (0.75, @progressbar_background_b),
                                      to (shade(@progressbar_background_a, 0.85)));
-
-    -adwaita-progressbar-pattern: -gtk-gradient (linear,
-                                                 left bottom, right top,
-                                                 from (alpha (@progressbar_pattern, 0.00)),
-                                                 color-stop (0.49, alpha (@progressbar_pattern, 0.00)),
-                                                 color-stop (0.50, alpha (@progressbar_pattern, 0.25)),
-                                                 to (alpha (@progressbar_pattern, 0.25)));
 }
 
 .progressbar:backdrop,
@@ -565,7 +568,6 @@ GtkProgressBar {
 .progressbar.vertical:backdrop,
 .progressbar.vertical row:backdrop,
 .progressbar.vertical row:selected:backdrop {
-    -adwaita-progressbar-pattern: none;
     background-image: none;
     background-color: @progressbar_unfocused_background;
     border-color: @progressbar_unfocused_border;
@@ -643,14 +645,10 @@ GtkScale.trough:insensitive {
 
 GtkScale.progressbar {
     background-color: @scale_progress_fill;
-
-    -adwaita-progressbar-pattern: none;
 }
 
 GtkScale.progressbar:backdrop {
     background-color: @unfocused_borders;
-
-    -adwaita-progressbar-pattern: none;
 }
 
 GtkScale.mark {
@@ -1935,8 +1933,6 @@ GtkCheckButton:selected:focus {
     border-image: none;
 
     color: @theme_text_color;
-
-    -adwaita-progressbar-pattern: none;
 }
 
 /*******************



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