summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-01-06 00:02:50 +0300
committermonsta <[email protected]>2016-01-10 19:24:27 +0300
commitd06b2095e4fd8d3ecc231ce523a76a60b34a77db (patch)
treeb2be4d1221a20785f0163738da7a6ce5cabe014f
parent53f35b2242e75401ac667923a7b1d684d6edeb2b (diff)
downloadmate-panel-d06b2095e4fd8d3ecc231ce523a76a60b34a77db.tar.bz2
mate-panel-d06b2095e4fd8d3ecc231ce523a76a60b34a77db.tar.xz
background: reduce number of #if's again
-rw-r--r--mate-panel/panel-background.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/mate-panel/panel-background.c b/mate-panel/panel-background.c
index 8415a121..4c46ea8f 100644
--- a/mate-panel/panel-background.c
+++ b/mate-panel/panel-background.c
@@ -414,18 +414,11 @@ composite_image_onto_desktop (PanelBackground *background)
#if GTK_CHECK_VERSION (3, 0, 0)
static cairo_pattern_t *
-#else
-static GdkPixbuf *
-#endif
composite_color_onto_desktop (PanelBackground *background)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *surface;
cairo_pattern_t *pattern;
cairo_t *cr;
-#else
- guint32 color;
-#endif
if (!background->desktop)
background->desktop = get_desktop_pixbuf (background);
@@ -433,7 +426,6 @@ composite_color_onto_desktop (PanelBackground *background)
if (!background->desktop)
return NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
surface = gdk_window_create_similar_surface (background->window,
CAIRO_CONTENT_COLOR_ALPHA,
background->region.width,
@@ -459,7 +451,19 @@ composite_color_onto_desktop (PanelBackground *background)
cairo_surface_destroy (surface);
return pattern;
+}
#else
+static GdkPixbuf *
+composite_color_onto_desktop (PanelBackground *background)
+{
+ guint32 color;
+
+ if (!background->desktop)
+ background->desktop = get_desktop_pixbuf (background);
+
+ if (!background->desktop)
+ return NULL;
+
color = ((background->color.gdk.red & 0xff00) << 8) +
(background->color.gdk.green & 0xff00) +
(background->color.gdk.blue >> 8);
@@ -471,8 +475,8 @@ composite_color_onto_desktop (PanelBackground *background)
GDK_INTERP_NEAREST,
(255 - (background->color.alpha >> 8)),
255, color, color);
-#endif
}
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
static cairo_pattern_t *