[gtk-engines/gnome3] Add accel_label_shade option to mix the accel label toward the background color.



commit 68453e15af90eeee566b33d99592eeee5b2c7a64
Author: Benjamin Berg <benjamin sipsolutions net>
Date:   Sat Apr 3 16:06:37 2010 +0200

    Add accel_label_shade option to mix the accel label toward the background color.

 engines/clearlooks/src/clearlooks_rc_style.c |    9 ++++++++
 engines/clearlooks/src/clearlooks_rc_style.h |    4 ++-
 engines/clearlooks/src/clearlooks_style.c    |   28 ++++++++++++++++++++++++++
 engines/clearlooks/src/clearlooks_style.h    |    1 +
 themes/GNOME3/gtk-2.0/gtkrc                  |    1 +
 5 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/engines/clearlooks/src/clearlooks_rc_style.c b/engines/clearlooks/src/clearlooks_rc_style.c
index d042895..34c3120 100644
--- a/engines/clearlooks/src/clearlooks_rc_style.c
+++ b/engines/clearlooks/src/clearlooks_rc_style.c
@@ -63,6 +63,7 @@ enum
 	TOKEN_RADIUS,
 	TOKEN_HINT,
 	TOKEN_DISABLE_FOCUS,
+	TOKEN_ACCEL_LABEL_SHADE,
 
 	TOKEN_CLASSIC,
 	TOKEN_GLOSSY,
@@ -93,6 +94,7 @@ static gchar* clearlooks_rc_symbols =
 	"radius\0"
 	"hint\0"
 	"disable_focus\0"
+	"accel_label_shade\0"
 
 	"CLASSIC\0"
 	"GLOSSY\0"
@@ -127,6 +129,7 @@ clearlooks_rc_style_init (ClearlooksRcStyle *clearlooks_rc)
 	clearlooks_rc->radius = 3.0;
 	clearlooks_rc->hint = 0;
 	clearlooks_rc->disable_focus = FALSE;
+	clearlooks_rc->accel_label_shade = 1.0;
 }
 
 #ifdef HAVE_WORKING_ANIMATION
@@ -411,6 +414,10 @@ clearlooks_rc_style_parse (GtkRcStyle *rc_style,
 				token = clearlooks_gtk2_rc_parse_boolean (settings, scanner, &clearlooks_style->disable_focus);
 				clearlooks_style->flags |= CL_FLAG_DISABLE_FOCUS;
 				break;
+			case TOKEN_ACCEL_LABEL_SHADE:
+				token = clearlooks_gtk2_rc_parse_double (settings, scanner, &clearlooks_style->accel_label_shade);
+				clearlooks_style->flags |= CL_FLAG_ACCEL_LABEL_SHADE;
+				break;
 
 			/* stuff to ignore */
 			case TOKEN_SUNKENMENU:
@@ -486,6 +493,8 @@ clearlooks_rc_style_merge (GtkRcStyle *dest,
 		dest_w->hint = src_w->hint;
 	if (flags & CL_FLAG_DISABLE_FOCUS)
 		dest_w->disable_focus = src_w->disable_focus;
+	if (flags & CL_FLAG_ACCEL_LABEL_SHADE)
+		dest_w->accel_label_shade = src_w->accel_label_shade;
 
 	dest_w->flags |= src_w->flags;
 }
diff --git a/engines/clearlooks/src/clearlooks_rc_style.h b/engines/clearlooks/src/clearlooks_rc_style.h
index b1cefe3..d6911c2 100644
--- a/engines/clearlooks/src/clearlooks_rc_style.h
+++ b/engines/clearlooks/src/clearlooks_rc_style.h
@@ -55,7 +55,8 @@ typedef enum {
 	CL_FLAG_ANIMATION          = 1 <<  8,
 	CL_FLAG_RADIUS             = 1 <<  9,
 	CL_FLAG_HINT               = 1 <<  10,
-	CL_FLAG_DISABLE_FOCUS      = 1 <<  11
+	CL_FLAG_DISABLE_FOCUS      = 1 <<  11,
+	CL_FLAG_ACCEL_LABEL_SHADE  = 1 <<  12
 } ClearlooksRcFlags;
 
 
@@ -78,6 +79,7 @@ struct _ClearlooksRcStyle
 	double radius;
 	GQuark hint;
 	gboolean disable_focus;
+	double accel_label_shade;
 };
 
 struct _ClearlooksRcStyleClass
