[gnome-themes-standard] adwaita: add inset-* properties, to draw inset shadow lines



commit 960c9cd503dfd72b6e70531f0bcf6a03c619f2b9
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Apr 29 21:15:42 2011 -0400

    adwaita: add inset-* properties, to draw inset shadow lines
    
    And hook it up with all the widgets that had it in the mockups.

 src/adwaita_engine.c                   |  110 ++++++++++++++++++++++++++++++++
 themes/Adwaita/gtk-3.0/gtk-dark.css    |    6 +-
 themes/Adwaita/gtk-3.0/gtk-widgets.css |   81 +++++++++++++++---------
 themes/Adwaita/gtk-3.0/gtk.css         |    5 +-
 4 files changed, 168 insertions(+), 34 deletions(-)
---
diff --git a/src/adwaita_engine.c b/src/adwaita_engine.c
index 153833a..41e7326 100644
--- a/src/adwaita_engine.c
+++ b/src/adwaita_engine.c
@@ -997,6 +997,90 @@ render_menubar_active_background (GtkThemingEngine *engine,
 }
 
 static void
+render_inset_lines (GtkThemingEngine *engine,
+		    cairo_t *cr,
+		    gdouble x,
+		    gdouble y,
+		    gdouble width,
+		    gdouble height)
+{
+	GtkStateFlags state;
+	GtkBorder border;
+	GdkRGBA *inset_left, *inset_right, *inset_top, *inset_bottom;
+
+	state = gtk_theming_engine_get_state (engine);
+	gtk_theming_engine_get_border (engine, state, &border);
+
+	gtk_theming_engine_get (engine, state,
+				"-adwaita-inset-left", &inset_left,
+				"-adwaita-inset-right", &inset_right,
+				"-adwaita-inset-top", &inset_top,
+				"-adwaita-inset-bottom", &inset_bottom,
+				NULL);
+
+	cairo_save (cr);
+	cairo_set_line_width (cr, 1.0);
+
+	if (inset_left != NULL) {
+		cairo_move_to (cr,
+			       x + border.left + 0.5,
+			       y + border.top + 1.0);
+		cairo_line_to (cr,
+			       x + border.left + 1,
+			       y + height - border.bottom - 1.0);
+
+		gdk_cairo_set_source_rgba (cr, inset_left);
+		cairo_stroke (cr);
+
+		gdk_rgba_free (inset_left);
+	}
+
+	if (inset_right != NULL) {
+		cairo_move_to (cr,
+			       x + width - border.right - 0.5,
+			       y + border.top + 1.0);
+		cairo_line_to (cr,
+			       x + width - border.right - 0.5,
+			       y + height - border.bottom - 1.0);
+
+		gdk_cairo_set_source_rgba (cr, inset_right);
+		cairo_stroke (cr);
+
+		gdk_rgba_free (inset_right);
+	}
+
+	if (inset_top != NULL) {
+		cairo_move_to (cr,
+			       x + border.left + 1.0,
+			       y + border.top + 0.5);
+		cairo_line_to (cr,
+			       x + width - border.right - 1.0,
+			       y + border.top + 0.5);
+
+		gdk_cairo_set_source_rgba (cr, inset_top);
+		cairo_stroke (cr);
+
+		gdk_rgba_free (inset_top);
+	}
+
+	if (inset_bottom != NULL) {
+		cairo_move_to (cr,
+			       x + border.left + 1.0,
+			       y + height - border.bottom - 0.5);
+		cairo_line_to (cr,
+			       x + width - border.right - 1.0,
+			       y + height - border.bottom - 0.5);
+
+		gdk_cairo_set_source_rgba (cr, inset_bottom);
+		cairo_stroke (cr);
+
+		gdk_rgba_free (inset_bottom);
+	}
+
+	cairo_restore (cr);
+}
+
+static void
 adwaita_engine_render_background (GtkThemingEngine *engine,
 				  cairo_t          *cr,
 				  gdouble           x,
@@ -1058,6 +1142,8 @@ adwaita_engine_render_background (GtkThemingEngine *engine,
 
 	GTK_THEMING_ENGINE_CLASS (adwaita_engine_parent_class)->render_background (engine, cr, x, y,
 										   width, height);
+
+	render_inset_lines (engine, cr, x, y, width, height);
 }
 
 static void
@@ -1167,6 +1253,8 @@ adwaita_engine_render_activity (GtkThemingEngine *engine,
 	}
 
 	cairo_restore (cr);
+
+	render_inset_lines (engine, cr, x, y, width, height);
 }
 
 static void
@@ -1382,6 +1470,8 @@ adwaita_engine_render_slider (GtkThemingEngine *engine,
 										       x, y, width, height,
 										       orientation);
 
+		render_inset_lines (engine, cr, x, y, width, height);
+
 		if (gtk_widget_path_is_type (path, GTK_TYPE_SWITCH)) {
 			render_switch_lines (engine, cr, x, y, width, height, orientation);
 		}
