index a5b94bf..90ef1d2 100644
- $(SAVER_UTIL_SRCS) $(GL_SRCS)
+ $(SAVER_UTIL_SRCS) $(GL_SRCS)
atoms.c- $(SAVER_UTIL_OBJS) $(GL_OBJS)
+ $(SAVER_UTIL_OBJS) $(GL_OBJS)
atoms.o@@ -228,7 +228,7 @@ SCRIPTS = $(SCRIPTS_1) @SCRIPTS_OSX@
+/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <jwz@jwz.org>
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. No representations are made about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+/* Atoms to retrieve info from remote daemon */
+Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
+ XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
+/* Atoms to send commands to remote daemon */
+Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
+ XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
+ XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
+static const struct atom_request remote_control_atom_list[] =
+ { &XA_SCREENSAVER, "SCREENSAVER" },
+ { &XA_SCREENSAVER_ID, "_SCREENSAVER_ID" },
+ { &XA_SCREENSAVER_VERSION, "_SCREENSAVER_VERSION" },
+ { &XA_SCREENSAVER_RESPONSE, "_SCREENSAVER_RESPONSE" },
+ { &XA_SCREENSAVER_STATUS, "_SCREENSAVER_STATUS" },
+ { &XA_ACTIVATE, "ACTIVATE" },
+ { &XA_BLANK, "BLANK" },
+ { &XA_CYCLE, "CYCLE" },
+ { &XA_DEACTIVATE, "DEACTIVATE" },
+ { &XA_PREFS, "PREFS" },
+ { &XA_RESTART, "RESTART" },
+ { &XA_SELECT, "SELECT" },
+ { &XA_THROTTLE, "THROTTLE" },
+ { &XA_UNTHROTTLE, "UNTHROTTLE" },
+ { NULL, NULL } /* Must be last to terminate list */
+const struct atom_request *remote_control_atoms = remote_control_atom_list;
+/* Load a list of atoms in a single round trip to the X server instead of
+ waiting for a synchronous round trip for each and every atom */
+Status request_atoms ( Display *dpy,
+ const struct atom_request **request_lists )
+ const struct atom_request **l, *r;
+ /* Count the number of items across all the lists passed in */
+ for (l = request_lists; l != NULL && *l != NULL; l++)
+ for (r = *l; r != NULL && r->name != NULL; r++)
+ atoms = calloc(atom_count, sizeof(Atom));
+ names = calloc(atom_count, sizeof(char *));
+ for (l = request_lists; l != NULL && *l != NULL; l++)
+ for (r = *l; r != NULL && r->name != NULL; r++)
+ result = XInternAtoms( dpy, (char **) names, atom_count, False, atoms );
+ for (l = request_lists; l != NULL && *l != NULL; l++)
+ for (r = *l; r != NULL && r->name != NULL; r++)
+ fprintf (stderr, "atom: %s => %d\n", names[n], atoms[n]);
+ *(r->atomp) = atoms[n++];
+/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <jwz@jwz.org>
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. No representations are made about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+#ifndef _XSCREENSAVER_ATOMS_H_
+#define _XSCREENSAVER_ATOMS_H_
+extern const struct atom_request *remote_control_atoms;
+extern Status request_atoms ( Display *dpy,
+ const struct atom_request **request_lists );
+/* Atoms to retrieve info from remote daemon */
+extern Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
+ XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
+/* Atoms to send commands to remote daemon */
+extern Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
+ XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
+ XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
+#endif /* _XSCREENSAVER_ATOMS_H_ */
index 6c449f2..3fa27c3 100644
#include "
visual.h" /* for has_writable_cells() */
#include "
remote.h" /* for xscreensaver_command() */
@@ -247,12 +248,6 @@ typedef struct {
a closure object of our own down into the various widget callbacks. */
static state *global_state_kludge;
-Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
-Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
static void populate_demo_window (state *, int list_elt);
static void populate_prefs_page (state *);
static void populate_popup_window (state *);
@@ -5068,20 +5063,11 @@ main (int argc, char **argv)
/* Intern the atoms that xscreensaver_command() needs.
- XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
- XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
- XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
- XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
- XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
- XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
- XA_SELECT = XInternAtom (dpy, "SELECT", False);
- XA_DEMO = XInternAtom (dpy, "DEMO", False);
- XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
- XA_BLANK = XInternAtom (dpy, "BLANK", False);
- XA_LOCK = XInternAtom (dpy, "LOCK", False);
- XA_EXIT = XInternAtom (dpy, "EXIT", False);
- XA_RESTART = XInternAtom (dpy, "RESTART", False);
+ const struct atom_request *atom_lists[2] = { NULL, NULL };
+ atom_lists[0] = remote_control_atoms;
+ request_atoms (dpy, atom_lists);
/* Create the window and all its widgets.
#include "
visual.h" /* for has_writable_cells() */
#include "
remote.h" /* for xscreensaver_command() */
@@ -110,12 +111,6 @@ extern const char *visual_menu[];
static char *short_version = 0;
-Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
-Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
static void populate_demo_window (Widget toplevel,
int which, prefs_pair *pair);
static void populate_prefs_page (Widget top, prefs_pair *pair);
@@ -1791,19 +1786,11 @@ main (int argc, char **argv)
/* Intern the atoms that xscreensaver_command() needs.
- XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
- XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
- XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
- XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
- XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
- XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
- XA_SELECT = XInternAtom (dpy, "SELECT", False);
- XA_DEMO = XInternAtom (dpy, "DEMO", False);
- XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
- XA_BLANK = XInternAtom (dpy, "BLANK", False);
- XA_LOCK = XInternAtom (dpy, "LOCK", False);
- XA_EXIT = XInternAtom (dpy, "EXIT", False);
- XA_RESTART = XInternAtom (dpy, "RESTART", False);
+ const struct atom_request *atom_lists[2] = { NULL, NULL };
+ atom_lists[0] = remote_control_atoms;
+ request_atoms (dpy, atom_lists);
/* Create the window and all its widgets.
index 775036a..59e30c1 100644
ERROR! you must not include
vroot.h in this file
-extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
-extern Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_EXIT;
-extern Atom XA_VROOT, XA_SELECT, XA_DEMO, XA_BLANK, XA_LOCK;
static XErrorHandler old_handler = 0;
index d33f251..6acaddb 100644
@@ -69,14 +69,13 @@ typedef long PROP32;
extern int kill (pid_t, int); /* signal() is in
sys/signal.h... */
Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
Atom XA_NET_WM_USER_TIME;
-Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
-Atom XA_SCREENSAVER_STATUS;
extern saver_info *global_si_kludge; /* I hate C so much... */
index 0057438..80b2813 100644
@@ -48,13 +49,6 @@ ERROR! you must not include
vroot.h in this file
-Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO, XA_EXIT;
-static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
-static Atom XA_RESTART, XA_PREFS, XA_THROTTLE, XA_UNTHROTTLE;
static char *screensaver_version;
__extension__ /* don't warn about "string length is greater than the
@@ -292,28 +286,11 @@ main (int argc, char **argv)
- XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
- XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
- XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
- XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
- XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
- XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
- XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
- XA_DEACTIVATE = XInternAtom (dpy, "DEACTIVATE", False);
- XA_RESTART = XInternAtom (dpy, "RESTART", False);
- XA_CYCLE = XInternAtom (dpy, "CYCLE", False);
- XA_NEXT = XInternAtom (dpy, "NEXT", False);
- XA_PREV = XInternAtom (dpy, "PREV", False);
- XA_SELECT = XInternAtom (dpy, "SELECT", False);
- XA_EXIT = XInternAtom (dpy, "EXIT", False);
- XA_DEMO = XInternAtom (dpy, "DEMO", False);
- XA_PREFS = XInternAtom (dpy, "PREFS", False);
- XA_LOCK = XInternAtom (dpy, "LOCK", False);
- XA_BLANK = XInternAtom (dpy, "BLANK", False);
- XA_THROTTLE = XInternAtom (dpy, "THROTTLE", False);
- XA_UNTHROTTLE = XInternAtom (dpy, "UNTHROTTLE", False);
+ const struct atom_request *atom_lists[2] = { NULL, NULL };
+ atom_lists[0] = remote_control_atoms;
+ request_atoms (dpy, atom_lists);
index 45f0f0c..06f5c13 100644
saver_info *global_si_kludge = 0; /* I hate C so much... */
@@ -240,12 +241,6 @@ char *progclass = 0;
-static Atom XA_SCREENSAVER_RESPONSE;
-static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
-static Atom XA_RESTART, XA_SELECT;
-static Atom XA_THROTTLE, XA_UNTHROTTLE;
-Atom XA_DEMO, XA_PREFS, XA_EXIT, XA_LOCK, XA_BLANK;
static XrmOptionDescRec options [] = {
@@ -667,31 +662,21 @@ connect_to_server (saver_info *si, int *argc, char **argv)
- XA_VROOT = XInternAtom (si->dpy, "__SWM_VROOT", False);
- XA_SCREENSAVER = XInternAtom (si->dpy, "SCREENSAVER", False);
- XA_SCREENSAVER_VERSION = XInternAtom (si->dpy, "_SCREENSAVER_VERSION",False);
- XA_SCREENSAVER_ID = XInternAtom (si->dpy, "_SCREENSAVER_ID", False);
- XA_SCREENSAVER_STATUS = XInternAtom (si->dpy, "_SCREENSAVER_STATUS", False);
- XA_SCREENSAVER_RESPONSE = XInternAtom (si->dpy, "_SCREENSAVER_RESPONSE",
- XA_XSETROOT_ID = XInternAtom (si->dpy, "_XSETROOT_ID", False);
- XA_ESETROOT_PMAP_ID = XInternAtom (si->dpy, "ESETROOT_PMAP_ID", False);
- XA_XROOTPMAP_ID = XInternAtom (si->dpy, "_XROOTPMAP_ID", False);
- XA_NET_WM_USER_TIME = XInternAtom (si->dpy, "_NET_WM_USER_TIME", False);
- XA_ACTIVATE = XInternAtom (si->dpy, "ACTIVATE", False);
- XA_DEACTIVATE = XInternAtom (si->dpy, "DEACTIVATE", False);
- XA_RESTART = XInternAtom (si->dpy, "RESTART", False);
- XA_CYCLE = XInternAtom (si->dpy, "CYCLE", False);
- XA_NEXT = XInternAtom (si->dpy, "NEXT", False);
- XA_PREV = XInternAtom (si->dpy, "PREV", False);
- XA_SELECT = XInternAtom (si->dpy, "SELECT", False);
- XA_EXIT = XInternAtom (si->dpy, "EXIT", False);
- XA_DEMO = XInternAtom (si->dpy, "DEMO", False);
- XA_PREFS = XInternAtom (si->dpy, "PREFS", False);
- XA_LOCK = XInternAtom (si->dpy, "LOCK", False);
- XA_BLANK = XInternAtom (si->dpy, "BLANK", False);
- XA_THROTTLE = XInternAtom (si->dpy, "THROTTLE", False);
- XA_UNTHROTTLE = XInternAtom (si->dpy, "UNTHROTTLE", False);
+ const struct atom_request root_atoms[] =
+ { &XA_VROOT, "__SWM_VROOT" },
+ { &XA_XSETROOT_ID, "_XSETROOT_ID" },
+ { &XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID" },
+ { &XA_XROOTPMAP_ID, "_XROOTPMAP_ID" },
+ { &XA_NET_WM_USER_TIME, "_NET_WM_USER_TIME" },
+ { NULL, NULL } /* Must be last to terminate list */
+ const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
+ atom_lists[0] = remote_control_atoms;
+ atom_lists[1] = root_atoms;
+ request_atoms (si->dpy, atom_lists);
index d67966e..064e9c4 100644
@@ -202,8 +202,5 @@ Bool safe_XF86VidModeGetViewPort (Display *, int, int *, int *);
extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
extern Atom XA_NET_WM_USER_TIME;
-extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
-extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
-extern Atom XA_DEMO, XA_PREFS;
#endif /* __XSCREENSAVER_H__ */