From db44e0824a95b35ac97fea52881d109407cf0a43 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sun, 27 Dec 2015 14:29:03 +0100 Subject: [PATCH] Fix build for older glib --- src/util/area.c | 1 + src/util/common.c | 15 +++++++++++++++ src/util/common.h | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/src/util/area.c b/src/util/area.c index 277a0b1..8b6b5db 100644 --- a/src/util/area.c +++ b/src/util/area.c @@ -29,6 +29,7 @@ #include "area.h" #include "server.h" #include "panel.h" +#include "common.h" Area *mouse_over_area = NULL; diff --git a/src/util/common.c b/src/util/common.c index d7a5032..908068b 100644 --- a/src/util/common.c +++ b/src/util/common.c @@ -605,3 +605,18 @@ void get_text_size2(PangoFontDescription *font, cairo_surface_destroy(cs); XFreePixmap(server.dsp, pmap); } + +#if !GLIB_CHECK_VERSION (2, 33, 4) +GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data) +{ + list = g_list_copy(list); + + if (func) { + for (GList *l = list; l; l = l->next) { + l->data = func(l->data, user_data); + } + } + + return list; +} +#endif diff --git a/src/util/common.h b/src/util/common.h index 7e5407d..8097caa 100644 --- a/src/util/common.h +++ b/src/util/common.h @@ -100,4 +100,12 @@ void clear_pixmap(Pixmap p, int x, int y, int w, int h); #define free_and_null(p) { free(p); p = NULL; } +#if !GLIB_CHECK_VERSION (2, 33, 4) +GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data); +#endif + +#if !GLIB_CHECK_VERSION (2, 38, 0) +#define g_assert_null(expr) g_assert((expr) == NULL) +#endif + #endif