@@ -1762,6 +1852,26 @@ adwaita_engine_class_init (AdwaitaEngineClass *klass)
 								  "Switch grip color",
 								  "Switch grip color",
 								  GDK_TYPE_RGBA, 0));
+	gtk_theming_engine_register_property (ADWAITA_NAMESPACE, NULL,
+					      g_param_spec_boxed ("inset-left",
+								  "Inset line left",
+								  "Inset line left",
+								  GDK_TYPE_RGBA, 0));
+	gtk_theming_engine_register_property (ADWAITA_NAMESPACE, NULL,
+					      g_param_spec_boxed ("inset-right",
+								  "Inset line right",
+								  "Inset line right",
+								  GDK_TYPE_RGBA, 0));
+	gtk_theming_engine_register_property (ADWAITA_NAMESPACE, NULL,
+					      g_param_spec_boxed ("inset-top",
+								  "Inset line top",
+								  "Inset line top",
+								  GDK_TYPE_RGBA, 0));
+	gtk_theming_engine_register_property (ADWAITA_NAMESPACE, NULL,
+					      g_param_spec_boxed ("inset-bottom",
+								  "Inset line bottom",
+								  "Inset line bottom",
+								  GDK_TYPE_RGBA, 0));	
 }
 
 static void
diff --git a/themes/Adwaita/gtk-3.0/gtk-dark.css b/themes/Adwaita/gtk-3.0/gtk-dark.css
index fd24c52..458b4c2 100644
--- a/themes/Adwaita/gtk-3.0/gtk-dark.css
+++ b/themes/Adwaita/gtk-3.0/gtk-dark.css
@@ -46,6 +46,7 @@
 @define-color progressbar_border alpha (@theme_fg_color, 0.60);
 
 @define-color focused_entry_border @theme_selected_bg_color;
+ define-color focused_entry_inset alpha (@theme_selected_bg_color, 0.50);
 
 @define-color toolbar_gradient_base #080808;
 @define-color toolbar_gradient_step1 #0a0a0a;
@@ -92,8 +93,9 @@
 @define-color chrome_bg_color #1e1a17;
 @define-color chrome_fg_color #fff;
 
- define-color scale_fill_a #2c85e2;
- define-color scale_fill_b #b8d6f5;
+ define-color scale_fill #2c85e2;
+ define-color scale_border_a #1864b2;
+ define-color scale_border_b #3e90e5;
 
 @import url("gtk-widgets-assets-dark.css");
 @import url("gtk-widgets.css");
diff --git a/themes/Adwaita/gtk-3.0/gtk-widgets.css b/themes/Adwaita/gtk-3.0/gtk-widgets.css
index 9c86a51..7a9695e 100644
--- a/themes/Adwaita/gtk-3.0/gtk-widgets.css
+++ b/themes/Adwaita/gtk-3.0/gtk-widgets.css
@@ -51,6 +51,11 @@
     -adwaita-focus-fill-color: none;
     -adwaita-focus-border-gradient: none;
     -adwaita-focus-border-dashes: 1;
