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
This commit is contained in:
Doug Torrance 2015-01-24 12:05:37 -06:00 committed by Carlos R. Mafra
parent 3f77d709f9
commit 906ed7723c
2 changed files with 11 additions and 3 deletions

View file

@ -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

View file

@ -2,7 +2,7 @@
#include <assert.h>
#ifdef WITH_GDKPIXBUF
#include <gdk-pixbuf/gdk-pixbuf-xlib.h>
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h>
#endif
#include <dockapp.h>
@ -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)) ;