summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eel/eel-background.c53
-rw-r--r--eel/eel-gdk-extensions.c41
2 files changed, 61 insertions, 33 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 2e2b40cf..2477ddd0 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -258,14 +258,11 @@ eel_bg_get_desktop_color (EelBackground *self)
return color_spec;
}
+#if GTK_CHECK_VERSION (3, 0, 0)
static void
set_image_properties (EelBackground *self)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA c;
-#else
- GdkColor c;
-#endif
if (self->details->is_desktop && !self->details->color)
self->details->color = eel_bg_get_desktop_color (self);
@@ -278,39 +275,65 @@ set_image_properties (EelBackground *self)
}
else if (!eel_gradient_is_gradient (self->details->color))
{
-#if GTK_CHECK_VERSION (3, 0, 0)
eel_gdk_rgba_parse_with_white_default (&c, self->details->color);
-#else
- eel_gdk_color_parse_with_white_default (self->details->color, &c);
-#endif
make_color_inactive (self, &c);
mate_bg_set_color (self->details->bg, MATE_BG_COLOR_SOLID, &c, NULL);
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA c1, c2;
-#else
- GdkColor c1, c2;
-#endif
char *spec;
spec = eel_gradient_get_start_color_spec (self->details->color);
-#if GTK_CHECK_VERSION (3, 0, 0)
eel_gdk_rgba_parse_with_white_default (&c1, spec);
make_color_inactive (self, &c1);
g_free (spec);
spec = eel_gradient_get_end_color_spec (self->details->color);
eel_gdk_rgba_parse_with_white_default (&c2, spec);
+ make_color_inactive (self, &c2);
+ g_free (spec);
+
+ if (eel_gradient_is_horizontal (self->details->color)) {
+ mate_bg_set_color (self->details->bg, MATE_BG_COLOR_H_GRADIENT, &c1, &c2);
+ } else {
+ mate_bg_set_color (self->details->bg, MATE_BG_COLOR_V_GRADIENT, &c1, &c2);
+ }
+ }
+}
#else
+static void
+set_image_properties (EelBackground *self)
+{
+ GdkColor c;
+
+ if (self->details->is_desktop && !self->details->color)
+ self->details->color = eel_bg_get_desktop_color (self);
+
+ if (!self->details->color)
+ {
+ c = self->details->default_color;
+ make_color_inactive (self, &c);
+ mate_bg_set_color (self->details->bg, MATE_BG_COLOR_SOLID, &c, NULL);
+ }
+ else if (!eel_gradient_is_gradient (self->details->color))
+ {
+ eel_gdk_color_parse_with_white_default (self->details->color, &c);
+ make_color_inactive (self, &c);
+ mate_bg_set_color (self->details->bg, MATE_BG_COLOR_SOLID, &c, NULL);
+ }
+ else
+ {
+ GdkColor c1, c2;
+ char *spec;
+
+ spec = eel_gradient_get_start_color_spec (self->details->color);
eel_gdk_color_parse_with_white_default (spec, &c1);
make_color_inactive (self, &c1);
g_free (spec);
spec = eel_gradient_get_end_color_spec (self->details->color);
eel_gdk_color_parse_with_white_default (spec, &c2);
-#endif
make_color_inactive (self, &c2);
g_free (spec);
@@ -321,6 +344,8 @@ set_image_properties (EelBackground *self)
}
}
}
+#endif
+
gchar *
eel_background_get_color (EelBackground *self)
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c
index 00697d4c..646c6405 100644
--- a/eel/eel-gdk-extensions.c
+++ b/eel/eel-gdk-extensions.c
@@ -414,23 +414,7 @@ eel_gdk_rgba_to_rgb (const GdkRGBA *color)
(guint) (color->green * 65535),
(guint) (color->blue * 65535));
}
-#else
-/**
- * eel_gdk_color_to_rgb
- * @color: A GdkColor style color.
- * Returns: An rgb value.
- *
- * Converts from a GdkColor style color to a gdk_rgb one.
- * Alpha gets set to fully opaque
- */
-guint32
-eel_gdk_color_to_rgb (const GdkColor *color)
-{
- return eel_rgb16_to_rgb (color->red, color->green, color->blue);
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
/**
* eel_gdk_rgb_to_rgba
* @color: a gdk_rgb style value.
@@ -448,8 +432,25 @@ eel_gdk_rgb_to_rgba (guint32 color)
result.red = ((color >> 16) & 0xFF) / 0xFF;
result.green = ((color >> 8) & 0xFF) / 0xFF;
result.blue = (color & 0xff) / 0xFF;
+
+ return result;
+}
#else
/**
+ * eel_gdk_color_to_rgb
+ * @color: A GdkColor style color.
+ * Returns: An rgb value.
+ *
+ * Converts from a GdkColor style color to a gdk_rgb one.
+ * Alpha gets set to fully opaque
+ */
+guint32
+eel_gdk_color_to_rgb (const GdkColor *color)
+{
+ return eel_rgb16_to_rgb (color->red, color->green, color->blue);
+}
+
+/**
* eel_gdk_rgb_to_color
* @color: a gdk_rgb style value.
*
@@ -467,10 +468,10 @@ eel_gdk_rgb_to_color (guint32 color)
result.green = ((color >> 8) & 0xFF) * 0x101;
result.blue = (color & 0xff) * 0x101;
result.pixel = 0;
-#endif
return result;
}
+#endif
/**
* eel_gdk_rgb_to_color_spec
@@ -565,8 +566,8 @@ eel_gdk_parse_geometry (const char *string, int *x_return, int *y_return,
return gdk_flags;
}
-void
#if GTK_CHECK_VERSION(3,0,0)
+void
eel_cairo_draw_layout_with_drop_shadow (cairo_t *cr,
GdkRGBA *text_color,
GdkRGBA *shadow_color,
@@ -585,7 +586,9 @@ eel_cairo_draw_layout_with_drop_shadow (cairo_t *cr,
pango_cairo_show_layout (cr, layout);
cairo_restore (cr);
+}
#else
+void
eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable,
GdkColor *text_color,
GdkColor *shadow_color,
@@ -605,8 +608,8 @@ eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable,
pango_cairo_show_layout (cr, layout);
cairo_destroy (cr);
-#endif
}
+#endif
#if GTK_CHECK_VERSION(3,0,0)
#define CLAMP_COLOR(v) (t = (v), CLAMP (t, 0, 1))