- if (!get_boolean_resource ("root", "Boolean"))
- {
- XWindowAttributes xgwa;
- XGetWindowAttributes (dpy, window, &xgwa);
- XSelectInput (dpy, window,
- xgwa.your_event_mask |
- KeyPressMask | ButtonPressMask | ExposureMask);
- }
+ global_program = get_string_resource (dpy, "program", "Program");
+ global_fast_p = get_boolean_resource (dpy, "fast", "Boolean");
+
+
+ /* Kludge for MacOS standalone mode: see OSX/SaverRunner.m. */
+ {
+ const char *s = getenv ("XSCREENSAVER_STANDALONE");
+ if (s && *s && strcmp(s, "0"))
+ {
+ st->controller = terminal_controller;
+ st->random_p = False;
+ global_program = getenv ("SHELL");
+ global_fast_p = True;
+ }
+ }
+
+
+ if (! st->random_p) {
+ if (st->controller == terminal_controller ||
+ st->controller == slideshow_controller)
+ st->duration = 999999; /* these run "forever" */
+ }
+
+ return st;
+}
+
+static unsigned long
+apple2_draw (Display *dpy, Window window, void *closure)
+{
+ struct state *st = (struct state *) closure;
+
+ if (! st->sim) {
+ if (st->random_p)
+ st->controller = controllers[random() % (countof(controllers))];
+ st->sim = apple2_start (dpy, window, st->duration, st->controller);
+ }