#include "xlockmoreI.h"
#include "screenhack.h"
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
# include <X11/Intrinsic.h>
-#endif /* !HAVE_COCOA */
+#endif /* !HAVE_JWXYZ */
#define countof(x) (sizeof((x))/sizeof(*(x)))
/* Put on the PROGCLASS.background/foreground resources. */
s = (char *) malloc(50);
*s = 0;
-# ifndef HAVE_COCOA
+# ifndef HAVE_JWXYZ
strcpy (s, progclass);
# endif
strcat (s, ".background: black");
s = (char *) malloc(50);
*s = 0;
-# ifndef HAVE_COCOA
+# ifndef HAVE_JWXYZ
strcpy (s, progclass);
# endif
strcat (s, ".foreground: white");
mi->window = window;
XGetWindowAttributes (dpy, window, &mi->xgwa);
-#ifdef HAVE_COCOA
+#ifdef HAVE_JWXYZ
- /* In Cocoa-based xscreensaver, all hacks run in the same address space,
- so each one needs to get its own screen number. Believe what jwxyz
- says about screen counts and numbers.
+# if 0
+ /* In Cocoa and Android-based xscreensaver, all hacks run in the
+ same address space, so each one needs to get its own screen
+ number. Believe what jwxyz says about screen counts and numbers.
*/
mi->num_screens = ScreenCount (dpy);
mi->screen_number = XScreenNumberOfScreen (mi->xgwa.screen);
+# else
+ /* No, that doesn't work.
+ The xlockmore docs/HACKERS.GUIDE says that xlock modes are supposed to
+ support repeated calls to init_*() for the same screen in the same
+ session, but in practice, a number of them blow up if you do that.
+ So instead we're stuck with a world where on OSX/iOS, we have to
+ increment the screen number every time the hack is run. Arrgh.
+ */
+ mi->num_screens = 40;
+ mi->screen_number = xlmft->screen_count;
+ if (mi->screen_number >= mi->num_screens) abort();
+ xlmft->screen_count++;
+# endif
root_p = True;
-#else /* !HAVE_COCOA -- real Xlib */
+#else /* real Xlib */
/* In Xlib-based xscreensaver, each hack runs in its own address space,
so each one only needs to be aware of one screen.
/* Everybody gets motion events, just in case. */
XSelectInput (dpy, window, (mi->xgwa.your_event_mask | PointerMotionMask));
-#endif /* !HAVE_COCOA */
+#endif /* !HAVE_JWXYZ */
color.flags = DoRed|DoGreen|DoBlue;
color.red = color.green = color.blue = 0;
if (mono_p)
{
- static unsigned long pixels[2];
static XColor colors[2];
MONO:
mi->npixels = 2;
if (!mi->colors)
mi->colors = (XColor *)
calloc (mi->npixels, sizeof (*mi->colors));
- pixels[0] = mi->black;
- pixels[1] = mi->white;
colors[0].flags = DoRed|DoGreen|DoBlue;
colors[1].flags = DoRed|DoGreen|DoBlue;
colors[0].red = colors[0].green = colors[0].blue = 0;