[murrine] Added disable_focus = TRUE option. Fixed focus_color.



commit fd55579b31a0ea185bb6fb447ab3cc8f965eeb47
Author: Andrea <andrea cimitan gmail com>
Date:   Thu Mar 25 12:38:46 2010 +0100

    Added disable_focus = TRUE option.
    Fixed focus_color.

 NEWS                     |    1 +
 schema/murrine.xml.in.in |    6 +++++
 src/murrine_rc_style.c   |    9 +++++++
 src/murrine_rc_style.h   |   53 ++++++++++++++++++++++++---------------------
 src/murrine_style.c      |   39 ++++++++++++++++++++++-----------
 src/murrine_style.h      |    1 +
 6 files changed, 71 insertions(+), 38 deletions(-)
---
diff --git a/NEWS b/NEWS
index cfd4851..e3ed2d2 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Changes in this release:
               to set the colors used on the border of many widgets.
               border_colors = FALSE to disable.
 - New option: comboboxstyle = 1 to colorize the GtkComboBox below the arrow.
+- New option: disable_focus = TRUE to disable focus drawing.
 - New option: gradient_colors = { "#ffffff", "#ffffff", "#ffffff", "#ffffff" }
               to set the colors used on the gradient of many widgets.
               gradient_colors = FALSE to disable.
diff --git a/schema/murrine.xml.in.in b/schema/murrine.xml.in.in
index 06a227b..ea425be 100644
--- a/schema/murrine.xml.in.in
+++ b/schema/murrine.xml.in.in
@@ -53,6 +53,12 @@
 		<precision>2</precision>
 	</option>
 
+	<option type="boolean" name="disable_focus" default="FALSE">
+		<_long_name>Disable Focus</_long_name>
+		<_description>Disable focus drawing</_description>
+		<section>General</section>
+	</option>
+
 	<option type="color" name="focus_color" default="#000000">
 		<_long_name>Focus Color</_long_name>
 		<section>General</section>
diff --git a/src/murrine_rc_style.c b/src/murrine_rc_style.c
index f7672e4..299893d 100644
--- a/src/murrine_rc_style.c
+++ b/src/murrine_rc_style.c
@@ -42,6 +42,7 @@ enum
 	TOKEN_COLORIZE_SCROLLBAR,
 	TOKEN_COMBOBOXSTYLE,
 	TOKEN_CONTRAST,
+	TOKEN_DISABLE_FOCUS,
 	TOKEN_FOCUS_COLOR,
 	TOKEN_GLAZESTYLE,
 	TOKEN_GLOW_SHADE,
@@ -100,6 +101,7 @@ theme_symbols[] =
 	{ "colorize_scrollbar",  TOKEN_COLORIZE_SCROLLBAR },
 	{ "comboboxstyle",       TOKEN_COMBOBOXSTYLE },
 	{ "contrast",            TOKEN_CONTRAST },
+	{ "disable_focus",       TOKEN_DISABLE_FOCUS },
 	{ "focus_color",         TOKEN_FOCUS_COLOR },
 	{ "glazestyle",          TOKEN_GLAZESTYLE },
 	{ "glow_shade",          TOKEN_GLOW_SHADE },
@@ -164,6 +166,7 @@ murrine_rc_style_init (MurrineRcStyle *murrine_rc)
 	murrine_rc->colorize_scrollbar = TRUE;
 	murrine_rc->comboboxstyle = 0;
 	murrine_rc->contrast = 1.0;
+	murrine_rc->disable_focus = FALSE;
 	murrine_rc->has_border_colors = FALSE;
 	murrine_rc->has_gradient_colors = FALSE;
 	murrine_rc->glazestyle = 1;
@@ -631,6 +634,10 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
 				token = theme_parse_shade (settings, scanner, &murrine_style->contrast);
 				murrine_style->flags |= MRN_FLAG_CONTRAST;
 				break;
