X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fxlock.h;h=d509f563c37103b0d19aa0cfb5d4cd69ee21da40;hb=6bb727f03bff0389fbb1349d7df4c9d8d7532959;hp=19e5fdab1fd879d24d8e6b1601ad6657a81ccc37;hpb=ccbc9f87eb59497b23bd0424ee1ed20ad7c7db54;p=xscreensaver diff --git a/hacks/xlock.h b/hacks/xlock.h index 19e5fdab..d509f563 100644 --- a/hacks/xlock.h +++ b/hacks/xlock.h @@ -4,10 +4,15 @@ ** ** for xlock 2.3 and xscreensaver 1.2, 28AUG92 ** -** ** Modified for xlockmore 3.0 by Anthony Thyssen ** on August 1995. ** +** Tweaked by jwz to work with both ANSI and K&R compilers, 10-May-97. +** +** Note: this file no longer works as of (at least) xlockmore 4.03a10: +** see jwz's new xlockmore.h file for a similar hack that works with +** code written for that version. +** ** To use, just copy the appropriate file from xlock, add a target ** for it in the Imakefile, and do the following: ** @@ -60,10 +65,14 @@ static Display *dsp; static int screen = 0; static void +#ifdef __STDC__ +My_XGetWindowAttributes (Display *dpy, Window win, XWindowAttributes *xgwa) +#else /* !__STDC__ */ My_XGetWindowAttributes (dpy, win, xgwa) Display *dpy; Window win; XWindowAttributes *xgwa; +#endif /* !__STDC__ */ { XGetWindowAttributes (dpy, win, xgwa); @@ -135,26 +144,49 @@ XrmOptionDescRec options[] = { {"-ncolors", ".ncolors", XrmoptionSepArg, 0}, {"-delay", ".delay", XrmoptionSepArg, 0}, {"-cycles", ".cycles", XrmoptionSepArg, 0}, + { 0, 0, 0, 0 } }; -int options_size = (sizeof (options) / sizeof (options[0])); -#define PROGRAM(Y,Z,D,B,C,S) \ -char *progclass = Y; \ +#if defined(__STDC__) || defined(__ANSI_CPP__) +# define XLOCK_INIT(Z) init##Z +# define XLOCK_DRAW(Z) draw##Z +#else /* K&R CPP */ +# define XLOCK_INIT(Z) init/**/Z +# define XLOCK_DRAW(Z) draw/**/Z +#endif /* K&R CPP */ + +#ifdef __STDC__ +# define XLOCK_SCREENHACK_PROTOTYPE() \ + screenhack(Display *dpy, Window window) +# define XLOCK_PROTOS(Z) /* */ +#else /* K&R C */ +# define XLOCK_SCREENHACK_PROTOTYPE() \ + screenhack(dpy, window) \ + Display *dpy; \ + Window window; +# define XLOCK_PROTOS(Z) \ + void init##Z(Window); \ + void draw##Z(Window); \ + +#endif /* K&R C */ + +#define PROGRAM(Y,Z,D,B,C,S) \ + char *progclass = Y; \ + XLOCK_PROTOS(Z) \ \ -void screenhack (dpy, window) \ - Display *dpy; \ - Window window; \ -{ \ - batchcount = B; \ - delay = D; \ - cycles = C; \ - saturation = S; \ - dsp = dpy; \ + void XLOCK_SCREENHACK_PROTOTYPE() \ + { \ + batchcount = B; \ + delay = D; \ + cycles = C; \ + saturation = S; \ + dsp = dpy; \ \ - init##Z (window); \ - while (1) { \ - draw##Z (window); \ - XSync (dpy, True); \ - if (delay) usleep (delay); \ - } \ -} + XLOCK_INIT(Z) (window); \ + while (1) \ + { \ + XLOCK_DRAW(Z) (window); \ + XSync (dpy, True); \ + if (delay) usleep (delay); \ + } \ + }