murrine r157 - in trunk: . src



Author: acimitan
Date: Tue Mar 17 23:49:19 2009
New Revision: 157
URL: http://svn.gnome.org/viewvc/murrine?rev=157&view=rev

Log:
2009-03-18  Andrea Cimitan  <andrea cimitan gmail com>

	* src/murrine_draw.c (murrine_draw_entry):
	* src/murrine_draw_rgba.c (murrine_rgba_draw_entry):
	* src/murrine_style.c (murrine_style_draw_shadow):
	* src/murrine_types.h:
	Use focus->color in draw_entry.


Modified:
   trunk/ChangeLog
   trunk/src/murrine_draw.c
   trunk/src/murrine_draw_rgba.c
   trunk/src/murrine_style.c
   trunk/src/murrine_types.h

Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c	(original)
+++ trunk/src/murrine_draw.c	Tue Mar 17 23:49:19 2009
@@ -247,12 +247,16 @@
 murrine_draw_entry (cairo_t *cr,
                     const MurrineColors    *colors,
                     const WidgetParameters *widget,
+                    const FocusParameters  *focus,
                     int x, int y, int width, int height)
 {
 	const MurrineRGB *base = &colors->base[widget->state_type];
-	const MurrineRGB *border = &colors->shade[widget->disabled ? 4 : 6];
+	MurrineRGB border = colors->shade[widget->disabled ? 4 : 6];
 	int radius = CLAMP (widget->roundness, 0, 3);
 
+	if (widget->focus)
+		border = focus->color;
+
 	cairo_translate (cr, x+0.5, y+0.5);
 
 	/* Fill the entry's base color */
@@ -266,14 +270,17 @@
 	/* Draw the focused border */
 	if (widget->focus)
 	{
+		MurrineRGB focus_shadow;
+		murrine_shade (&border, 1.54, &focus_shadow);
+
 		cairo_rectangle (cr, 2, 2, width-5, height-5);
-		murrine_set_color_rgba (cr, &colors->spot[1], 0.5);
+		murrine_set_color_rgba (cr, &focus_shadow, 0.5);
 		cairo_stroke(cr);
 	}
 	else if (widget->mrn_gradient.gradients)
 	{
 		MurrineRGB shadow;
-		murrine_shade (border, 0.925, &shadow);
+		murrine_shade (&border, 0.925, &shadow);
 
 		cairo_move_to (cr, 2, height-3);
 		cairo_line_to (cr, 2, 2);
@@ -284,7 +291,7 @@
 	}
 
 	/* Draw the border */
-	murrine_set_color_rgb (cr, widget->focus ? &colors->spot[2] : border);
+	murrine_set_color_rgb (cr, &border);
 	murrine_rounded_rectangle (cr, 1, 1, width-3, height-3, radius, widget->corners);
 	cairo_stroke (cr);
 }

Modified: trunk/src/murrine_draw_rgba.c
==============================================================================
--- trunk/src/murrine_draw_rgba.c	(original)
+++ trunk/src/murrine_draw_rgba.c	Tue Mar 17 23:49:19 2009
@@ -247,16 +247,18 @@
 murrine_rgba_draw_entry (cairo_t *cr,
                          const MurrineColors    *colors,
                          const WidgetParameters *widget,
+                         const FocusParameters  *focus,
                          int x, int y, int width, int height)
 {
-	double xos = widget->xthickness > 1 ? 1 : 0;
-	double yos = widget->ythickness > 1 ? 1 : 0;
 	const MurrineRGB *base = &colors->base[widget->state_type];
 	MurrineRGB border = colors->shade[widget->disabled ? 4 : 5];
 	int radius = CLAMP (widget->roundness, 0, 3);
 
 	murrine_shade (&border, 0.92, &border);
 
+	if (widget->focus)
+		border = focus->color;
+
 	cairo_translate (cr, x+0.5, y+0.5);
 
 	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -274,8 +276,11 @@
 	/* Draw the focused border */
 	if (widget->focus)
 	{
+		MurrineRGB focus_shadow;
+		murrine_shade (&border, 1.54, &focus_shadow);
+
 		cairo_rectangle (cr, 2, 2, width-5, height-5);
-		murrine_set_color_rgba (cr, &colors->spot[1], 0.5);
+		murrine_set_color_rgba (cr, &focus_shadow, 0.5);
 		cairo_stroke(cr);
 	}
 	else if (widget->mrn_gradient.gradients)
@@ -291,7 +296,7 @@
 		cairo_stroke (cr);
 	}
 
-	murrine_set_color_rgb (cr, widget->focus ? &colors->spot[2] : &border);
+	murrine_set_color_rgb (cr, &border);
 	murrine_rounded_rectangle (cr, 1, 1, width-3, height-3, radius, widget->corners);
 	cairo_stroke (cr);
 }

Modified: trunk/src/murrine_style.c
==============================================================================
--- trunk/src/murrine_style.c	(original)
+++ trunk/src/murrine_style.c	Tue Mar 17 23:49:19 2009
@@ -362,6 +362,7 @@
 	if (DETAIL ("entry") && !(widget && widget->parent && MRN_IS_TREE_VIEW (widget->parent)))
 	{
 		WidgetParameters params;
+		FocusParameters  focus;
 
 		/* Override the entries state type, because we are too lame to handle this via
 		 * the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */
@@ -405,7 +406,16 @@
 			}
 		}
 
-		STYLE_FUNCTION(draw_entry) (cr, &murrine_style->colors, &params,
+		/* Focus color */
+		if (murrine_style->has_focus_color)
+		{
+			ge_gdk_color_to_cairo (&murrine_style->focus_color, &focus.color);
+			focus.has_color = TRUE;
+		}
+		else
+			focus.color = colors->spot[2];
+
+		STYLE_FUNCTION(draw_entry) (cr, &murrine_style->colors, &params, &focus,
 		                            x, y, width, height);
 	}
 	else if (DETAIL ("frame") && widget && MRN_IS_STATUSBAR (widget->parent))

Modified: trunk/src/murrine_types.h
==============================================================================
--- trunk/src/murrine_types.h	(original)
+++ trunk/src/murrine_types.h	Tue Mar 17 23:49:19 2009
@@ -384,6 +384,7 @@
 	void (*draw_entry) (cairo_t *cr,
 	                    const MurrineColors    *colors,
 	                    const WidgetParameters *widget,
+	                    const FocusParameters  *focus,
 	                    int x, int y, int width, int height);
 
 	void (*draw_entry_progress)   (cairo_t *cr,



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