From 906ed7723cc5cc32c465efad82465f5acdeadf19 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sat, 24 Jan 2015 12:05:37 -0600 Subject: [PATCH] wmmenu: Update to compile with modern GDK-PixBuf. In particular, - We need to link against gdk_pixbuf-2.0 in addition to gdk_pixbuf_xlib-2.0. - The header gdk-pixbuf-xlib.h has been moved to the gdk-pixbuf-xlib directory. - The function gdk_pixbuf_new_from_file now requires two arguments. - We need to define GdkColor ourselves since we don't include gdk.h. Inspired by a patch by Nerijus Baliunas [1]. [1] http://lists.windowmaker.org/dev/msg07994.html --- wmmenu/Makefile | 2 +- wmmenu/pixmaps.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/wmmenu/Makefile b/wmmenu/Makefile index de9cde7..730ad10 100644 --- a/wmmenu/Makefile +++ b/wmmenu/Makefile @@ -11,7 +11,7 @@ ifdef GDKPIXBUF2 PIXBUF_CFG = pkg-config gdk-pixbuf-xlib-2.0 PIXBUF_DEF = -DWITH_GDKPIXBUF PIXBUF_INC := $(shell $(PIXBUF_CFG) --cflags) -PIXBUF_LIB := -rdynamic -L$(shell $(PIXBUF_CFG) --variable=prefix)/lib -lgdk_pixbuf_xlib-2.0 +PIXBUF_LIB := -rdynamic -L$(shell $(PIXBUF_CFG) --variable=prefix)/lib -lgdk_pixbuf_xlib-2.0 -lgdk_pixbuf-2.0 endif CC = gcc #-g diff --git a/wmmenu/pixmaps.c b/wmmenu/pixmaps.c index 8799dbb..92b7d4e 100644 --- a/wmmenu/pixmaps.c +++ b/wmmenu/pixmaps.c @@ -2,7 +2,7 @@ #include #ifdef WITH_GDKPIXBUF -#include +#include #endif #include @@ -28,6 +28,7 @@ extern void Pixmaps_FindLoad (const char * name, GdkPixbuf * pix ; int width, height ; void (* problem) (const char *, ...) ; + GError *gerror = NULL; if (mustInitGdkPixbuf) { @@ -59,7 +60,7 @@ extern void Pixmaps_FindLoad (const char * name, UseDefault () ; } else - if ((pix = gdk_pixbuf_new_from_file (path)) == NULL) + if ((pix = gdk_pixbuf_new_from_file (path, &gerror)) == NULL) { problem ("can't load image \"%s\"", path) ; UseDefault () ; @@ -112,6 +113,13 @@ We have to reimplement a few trivial gdk functions here to avoid linking with it ! */ +typedef struct { + guint32 pixel; + guint16 red; + guint16 green; + guint16 blue; +} GdkColor; + extern gint gdk_screen_width (void) { return DisplayWidth (DADisplay, DefaultScreen (DADisplay)) ;