+			case TOKEN_DISABLE_FOCUS:
+				token = theme_parse_boolean (settings, scanner, rc_style, &murrine_style->disable_focus);
+				murrine_style->flags |= MRN_FLAG_DISABLE_FOCUS;
+				break;
 			case TOKEN_FOCUS_COLOR:
 				token = theme_parse_color (settings, scanner, rc_style, &murrine_style->focus_color);
 				murrine_style->flags |= MRN_FLAG_FOCUS_COLOR;
@@ -832,6 +839,8 @@ murrine_rc_style_merge (GtkRcStyle *dest,
 		dest_w->comboboxstyle = src_w->comboboxstyle;
 	if (flags & MRN_FLAG_CONTRAST)
 		dest_w->contrast = src_w->contrast;
+	if (flags & MRN_FLAG_DISABLE_FOCUS)
+		dest_w->disable_focus = src_w->disable_focus;
 	if (flags & MRN_FLAG_FOCUS_COLOR)
 		dest_w->focus_color = src_w->focus_color;
 	if (flags & MRN_FLAG_GLAZESTYLE)
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index d65db31..51265d5 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -40,31 +40,32 @@ typedef enum
 	MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 2,
 	MRN_FLAG_COMBOBOXSTYLE = 1 << 3,
 	MRN_FLAG_CONTRAST = 1 << 4,
-	MRN_FLAG_FOCUS_COLOR = 1 << 5,
-	MRN_FLAG_GLAZESTYLE = 1 << 6,
-	MRN_FLAG_GLOW_SHADE = 1 << 7,
-	MRN_FLAG_GLOWSTYLE = 1 << 8,
-	MRN_FLAG_HIGHLIGHT_SHADE = 1 << 9,
-	MRN_FLAG_LIGHTBORDER_SHADE = 1 << 10,
-	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 11,
-	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 12,
-	MRN_FLAG_LISTVIEWSTYLE = 1 << 13,
-	MRN_FLAG_MENUBARITEMSTYLE = 1 << 14,
-	MRN_FLAG_MENUBARSTYLE = 1 << 15,
-	MRN_FLAG_MENUITEMSTYLE = 1 << 16,
-	MRN_FLAG_MENUSTYLE = 1 << 17,
-	MRN_FLAG_PRELIGHT_SHADE = 1 << 18,
-	MRN_FLAG_PROGRESSBARSTYLE = 1 << 19,
-	MRN_FLAG_RELIEFSTYLE = 1 << 20,
-	MRN_FLAG_RGBA = 1 << 21,
-	MRN_FLAG_ROUNDNESS = 1 << 22,
-	MRN_FLAG_SCROLLBARSTYLE = 1 << 23,
-	MRN_FLAG_SEPARATORSTYLE = 1 << 24,
-	MRN_FLAG_SLIDERSTYLE = 1 << 25,
-	MRN_FLAG_SPINBUTTONSTYLE = 1 << 26,
-	MRN_FLAG_STEPPERSTYLE = 1 << 27,
-	MRN_FLAG_TEXTSTYLE = 1 << 28,
-	MRN_FLAG_TOOLBARSTYLE = 1 << 29
+	MRN_FLAG_DISABLE_FOCUS = 1 << 5,
+	MRN_FLAG_FOCUS_COLOR = 1 << 6,
+	MRN_FLAG_GLAZESTYLE = 1 << 7,
+	MRN_FLAG_GLOW_SHADE = 1 << 8,
+	MRN_FLAG_GLOWSTYLE = 1 << 9,
+	MRN_FLAG_HIGHLIGHT_SHADE = 1 << 10,
+	MRN_FLAG_LIGHTBORDER_SHADE = 1 << 11,
+	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 12,
+	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 13,
+	MRN_FLAG_LISTVIEWSTYLE = 1 << 14,
+	MRN_FLAG_MENUBARITEMSTYLE = 1 << 15,
+	MRN_FLAG_MENUBARSTYLE = 1 << 16,
+	MRN_FLAG_MENUITEMSTYLE = 1 << 17,
+	MRN_FLAG_MENUSTYLE = 1 << 18,
+	MRN_FLAG_PRELIGHT_SHADE = 1 << 19,
+	MRN_FLAG_PROGRESSBARSTYLE = 1 << 20,
+	MRN_FLAG_RELIEFSTYLE = 1 << 21,
+	MRN_FLAG_RGBA = 1 << 22,
+	MRN_FLAG_ROUNDNESS = 1 << 23,
+	MRN_FLAG_SCROLLBARSTYLE = 1 << 24,
+	MRN_FLAG_SEPARATORSTYLE = 1 << 25,
+	MRN_FLAG_SLIDERSTYLE = 1 << 26,
+	MRN_FLAG_SPINBUTTONSTYLE = 1 << 27,
+	MRN_FLAG_STEPPERSTYLE = 1 << 28,
+	MRN_FLAG_TEXTSTYLE = 1 << 29,
+	MRN_FLAG_TOOLBARSTYLE = 1 << 30
 } MurrineRcFlags;
 
 typedef enum
