Description: Fix white widgets (mostly buttons) with Cairo 1.9 and NVIDIA
 Adds an extra step to murrine_draw_horizontal_glow, ensuring correct gradient
 creation. Without it, the gradient can be overwritten with plain white.
Forwarded: no
Author: Maia Kozheva <sikon@ubuntu.com>
Bug-Ubuntu: https://launchpad.net/bugs/605979
Last-Update: 2010-07-15
–––
Index: gtk2-engines-murrine-0.90.3+git20100323/src/cairo-support.c
===================================================================
--- gtk2-engines-murrine-0.90.3+git20100323.orig/src/cairo-support.c	2010-07-17 02:09:23.575970423 +0700
+++ gtk2-engines-murrine-0.90.3+git20100323/src/cairo-support.c	2010-07-17 02:33:09.905970423 +0700
@@ -539,6 +539,7 @@
 
 	cairo_rectangle (cr, x, y, width, height);
 	cairo_save (cr);
+	cairo_clip (cr);
 	cairo_scale (cr, scaling_factor, 1);
 	pat = cairo_pattern_create_radial ((x+width/2.0)/scaling_factor, y+height, 0,
 	                                   (x+width/2.0)/scaling_factor, y+height, height/2);
@@ -560,6 +561,7 @@
 
 	cairo_rectangle (cr, x, y, width, height);
 	cairo_save (cr);
+	cairo_clip (cr);
 	cairo_scale (cr, scaling_factor, 1);
 	pat = cairo_pattern_create_radial ((x+width/2.0)/scaling_factor, y+height/2, 0,
 	                                   (x+width/2.0)/scaling_factor, y+height/2, height/2);
@@ -579,13 +581,17 @@
 	cairo_pattern_t *pat;
 
 	cairo_rectangle (cr, x, y, width, height);
+	cairo_save (cr);
+	cairo_clip (cr);
 	pat = cairo_pattern_create_linear (x, y, width, 0);
 	murrine_pattern_add_color_stop_rgba (pat, 0.0, glow, 0.0);
 	murrine_pattern_add_color_stop_rgba (pat, 0.5, glow, 0.5);
+	murrine_pattern_add_color_stop_rgba (pat, 0.5, glow, 0.5);
 	murrine_pattern_add_color_stop_rgba (pat, 1.0, glow, 0.0);
 	cairo_set_source (cr, pat);
 	cairo_pattern_destroy (pat);
 	cairo_fill (cr);
+	cairo_restore (cr);
 }
 
 static void
@@ -598,6 +604,7 @@
 
 	cairo_rectangle (cr, x, y, width, height);
 	cairo_save (cr);
+	cairo_clip (cr);
 	cairo_scale (cr, scaling_factor, 1);
 	pat = cairo_pattern_create_radial ((x+width/2.0)/scaling_factor, y, 0,
 	                                   (x+width/2.0)/scaling_factor, y, height/2);
Index: gtk2-engines-murrine-0.90.3+git20100323/src/murrine_style.c
===================================================================
--- gtk2-engines-murrine-0.90.3+git20100323.orig/src/murrine_style.c	2010-07-17 02:09:23.455970423 +0700
+++ gtk2-engines-murrine-0.90.3+git20100323/src/murrine_style.c	2010-07-17 02:33:09.905970423 +0700
@@ -329,10 +329,11 @@
 					pat = cairo_pattern_create_linear (0, 0, width, 0);
 					murrine_pattern_add_color_stop_rgba (pat, 0.0, &colors->bg[0], WINDOW_OPACITY);
 					murrine_pattern_add_color_stop_rgba (pat, 0.5, &colors->bg[0], (WINDOW_OPACITY-0.04));
+					murrine_pattern_add_color_stop_rgba (pat, 0.5, &colors->bg[0], (WINDOW_OPACITY-0.04));
 					murrine_pattern_add_color_stop_rgba (pat, 1.0, &colors->bg[0], WINDOW_OPACITY);
 					cairo_set_source (cr, pat);
 					cairo_rectangle  (cr, x, y, width, height);
-					cairo_fill       (cr);
+					cairo_fill (cr);
 					cairo_pattern_destroy (pat);
 				}
 
Index: gtk2-engines-murrine-0.90.3+git20100323/src/murrine_draw.c
===================================================================
--- gtk2-engines-murrine-0.90.3+git20100323.orig/src/murrine_draw.c	2010-07-17 02:33:09.885970423 +0700
+++ gtk2-engines-murrine-0.90.3+git20100323/src/murrine_draw.c	2010-07-17 02:38:28.205970424 +0700
@@ -236,17 +236,21 @@
 
 		murrine_rounded_rectangle_closed (cr, os+1, os+1, width-(os*2)-2, height-(os*2)-2, widget->roundness-1,
 		                                  widget->corners & (MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMLEFT));
-		cairo_clip (cr);
 
 		cairo_rectangle (cr, os+1, os+1, width-(os*2)-2, 3);
+		cairo_save (cr);
+		cairo_clip (cr);
 		pat = cairo_pattern_create_linear (os+1, os+1, os+1, os+4);
 		murrine_pattern_add_color_stop_rgba (pat, 0.0, &shadow, 0.58);
 		murrine_pattern_add_color_stop_rgba (pat, 1.0, &shadow, 0.0);
 		cairo_set_source (cr, pat);
 		cairo_fill (cr);
 		cairo_pattern_destroy (pat);
