X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fnoseguy.c;h=4b25990848fb8caf1eab33e20c8dc359e158be33;hb=bbd0773f2adde4927a6196361d4061e70bf48cd9;hp=0bf10d82899aee773bee6174e58bc8f9910b1bbf;hpb=8eb2873d7054e705c4e83f22d18c40946a9e2529;p=xscreensaver diff --git a/hacks/noseguy.c b/hacks/noseguy.c index 0bf10d82..4b259908 100644 --- a/hacks/noseguy.c +++ b/hacks/noseguy.c @@ -16,6 +16,7 @@ */ #include "screenhack.h" +#include "xpm-pixmap.h" #include extern FILE *popen (const char *, const char *); @@ -56,9 +57,7 @@ static int state; /* indicates states: walking or getting passwd */ static void (*next_fn) (void); -#ifdef HAVE_XPM -# include - +#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) # include "images/noseguy/nose-f1.xpm" # include "images/noseguy/nose-f2.xpm" # include "images/noseguy/nose-f3.xpm" @@ -86,41 +85,19 @@ init_images (void) &left_front, &right_front, &front, &down }; int i; -#ifdef HAVE_XPM +#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) + static char **bits[] = { nose_l1_xpm, nose_l2_xpm, nose_r1_xpm, nose_r2_xpm, nose_f2_xpm, nose_f3_xpm, nose_f1_xpm, nose_f4_xpm }; + + for (i = 0; i < sizeof (images) / sizeof(*images); i++) { - XWindowAttributes xgwa; - XpmAttributes xpmattrs; - Pixmap pixmap = 0; - int result; - xpmattrs.valuemask = 0; - - XGetWindowAttributes (dpy, window, &xgwa); - -# ifdef XpmCloseness - xpmattrs.valuemask |= XpmCloseness; - xpmattrs.closeness = 40000; -# endif -# ifdef XpmVisual - xpmattrs.valuemask |= XpmVisual; - xpmattrs.visual = xgwa.visual; -# endif -# ifdef XpmDepth - xpmattrs.valuemask |= XpmDepth; - xpmattrs.depth = xgwa.depth; -# endif -# ifdef XpmColormap - xpmattrs.valuemask |= XpmColormap; - xpmattrs.colormap = xgwa.colormap; -# endif - - result = XpmCreatePixmapFromData(dpy, window, bits[i], - &pixmap, 0 /* mask */, &xpmattrs); - if (!pixmap || (result != XpmSuccess && result != XpmColorError)) + Pixmap pixmap = xpm_data_to_pixmap (dpy, window, bits[i], + 0, 0, 0); + if (!pixmap) { fprintf (stderr, "%s: Can't load nose images\n", progname); exit (1); @@ -318,7 +295,11 @@ think (void) return 0; } -#define MAXLINES 40 +#define MAXLINES 25 + +#undef BUFSIZ +#define BUFSIZ ((MAXLINES + 1) * 100) + static void talk(int force_erase) @@ -386,7 +367,7 @@ talk(int force_erase) (void) strcpy(args[height], p); if (height == MAXLINES - 1) { - puts("Message too long!"); + /* puts("Message too long!"); */ break; } p = p2 + 1;