@@ -118,7 +119,9 @@ struct _MurrineRcStyle
 
 	gboolean animation;
 	gboolean colorize_scrollbar;
+	gboolean disable_focus;
 	gboolean has_border_colors;
+	gboolean has_focus_color;
 	gboolean has_gradient_colors;
 	gboolean rgba;
 
diff --git a/src/murrine_style.c b/src/murrine_style.c
index ba8dd83..323d513 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -131,7 +131,7 @@ murrine_set_widget_parameters (const GtkWidget  *widget,
 	params->state_type = (MurrineStateType)state_type;
 	params->corners    = MRN_CORNER_ALL;
 	params->ltr        = murrine_widget_is_ltr ((GtkWidget*)widget);
-	params->focus      = widget && GTK_WIDGET_HAS_FOCUS (widget);
+	params->focus      = !MURRINE_STYLE (style)->disable_focus && widget && GTK_WIDGET_HAS_FOCUS (widget);
 	params->is_default = widget && GTK_WIDGET_HAS_DEFAULT (widget);
 
 	params->xthickness = style->xthickness;
@@ -160,17 +160,17 @@ murrine_set_widget_parameters (const GtkWidget  *widget,
 	{
 		mrn_gradient.has_gradient_colors = TRUE;
 		murrine_gdk_color_to_rgb (&murrine_style->gradient_colors[0], &mrn_gradient.gradient_colors[0].r,
-	                                                                  &mrn_gradient.gradient_colors[0].g,
-	                                                                  &mrn_gradient.gradient_colors[0].b);
+	                                                                      &mrn_gradient.gradient_colors[0].g,
+	                                                                      &mrn_gradient.gradient_colors[0].b);
 		murrine_gdk_color_to_rgb (&murrine_style->gradient_colors[1], &mrn_gradient.gradient_colors[1].r,
-	                                                                  &mrn_gradient.gradient_colors[1].g,
-	                                                                  &mrn_gradient.gradient_colors[1].b);
+	                                                                      &mrn_gradient.gradient_colors[1].g,
+	                                                                      &mrn_gradient.gradient_colors[1].b);
 		murrine_gdk_color_to_rgb (&murrine_style->gradient_colors[2], &mrn_gradient.gradient_colors[2].r,
-	                                                                  &mrn_gradient.gradient_colors[2].g,
-	                                                                  &mrn_gradient.gradient_colors[2].b);
+	                                                                      &mrn_gradient.gradient_colors[2].g,
+	                                                                      &mrn_gradient.gradient_colors[2].b);
 		murrine_gdk_color_to_rgb (&murrine_style->gradient_colors[3], &mrn_gradient.gradient_colors[3].r,
-	                                                                  &mrn_gradient.gradient_colors[3].g,
-	                                                                  &mrn_gradient.gradient_colors[3].b);
+	                                                                      &mrn_gradient.gradient_colors[3].g,
+	                                                                      &mrn_gradient.gradient_colors[3].b);
 		if (params->prelight && !MRN_IS_PROGRESS_BAR(widget)) //progressbar is prelight, no change in shade
 		{
 			mrn_gradient.gradient_shades[0] *= murrine_style->prelight_shade;
@@ -186,11 +186,11 @@ murrine_set_widget_parameters (const GtkWidget  *widget,
 	{
 		mrn_gradient.has_border_colors = TRUE;
 		murrine_gdk_color_to_rgb (&murrine_style->border_colors[0], &mrn_gradient.border_colors[0].r,
-	                                                                &mrn_gradient.border_colors[0].g,
-	                                                                &mrn_gradient.border_colors[0].b);
+	                                                                    &mrn_gradient.border_colors[0].g,
+	                                                                    &mrn_gradient.border_colors[0].b);
 		murrine_gdk_color_to_rgb (&murrine_style->border_colors[1], &mrn_gradient.border_colors[1].r,
-	                                                                &mrn_gradient.border_colors[1].g,
-	                                                                &mrn_gradient.border_colors[1].b);
+	                                                                    &mrn_gradient.border_colors[1].g,
+	                                                                    &mrn_gradient.border_colors[1].b);
 	}
 	else
 		mrn_gradient.has_border_colors = FALSE;