+		cairo_restore (cr);
 
 		cairo_rectangle (cr, os+1, os+1, 3, height-(os*2)-2);
+		cairo_save (cr);
+		cairo_clip (cr);
 		pat = cairo_pattern_create_linear (os+1, os+1, os+4, os+1);
 		murrine_pattern_add_color_stop_rgba (pat, 0.0, &shadow, 0.58);
 		murrine_pattern_add_color_stop_rgba (pat, 1.0, &shadow, 0.0);
@@ -255,6 +259,7 @@
 		cairo_pattern_destroy (pat);
 
 		cairo_restore (cr);
+		cairo_restore (cr);
 	}
 
 	murrine_draw_border (cr, &border,
@@ -1404,6 +1409,8 @@
 				pat = cairo_pattern_create_linear (0, 0, width, 0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, dark, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, dark, 0.0);
 				cairo_set_source (cr, pat);
@@ -1428,6 +1435,8 @@
 				pat = cairo_pattern_create_linear (0, 0, width, 0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, highlight, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, highlight, 0.0);
 				cairo_set_source (cr, pat);
@@ -1456,6 +1465,8 @@
 				pat = cairo_pattern_create_linear (0, 0, 0, height);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, dark, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, dark, 0.0);
 				cairo_set_source (cr, pat);
@@ -1479,6 +1490,8 @@
 				pat = cairo_pattern_create_linear (0, 0, 0, height);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, highlight, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, highlight, 0.0);
 				cairo_set_source (cr, pat);
Index: gtk2-engines-murrine-0.90.3+git20100323/src/murrine_draw_rgba.c
===================================================================
--- gtk2-engines-murrine-0.90.3+git20100323.orig/src/murrine_draw_rgba.c	2010-07-17 02:09:23.615970423 +0700
+++ gtk2-engines-murrine-0.90.3+git20100323/src/murrine_draw_rgba.c	2010-07-17 02:40:24.105970424 +0700
@@ -233,17 +233,23 @@
 
 		murrine_rounded_rectangle_closed (cr, os+1, os+1, width-(os*2)-2, height-(os*2)-2, widget->roundness-1,
 		                                  widget->corners & (MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMLEFT));
-		cairo_clip (cr);
 
 		cairo_rectangle (cr, os+1, os+1, width-(os*2)-2, 3);
+		cairo_save (cr);
+		cairo_clip (cr);
+
 		pat = cairo_pattern_create_linear (os+1, os+1, os+1, os+4);
 		murrine_pattern_add_color_stop_rgba (pat, 0.0, &shadow, 0.58);
 		murrine_pattern_add_color_stop_rgba (pat, 1.0, &shadow, 0.0);
 		cairo_set_source (cr, pat);
 		cairo_fill (cr);
 		cairo_pattern_destroy (pat);
+		
+		cairo_restore (cr);
 
 		cairo_rectangle (cr, os+1, os+1, 3, height-(os*2)-2);
+		cairo_save (cr);
+		cairo_clip (cr);
 		pat = cairo_pattern_create_linear (os+1, os+1, os+4, os+1);
 		murrine_pattern_add_color_stop_rgba (pat, 0.0, &shadow, 0.58);
 		murrine_pattern_add_color_stop_rgba (pat, 1.0, &shadow, 0.0);
@@ -252,6 +258,7 @@
 		cairo_pattern_destroy (pat);
 
 		cairo_restore (cr);
+		cairo_restore (cr);
 	}
 
 	murrine_draw_border (cr, &border,
@@ -713,6 +720,7 @@
 			pat = cairo_pattern_create_linear (0, 0, width, 0);
 			murrine_pattern_add_color_stop_rgba (pat, 0.0, fill, MENUBAR_OPACITY);
 			murrine_pattern_add_color_stop_rgba (pat, 0.5, fill, (MENUBAR_OPACITY-0.04));
+			murrine_pattern_add_color_stop_rgba (pat, 0.5, fill, (MENUBAR_OPACITY-0.04));
 			murrine_pattern_add_color_stop_rgba (pat, 1.0, fill, MENUBAR_OPACITY);
 			cairo_set_source (cr, pat);
 			cairo_rectangle  (cr, 0, 0, width, height);
@@ -1025,6 +1033,8 @@
 				pat = cairo_pattern_create_linear (0, 0, width, 0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, dark, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, dark, 0.0);
 				cairo_set_source (cr, pat);
@@ -1049,6 +1059,8 @@
 				pat = cairo_pattern_create_linear (0, 0, width, 0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, highlight, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 0.5);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 0.5);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 0.5);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 0.5);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, highlight, 0.0);
 				cairo_set_source (cr, pat);
@@ -1077,6 +1089,8 @@
 				pat = cairo_pattern_create_linear (0, 0, 0, height);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, dark, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, dark, 1.0);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, dark, 1.0);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, dark, 0.0);
 				cairo_set_source (cr, pat);
@@ -1100,6 +1114,8 @@
 				pat = cairo_pattern_create_linear (0, 0, 0, height);
 				murrine_pattern_add_color_stop_rgba (pat, 0.00, highlight, 0.0);
 				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 0.5);
+				murrine_pattern_add_color_stop_rgba (pat, 0.25, highlight, 0.5);
+				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 0.5);
 				murrine_pattern_add_color_stop_rgba (pat, 0.75, highlight, 0.5);
 				murrine_pattern_add_color_stop_rgba (pat, 1.00, highlight, 0.0);
 				cairo_set_source (cr, pat);