diff --git a/engines/clearlooks/src/clearlooks_style.c b/engines/clearlooks/src/clearlooks_style.c
index 296ece7..bdd8691 100644
--- a/engines/clearlooks/src/clearlooks_style.c
+++ b/engines/clearlooks/src/clearlooks_style.c
@@ -1516,6 +1516,7 @@ clearlooks_style_init_from_rc (GtkStyle * style,
 	clearlooks_style->animation           = CLEARLOOKS_RC_STYLE (rc_style)->animation;
 	clearlooks_style->radius              = CLAMP (CLEARLOOKS_RC_STYLE (rc_style)->radius, 0.0, 10.0);
 	clearlooks_style->disable_focus       = CLEARLOOKS_RC_STYLE (rc_style)->disable_focus;
+	clearlooks_style->accel_label_shade   = CLEARLOOKS_RC_STYLE (rc_style)->accel_label_shade;
 
 	if (clearlooks_style->has_focus_color)
 		clearlooks_style->focus_color     = CLEARLOOKS_RC_STYLE (rc_style)->focus_color;
@@ -1846,6 +1847,32 @@ clearlooks_style_draw_layout (GtkStyle * style,
 	g_return_if_fail (window != NULL);
 
 	gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type];
+	g_object_ref (gc);
+
+	if (state_type == GTK_STATE_NORMAL && DETAIL("accellabel")) {
+		ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
+		ClearlooksColors *colors = &clearlooks_style->colors;
+		GdkColor gdk_color;
+		GdkGC *old_gc = gc;
+		CairoColor color;
+
+		g_object_unref (gc);
+		gc = gdk_gc_new (window);
+		gdk_gc_copy (gc, old_gc);
+
+		ge_mix_color (use_text ? &colors->base[state_type] : &colors->bg[state_type],
+		              use_text ? &colors->text[state_type] : &colors->fg[state_type],
+		              clearlooks_style->accel_label_shade,
+		              &color);
+
+		gdk_color.red = color.r * 65535;
+		gdk_color.green = color.g * 65535;
+		gdk_color.blue = color.b * 65535;
+
+		gdk_gc_set_rgb_fg_color (gc, &gdk_color);
+	}
+
+
 
 	if (area)
 		gdk_gc_set_clip_rectangle (gc, area);
@@ -1878,6 +1905,7 @@ clearlooks_style_draw_layout (GtkStyle * style,
 
 	if (area)
 		gdk_gc_set_clip_rectangle (gc, NULL);
+	g_object_unref (gc);
 }
 
 static GdkPixbuf *
diff --git a/engines/clearlooks/src/clearlooks_style.h b/engines/clearlooks/src/clearlooks_style.h
index 5c3b163..61a9a84 100644
--- a/engines/clearlooks/src/clearlooks_style.h
+++ b/engines/clearlooks/src/clearlooks_style.h
@@ -63,6 +63,7 @@ struct _ClearlooksStyle
 	gboolean animation;
 	gfloat   radius;
 	gboolean disable_focus;
+	gdouble  accel_label_shade;
 };
 
 struct _ClearlooksStyleClass
diff --git a/themes/GNOME3/gtk-2.0/gtkrc b/themes/GNOME3/gtk-2.0/gtkrc
index e295475..0ff474f 100644
--- a/themes/GNOME3/gtk-2.0/gtkrc
+++ b/themes/GNOME3/gtk-2.0/gtkrc
@@ -119,6 +119,7 @@ style "default" {
 		animation = FALSE
 		radius = 3.0
 		style = GNOME3
+		accel_label_shade = 1.0
 
 		# Set a hint to disable backward compatibility fallbacks.
 		hint = "use-hints"



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