[gnome-themes-standard] adwaita: render slider border with -adwaita-border-gradient from CSS
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-themes-standard] adwaita: render slider border with -adwaita-border-gradient from CSS
- Date: Fri, 18 Mar 2011 01:04:11 +0000 (UTC)
commit a3832a66307377dddb3599b927ae577ea4c49e07
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Mar 17 21:02:02 2011 -0400
adwaita: render slider border with -adwaita-border-gradient from CSS
src/adwaita_engine.c | 41 +++++++++++++--------------------------
themes/Adwaita/gtk-3.0/gtk.css | 34 ++++++++++++++++++++++++++++++++-
2 files changed, 47 insertions(+), 28 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index b99d837..3ee9ab7 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -1345,7 +1345,6 @@ adwaita_engine_render_slider (GtkThemingEngine *engine,
cairo_matrix_t matrix;
GtkStateFlags state;
GdkRGBA color;
- gdouble shade_factor = 2.0 / 3.0;
gboolean marks_above = FALSE, marks_below = FALSE;
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE)) {
@@ -1369,42 +1368,30 @@ adwaita_engine_render_slider (GtkThemingEngine *engine,
"background-image", &pattern,
NULL);
- cairo_matrix_init_scale (&matrix, 1 / width, 1 / height);
- cairo_pattern_set_matrix (pattern, &matrix);
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-
+ style_pattern_set_matrix (pattern, width, height);
cairo_set_source (cr, pattern);
+
cairo_fill_preserve (cr);
- gtk_theming_engine_get_border_color (engine, state, &color);
+ gtk_theming_engine_get (engine, state,
+ "-adwaita-border-gradient", &border_pattern,
+ NULL);
- if (orientation == GTK_ORIENTATION_HORIZONTAL) {
- border_pattern = cairo_pattern_create_linear (0, 0, 0, height);
+ if (border_pattern != NULL) {
+ style_pattern_set_matrix (border_pattern, width, height);
+ cairo_set_source (cr, border_pattern);
} else {
- border_pattern = cairo_pattern_create_linear (width, 0, 0, 0);
+ gtk_theming_engine_get_border_color (engine, state, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
}
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-
- cairo_pattern_add_color_stop_rgba (border_pattern,
- marks_above ? 0.0 : 1.0,
- color.red / shade_factor,
- color.green / shade_factor,
- color.blue / shade_factor,
- color.alpha);
-
- cairo_pattern_add_color_stop_rgba (border_pattern,
- marks_above ? 1.0 : 0.0,
- color.red,
- color.green,
- color.blue,
- color.alpha);
-
- cairo_set_source (cr, border_pattern);
cairo_stroke (cr);
cairo_pattern_destroy (pattern);
- cairo_pattern_destroy (border_pattern);
+
+ if (border_pattern != NULL) {
+ cairo_pattern_destroy (border_pattern);
+ }
}
else
{
diff --git a/themes/Adwaita/gtk-3.0/gtk.css b/themes/Adwaita/gtk-3.0/gtk.css
index ec56cc4..99a7b38 100644
--- a/themes/Adwaita/gtk-3.0/gtk.css
+++ b/themes/Adwaita/gtk-3.0/gtk.css
@@ -287,12 +287,44 @@ GtkScale {
GtkScale.slider {
border-width: 1;
border-radius: 3;
- border-color: shade (@internal_element_color, 0.90);
background-image: -gtk-gradient (linear,
left top, left bottom,
from (@theme_base_color),
to (@switch_slider_color));
+
+ -adwaita-border-gradient: -gtk-gradient (linear,
+ left top, left bottom,
+ from (shade (@internal_element_color, 0.90)),
+ to (shade (@internal_element_color, 1.35)));
+}
+
+GtkScale.scale-has-marks-below.slider.horizontal {
+ -adwaita-border-gradient: -gtk-gradient (linear,
+ left top, left bottom,
+ from (shade (@internal_element_color, 0.90)),
+ to (shade (@internal_element_color, 1.35)));
+}
+
+GtkScale.scale-has-marks-below.slider.vertical {
+ -adwaita-border-gradient: -gtk-gradient (linear,
+ left top, right top,
+ from (shade (@internal_element_color, 0.90)),
+ to (shade (@internal_element_color, 1.35)));
+}
+
+GtkScale.scale-has-marks-above.slider.horizontal {
+ -adwaita-border-gradient: -gtk-gradient (linear,
+ left bottom, left top,
+ from (shade (@internal_element_color, 0.90)),
+ to (shade (@internal_element_color, 1.35)));
+}
+
+GtkScale.scale-has-marks-above.slider.vertical {
+ -adwaita-border-gradient: -gtk-gradient (linear,
+ right top, left top,
+ from (shade (@internal_element_color, 0.90)),
+ to (shade (@internal_element_color, 1.35)));
}
GtkScale.trough {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]