+
+    -adwaita-inset-left: none;
+    -adwaita-inset-right: none;
+    -adwaita-inset-top: none;
+    -adwaita-inset-bottom: none;
 }
 
 /***************
@@ -133,17 +138,22 @@
                                              to (shade (@internal_element_color, 1.37)));
 
     padding: 3;
+
+    -adwaita-inset-top: alpha (@switch_slider_color, 0.50);
 }
 
 .entry:focused {
     border-color: @focused_entry_border;
     -adwaita-border-gradient: none;
+
+    -adwaita-inset-top: @focused_entry_inset;
 }
 
 .entry:insensitive {
     background-color: @insensitive_bg_color;
-    border-color: shade (@inactive_frame_color, 0.945);
     -adwaita-border-gradient: none;
+
+    -adwaita-inset-top: none;
 }
 
 .entry.progressbar {
@@ -185,6 +195,8 @@ GtkProgressBar.progressbar {
     border-radius: 3;
     border-style: solid;
     border-color: @progressbar_border;
+
+    -adwaita-inset-top: alpha (@theme_base_color, 0.20);
 }
 
 GtkProgressBar.trough {
@@ -260,38 +272,41 @@ GtkScale.trough {
     border-width: 1;
     border-radius: 2;
     border-style: solid;
-    border-color: @internal_element_color;
-}
 
-GtkScale.trough:insensitive {
-    background-color: shade (@theme_bg_color, 1.20);
-    border-color: shade (@inactive_frame_color, 0.845);
+    -adwaita-border-gradient: -gtk-gradient (linear,
+                                             left top, left bottom,
+                                             from (@internal_element_color),
+                                             to (shade (@internal_element_color, 1.25)));
+    background-color: shade (@internal_element_color, 1.37);
 }
 
 GtkScale.trough.horizontal {
-    background-image: -gtk-gradient (linear,
-                                     left top, left bottom,
-                                     from (@trough_bg_color_a),
-                                     to (shade (@trough_bg_color_b, 1.20)));
+    -adwaita-inset-bottom: alpha (@theme_base_color, 0.50);
 }
 
 GtkScale.trough.vertical {
-    background-image: -gtk-gradient (linear,
-                                     left top, right top,
-                                     from (@trough_bg_color_a),
-                                     to (shade (@trough_bg_color_b, 1.20)));
+    -adwaita-inset-right: alpha (@theme_base_color, 0.50);
+}
+
+GtkScale.trough:insensitive {
+    background-color: @insensitive_bg_color;
+    background-image: none;
+
+    -adwaita-border-gradient: none;
+    -adwaita-inset-bottom: none;
 }
 
 GtkScale.progressbar {
-    background-image: -gtk-gradient (linear,
-                                     left top, left bottom,
-                                     from (@scale_fill_a),
-                                     to (@scale_fill_b));
+    background-color: @scale_fill;
 
-    border-color: #1864b2;
     border-width: 1;
     border-radius: 3;
     border-style: solid;
+
+    -adwaita-border-gradient: -gtk-gradient (linear,
+                                             left top, left bottom,
+                                             from (@scale_border_a),
+                                             to (@scale_border_b));    
 }
 
 GtkScale.mark {
@@ -838,25 +853,29 @@ GtkSwitch.trough {
                                      left top, left bottom,
                                      from (@trough_bg_color_a),
                                      to (@trough_bg_color_b));
+
+    -adwaita-inset-bottom: alpha (@theme_base_color, 0.24);
 }
 
 GtkSwitch.trough:active {
     color: @theme_base_color;
-    -adwaita-border-gradient: -gtk-gradient (linear,
-                                             left top, left bottom,
-                                             from (shade (@theme_selected_bg_color, 0.70)),
-                                             to (shade (@theme_selected_bg_color, 0.94)));
     background-image: -gtk-gradient (linear,
                                      left top, left bottom,
                                      from (@active_switch_bg_color_a),
                                      to (@active_switch_bg_color_b));
+
+    -adwaita-border-gradient: -gtk-gradient (linear,
+                                             left top, left bottom,
+                                             from (shade (@theme_selected_bg_color, 0.70)),
+                                             to (shade (@theme_selected_bg_color, 0.94)));
 }
 
 GtkSwitch.trough:insensitive {
     background-image: none;
     background-color: shade (@theme_bg_color, 0.9);
-    border-color: shade (@inactive_frame_color, 0.845);
     -adwaita-border-gradient: none;
+
+    -adwaita-inset-bottom: none;
 }
 
 GtkSwitch.slider {
@@ -867,14 +886,13 @@ GtkSwitch.slider {
     padding: 2;
     background-image: -gtk-gradient (linear,
                                      left top, left bottom,
-                                     from (@switch_slider_color),
-                                     color-stop (0.02, @switch_slider_color),
-                                     color-stop (0.03, @theme_base_color),
-                                     color-stop (0.85, @switch_slider_color),
-                                     color-stop (0.86, shade (@switch_slider_color, 1.03)),
-                                     to (shade (@switch_slider_color, 1.03)));
+                                     from (@theme_base_color),
+                                     to (@switch_slider_color));
 
     -adwaita-switch-grip-color: shade (@switch_slider_color, 0.97);
+
+    -adwaita-inset-top: @switch_slider_color;
+    -adwaita-inset-bottom: alpha (@theme_base_color, 0.50);
 }
 
 GtkSwitch.slider:active {
@@ -885,6 +903,9 @@ GtkSwitch.slider:insensitive {
     border-style: none;
     background-image: none;
     background-color: @insensitive_bg_color;
+
+    -adwaita-inset-top: none;
+    -adwaita-inset-bottom: none;
 }
 
 GtkStatusbar {
diff --git a/themes/Adwaita/gtk-3.0/gtk.css b/themes/Adwaita/gtk-3.0/gtk.css
index 353c0a5..63146a1 100644
--- a/themes/Adwaita/gtk-3.0/gtk.css
+++ b/themes/Adwaita/gtk-3.0/gtk.css
@@ -50,6 +50,7 @@
 @define-color chrome_fg_color #fff;
 
 @define-color focused_entry_border #579eea;
+ define-color focused_entry_inset alpha (#d7e4f1, 0.50);
 
 @define-color button_gradient_color_a #f4f6f4;
 @define-color button_gradient_color_b #d7dad7;
@@ -77,8 +78,8 @@
 @define-color progressbar_background_b #1f72c6;
 @define-color progressbar_border #3277bf;
 
- define-color scale_fill_a #2c85e2;
- define-color scale_fill_b #b8d6f5;
+ define-color scale_fill #2c85e2;
+ define-color scale_border #1864b2;
 
 @define-color highlighted_border #8a8f8a;
 @define-color internal_element_color #888a85;



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