@@ -2003,6 +2003,13 @@ murrine_style_draw_layout (GtkStyle     *style,
 		etched.green = (int) (temp.g*65535);
 		etched.blue = (int) (temp.b*65535);
 
+/*		cairo_t *cr;*/
+/*		cr = murrine_begin_paint (window, area);*/
+/*		cairo_translate (cr, x+xos, y+yos);*/
+/*		murrine_set_color_rgb (cr, &temp);*/
+/*		pango_cairo_show_layout (cr, layout);*/
+/*		cairo_destroy (cr);*/
+		
 		gdk_draw_layout_with_colors (window, gc, x+xos, y+yos, layout, &etched, NULL);
 
 		//printf( "draw_layout: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget->parent));
@@ -2105,6 +2112,10 @@ murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state
 	CHECK_ARGS
 	SANITIZE_SIZE
 
+	/* Just return if focus drawing is disabled. */
+	if (murrine_style->disable_focus)
+		return;
+
 	cr = gdk_cairo_create (window);
 
 	murrine_set_widget_parameters (widget, style, state_type, &params);
@@ -2309,6 +2320,7 @@ murrine_style_init_from_rc (GtkStyle   *style,
 	murrine_style->comboboxstyle       = MURRINE_RC_STYLE (rc_style)->comboboxstyle;
 	murrine_style->contrast            = MURRINE_RC_STYLE (rc_style)->contrast;
 	murrine_style->colorize_scrollbar  = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
+	murrine_style->disable_focus       = MURRINE_RC_STYLE (rc_style)->disable_focus;
 	murrine_style->has_border_colors   = MURRINE_RC_STYLE (rc_style)->has_border_colors;
 	murrine_style->has_focus_color     = MURRINE_RC_STYLE (rc_style)->flags & MRN_FLAG_FOCUS_COLOR;
 	murrine_style->has_gradient_colors = MURRINE_RC_STYLE (rc_style)->has_gradient_colors;
@@ -2439,6 +2451,7 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
 	mrn_style->colors              = mrn_src->colors;
 	mrn_style->comboboxstyle       = mrn_src->comboboxstyle;
 	mrn_style->contrast            = mrn_src->contrast;
+	mrn_style->disable_focus       = mrn_src->disable_focus;
 	mrn_style->focus_color         = mrn_src->focus_color;
 	mrn_style->glazestyle          = mrn_src->glazestyle;
 	mrn_style->glow_shade          = mrn_src->glow_shade;
diff --git a/src/murrine_style.h b/src/murrine_style.h
index d6a85fd..3bfbcf0 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -76,6 +76,7 @@ struct _MurrineStyle
 
 	gboolean animation;
 	gboolean colorize_scrollbar;
+	gboolean disable_focus;
 	gboolean has_border_colors;
 	gboolean has_focus_color;
 	gboolean has_gradient_colors;



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