[murrine] Updated focusstyle = 3



commit 9422781845778e0a587d1ea4466504dfa243c5d5
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Thu May 27 16:59:25 2010 +0100

    Updated focusstyle = 3

 src/murrine_draw.c      |   41 +++++++++++++++++++++++++++++++----------
 src/murrine_draw_rgba.c |   17 +++++++----------
 src/murrine_style.c     |   21 +++++++++++++++++++--
 src/murrine_types.h     |    1 +
 4 files changed, 58 insertions(+), 22 deletions(-)
---
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index 20e5e64..d3c30f6 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -182,6 +182,13 @@ murrine_draw_button (cairo_t *cr,
 		murrine_shade (&border, 0.8, &border);
 		murrine_mix_color (&fill, &colors->spot[1], 0.2, &fill);
 
+		if (button->has_default_button_color)
+		{
+			mrn_gradient_new.has_border_colors = FALSE;
+			mrn_gradient_new.has_gradient_colors = FALSE;
+			murrine_mix_color (&fill, &button->default_button_color, 0.8, &fill);
+		}
+
 		if (mrn_gradient_new.has_border_colors)
 		{
 			murrine_shade (&mrn_gradient_new.border_colors[0], 0.8, &mrn_gradient_new.border_colors[0]);
@@ -262,16 +269,6 @@ murrine_draw_button (cairo_t *cr,
 	                     os+0.5, os+0.5, width-(os*2)-1, height-(os*2)-1,
 	                     widget->roundness, widget->corners,
 	                     mrn_gradient_new, 1.0);
-
-	if (widget->is_default && !widget->disabled && button->has_default_button_color)
-	{
-		cairo_save (cr);
-		cairo_set_line_width (cr, 2.0);
-		murrine_rounded_rectangle (cr, os, os, width-(os*2), height-(os*2), widget->roundness, widget->corners);
-		murrine_set_color_rgba (cr, &button->default_button_color, 0.4);
-		cairo_stroke (cr);
-		cairo_restore (cr);	
-	}
 }
 
 static void
@@ -3000,16 +2997,31 @@ murrine_draw_focus_border (cairo_t *cr,
 	double yoffset = 1.0;
 	double border_alpha = 0.72;
 	double fill_alpha = 0.18;
+	double shadow_alpha = 0.36;
 	boolean focus_fill = TRUE;
 	boolean focus_border = TRUE;
+	boolean focus_shadow = FALSE;
 
 	/* Do some useful things to adjust focus */
 	switch (focus->type)
 	{
+		case MRN_FOCUS_BUTTON_DEFAULT:
+			xoffset = -(focus->padding)-2.0;
+			yoffset = -(focus->padding)-2.0;
+			radius = widget->roundness;
+			focus_fill = FALSE;
+			focus_shadow = TRUE;
+			border_alpha = 0.2;
+			shadow_alpha = 0.4;
+			break;
 		case MRN_FOCUS_BUTTON:
 			xoffset = -(focus->padding)-2.0;
 			yoffset = -(focus->padding)-2.0;
 			radius = widget->roundness;
+			focus_fill = FALSE;
+			focus_shadow = TRUE;
+			border_alpha = 0.8;
+			shadow_alpha = 0.4;			
 			break;
 		case MRN_FOCUS_BUTTON_FLAT:
 			xoffset = -(focus->padding)-2.0;
@@ -3079,6 +3091,14 @@ murrine_draw_focus_border (cairo_t *cr,
 		murrine_set_color_rgba (cr, &fill, border_alpha);
 		cairo_stroke (cr);
 	}
+	
+	if (focus_shadow)
+	{
+		clearlooks_rounded_rectangle (cr, xoffset-0.5, yoffset-0.5, width-(xoffset*2)+1, height-(yoffset*2)+1, radius+1, widget->corners);
+		murrine_set_color_rgba (cr, &fill, shadow_alpha);
+		cairo_stroke (cr);
+	}
+
 }
 
 static void
@@ -3102,6 +3122,7 @@ murrine_draw_focus_inner (cairo_t *cr,
 	/* Do some useful things to adjust focus */
 	switch (focus->type)
 	{
+		case MRN_FOCUS_BUTTON_DEFAULT:
 		case MRN_FOCUS_BUTTON:
 			xoffset = -(focus->padding)+1.0;
 			yoffset = -(focus->padding)+1.0;
diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c
index 62597a7..2ea9160 100644
--- a/src/murrine_draw_rgba.c
+++ b/src/murrine_draw_rgba.c
@@ -176,6 +176,13 @@ murrine_rgba_draw_button (cairo_t *cr,
 		murrine_shade (&border, 0.8, &border);
 		murrine_mix_color (&fill, &colors->spot[1], 0.2, &fill);
 
+		if (button->has_default_button_color)
+		{
+			mrn_gradient_new.has_border_colors = FALSE;
+			mrn_gradient_new.has_gradient_colors = FALSE;
+			murrine_mix_color (&fill, &button->default_button_color, 0.8, &fill);
+		}
+
 		if (mrn_gradient_new.has_border_colors)
 		{
 			murrine_shade (&mrn_gradient_new.border_colors[0], 0.8, &mrn_gradient_new.border_colors[0]);
@@ -259,16 +266,6 @@ murrine_rgba_draw_button (cairo_t *cr,
 	                     os+0.5, os+0.5, width-(os*2)-1, height-(os*2)-1,
 	                     widget->roundness, widget->corners,
 	                     mrn_gradient_new, 1.0);
-
-	if (widget->is_default && !widget->disabled && button->has_default_button_color)
-	{
-		cairo_save (cr);
-		cairo_set_line_width (cr, 2.0);
-		murrine_rounded_rectangle (cr, os, os, width-(os*2), height-(os*2), widget->roundness, widget->corners);
-		murrine_set_color_rgba (cr, &button->default_button_color, 0.4);
-		cairo_stroke (cr);
-		cairo_restore (cr);	
-	}
 }
 
 static void
diff --git a/src/murrine_style.c b/src/murrine_style.c
index 4e4516e..c052501 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -766,7 +766,7 @@ static void
 murrine_style_draw_box (DRAW_ARGS)
 {
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
-	const MurrineColors *colors = &murrine_style->colors;
+	MurrineColors *colors = &murrine_style->colors;
 	cairo_t *cr;
 
 	CHECK_ARGS
@@ -1126,6 +1126,17 @@ murrine_style_draw_box (DRAW_ARGS)
 		else
 			progressbar.orientation = MRN_ORIENTATION_LEFT_TO_RIGHT;
 
+/*		if (gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widget)) > 0.98)*/
+/*		{*/
+/*			colors->spot[1].r = 0.5;*/
+/*			colors->spot[1].g = 1.0;*/
+/*			colors->spot[1].b = 0.5;*/
+
+/*			colors->spot[2].r = 0.2;*/
+/*			colors->spot[2].g = 0.5;*/
+/*			colors->spot[2].b = 0.2;*/
+/*		}*/
+
 		if (!params.ltr)
 		{
 			if (progressbar.orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
@@ -2206,8 +2217,14 @@ murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state
 			if (widget && GTK_IS_BUTTON (widget))
 				g_object_get (G_OBJECT (widget), "relief", &relief, NULL);
 
+
 			if (relief == GTK_RELIEF_NORMAL)
-				focus.type = MRN_FOCUS_BUTTON;
+			{
+				if (widget && GTK_WIDGET_HAS_DEFAULT (widget))
+					focus.type = MRN_FOCUS_BUTTON_DEFAULT;
+				else
+					focus.type = MRN_FOCUS_BUTTON;
+			}
 			else
 				focus.type = MRN_FOCUS_BUTTON_FLAT;
 
diff --git a/src/murrine_types.h b/src/murrine_types.h
index 5fcc4ff..fcacd01 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -120,6 +120,7 @@ typedef enum
 typedef enum
 {
 	MRN_FOCUS_BUTTON,
+	MRN_FOCUS_BUTTON_DEFAULT,
 	MRN_FOCUS_BUTTON_FLAT,
 	MRN_FOCUS_LABEL,
 	MRN_FOCUS_TREEVIEW,



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