[nautilus: 16/18] eel-gdk-extensions: port to GtkStyleContext



commit 1d3dd9693de26d91d60ed7a11f6f14df8478f6a6
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Dec 6 15:55:40 2010 +0100

    eel-gdk-extensions: port to GtkStyleContext

 eel/eel-gdk-extensions.c |   32 ++++++++++++++++----------------
 eel/eel-gdk-extensions.h |    6 +++---
 2 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c
index 4fa7973..958ada5 100644
--- a/eel/eel-gdk-extensions.c
+++ b/eel/eel-gdk-extensions.c
@@ -142,13 +142,13 @@ eel_gdk_rgb_to_color_spec (const guint32 color)
  * Return true if the given color is `dark'
  */
 gboolean
-eel_gdk_color_is_dark (GdkColor *color)
+eel_gdk_rgba_is_dark (const GdkRGBA *color)
 {
 	int intensity;
 
-	intensity = (((color->red >> 8) * 77)
-		     + ((color->green >> 8) * 150)
-		     + ((color->blue >> 8) * 28)) >> 8;
+	intensity = ((((int) (color->red) >> 8) * 77)
+		     + (((int) (color->green) >> 8) * 150)
+		     + (((int) (color->blue) >> 8) * 28)) >> 8;
 
 	return intensity < 128;
 }
@@ -193,34 +193,34 @@ eel_gdk_parse_geometry (const char *string, int *x_return, int *y_return,
 }
 
 void
-eel_cairo_draw_layout_with_drop_shadow (cairo_t             *cr,
-				      GdkColor            *text_color,
-				      GdkColor            *shadow_color,
-				      int                  x,
-				      int                  y,
-				      PangoLayout         *layout)
+eel_cairo_draw_layout_with_drop_shadow (cairo_t     *cr,
+					GdkRGBA     *text_color,
+					GdkRGBA     *shadow_color,
+					int          x,
+					int          y,
+					PangoLayout *layout)
 {
         cairo_save (cr);
 
-	gdk_cairo_set_source_color (cr, shadow_color);
+	gdk_cairo_set_source_rgba (cr, shadow_color);
 	cairo_move_to (cr, x+1, y+1);
 	pango_cairo_show_layout (cr, layout);
 	
-	gdk_cairo_set_source_color (cr, text_color);
+	gdk_cairo_set_source_rgba (cr, text_color);
 	cairo_move_to (cr, x, y);
 	pango_cairo_show_layout (cr, layout);
 	
 	cairo_restore (cr);
 }
 
-#define CLAMP_COLOR(v) (t = (v), CLAMP (t, 0, G_MAXUSHORT))
+#define CLAMP_COLOR(v) (t = (v), CLAMP (t, 0, 1))
 #define SATURATE(v) ((1.0 - saturation) * intensity + saturation * (v))
 
 void
-eel_make_color_inactive (GdkColor *color)
+eel_make_color_inactive (GdkRGBA *color)
 {
 	double intensity, saturation;
-	gushort t;
+	gdouble t;
 
 	saturation = 0.7;
 	intensity = color->red * 0.30 + color->green * 0.59 + color->blue * 0.11;
@@ -228,7 +228,7 @@ eel_make_color_inactive (GdkColor *color)
 	color->green = SATURATE (color->green);
 	color->blue = SATURATE (color->blue);
 
-	if (intensity > G_MAXUSHORT / 2) {
+	if (intensity > 0.5) {
 		color->red *= 0.9;
 		color->green *= 0.9;
 		color->blue *= 0.9;
diff --git a/eel/eel-gdk-extensions.h b/eel/eel-gdk-extensions.h
index 70b1005..1d75e70 100644
--- a/eel/eel-gdk-extensions.h
+++ b/eel/eel-gdk-extensions.h
@@ -93,11 +93,11 @@ EelGdkGeometryFlags eel_gdk_parse_geometry                 (const char
 							    guint               *width_return,
 							    guint               *height_return);
 void                eel_cairo_draw_layout_with_drop_shadow (cairo_t             *cr,
-							    GdkColor            *text_color,
-							    GdkColor            *shadow_color,
+							    GdkRGBA            *text_color,
+							    GdkRGBA            *shadow_color,
 							    int                  x,
 							    int                  y,
 							    PangoLayout         *layout);
-void                eel_make_color_inactive                (GdkColor            *color);
+void                eel_make_color_inactive                (GdkRGBA             *color);
 
 #endif /* EEL_GDK_EXTENSIONS_H */



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