5559N/AFrom 9bf12ae3168aa6f9234304a8a376d47962f0d589 Mon Sep 17 00:00:00 2001
5559N/AFrom: Alan Coopersmith <alan.coopersmith@oracle.com>
5559N/ADate: Sat, 2 Jan 2016 20:11:05 -0800
5559N/ASubject: [PATCH] atoms
5559N/A
5398N/ACentralize atom handling and use XInternAtoms to get the atoms from
5398N/Athe server in one round trip instead of a separate synchronous/blocking
5398N/Around trip for each XInternAtom individual call.
5398N/A
5398N/AWas offered upstream in 2011 - jwz responded with:
5398N/A I'd sure like to see some kind of performance metrics -- like, any -- before
5398N/A making a big change to something so central. When it comes to the xscreensaver
5398N/A driver I'm a firm believer in "don't fix what ain't broke"...
5398N/A
5398N/ANeed to find some time to actually measure that someday (dtrace?).
5398N/A---
5559N/A driver/Makefile.in | 14 +++---
5559N/A driver/atoms.c | 113 ++++++++++++++++++++++++++++++++++++++++++
5559N/A driver/atoms.h | 33 ++++++++++++
5559N/A driver/demo-Gtk.c | 26 +++-------
5559N/A driver/demo-Xm.c | 25 +++-------
5559N/A driver/remote.c | 4 +-
5559N/A driver/windows.c | 3 +-
5559N/A driver/xscreensaver-command.c | 35 +++----------
5559N/A driver/xscreensaver.c | 47 ++++++------------
5559N/A driver/xscreensaver.h | 3 --
5559N/A 10 files changed, 189 insertions(+), 114 deletions(-)
5398N/A create mode 100644 driver/atoms.c
5398N/A create mode 100644 driver/atoms.h
5398N/A
5398N/Adiff --git a/driver/Makefile.in b/driver/Makefile.in
5559N/Aindex a5b94bf..90ef1d2 100644
5398N/A--- a/driver/Makefile.in
5398N/A+++ b/driver/Makefile.in
5559N/A@@ -188,18 +188,18 @@ SAVER_OBJS_1 = xscreensaver.o windows.o screens.o timers.o subprocs.o \
5398N/A exec.o xset.o splash.o setuid.o stderr.o mlstring.o
5398N/A
5398N/A SAVER_SRCS = $(SAVER_SRCS_1) prefs.c dpms.c $(LOCK_SRCS) \
5398N/A- $(SAVER_UTIL_SRCS) $(GL_SRCS)
5398N/A+ $(SAVER_UTIL_SRCS) $(GL_SRCS) atoms.c
5398N/A SAVER_OBJS = $(SAVER_OBJS_1) prefs.o dpms.o $(LOCK_OBJS) \
5398N/A- $(SAVER_UTIL_OBJS) $(GL_OBJS)
5398N/A+ $(SAVER_UTIL_OBJS) $(GL_OBJS) atoms.o
5398N/A
5398N/A-CMD_SRCS = remote.c xscreensaver-command.c
5398N/A-CMD_OBJS = remote.o xscreensaver-command.o
5398N/A+CMD_SRCS = remote.c atoms.c xscreensaver-command.c
5398N/A+CMD_OBJS = remote.o atoms.o xscreensaver-command.o
5398N/A
5398N/A DEMO_SRCS_1 = prefs.c dpms.c
5398N/A DEMO_OBJS_1 = prefs.o dpms.o
5398N/A
5398N/A-DEMO_SRCS = $(DEMO_SRCS_1) remote.c exec.c $(DEMO_UTIL_SRCS)
5398N/A-DEMO_OBJS = $(DEMO_OBJS_1) remote.o exec.o $(DEMO_UTIL_OBJS)
5398N/A+DEMO_SRCS = $(DEMO_SRCS_1) remote.c atoms.c exec.c $(DEMO_UTIL_SRCS)
5398N/A+DEMO_OBJS = $(DEMO_OBJS_1) remote.o atoms.o exec.o $(DEMO_UTIL_OBJS)
5398N/A
5398N/A PDF2JPEG_SRCS = pdf2jpeg.m
5398N/A PDF2JPEG_OBJS = pdf2jpeg.o
5559N/A@@ -228,7 +228,7 @@ SCRIPTS = $(SCRIPTS_1) @SCRIPTS_OSX@
5559N/A
5398N/A HDRS = XScreenSaver_ad.h XScreenSaver_Xm_ad.h \
5398N/A xscreensaver.h prefs.h remote.h exec.h \
5398N/A- demo-Gtk-conf.h auth.h mlstring.h types.h
5398N/A+ demo-Gtk-conf.h auth.h mlstring.h types.h atoms.h
5398N/A MEN_1 = xscreensaver.man xscreensaver-demo.man \
5398N/A xscreensaver-command.man \
5398N/A xscreensaver-text.man \
5398N/Adiff --git a/driver/atoms.c b/driver/atoms.c
5398N/Anew file mode 100644
5559N/Aindex 0000000..d50bc57
5398N/A--- /dev/null
5398N/A+++ b/driver/atoms.c
5398N/A@@ -0,0 +1,113 @@
5398N/A+/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <jwz@jwz.org>
5398N/A+ *
5398N/A+ * Permission to use, copy, modify, distribute, and sell this software and its
5398N/A+ * documentation for any purpose is hereby granted without fee, provided that
5398N/A+ * the above copyright notice appear in all copies and that both that
5398N/A+ * copyright notice and this permission notice appear in supporting
5398N/A+ * documentation. No representations are made about the suitability of this
5398N/A+ * software for any purpose. It is provided "as is" without express or
5398N/A+ * implied warranty.
5398N/A+ */
5398N/A+
5398N/A+#ifdef HAVE_CONFIG_H
5398N/A+# include "config.h"
5398N/A+#endif
5398N/A+
5398N/A+#include <stdio.h>
5398N/A+#include <stdlib.h>
5398N/A+#include <sys/types.h>
5398N/A+
5398N/A+#include <X11/Xproto.h> /* for CARD32 */
5398N/A+#include <X11/Xlib.h>
5398N/A+#include <X11/Xos.h>
5398N/A+
5398N/A+#include "atoms.h"
5398N/A+
5398N/A+/* Atoms to retrieve info from remote daemon */
5398N/A+Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
5398N/A+ XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
5398N/A+
5398N/A+/* Atoms to send commands to remote daemon */
5398N/A+Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
5398N/A+ XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
5398N/A+ XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
5398N/A+
5398N/A+static const struct atom_request remote_control_atom_list[] =
5398N/A+{
5398N/A+ { &XA_SCREENSAVER, "SCREENSAVER" },
5398N/A+ { &XA_SCREENSAVER_ID, "_SCREENSAVER_ID" },
5398N/A+ { &XA_SCREENSAVER_VERSION, "_SCREENSAVER_VERSION" },
5398N/A+ { &XA_SCREENSAVER_RESPONSE, "_SCREENSAVER_RESPONSE" },
5398N/A+ { &XA_SCREENSAVER_STATUS, "_SCREENSAVER_STATUS" },
5398N/A+ { &XA_ACTIVATE, "ACTIVATE" },
5398N/A+ { &XA_BLANK, "BLANK" },
5398N/A+ { &XA_CYCLE, "CYCLE" },
5398N/A+ { &XA_DEACTIVATE, "DEACTIVATE" },
5398N/A+ { &XA_DEMO, "DEMO" },
5398N/A+ { &XA_EXIT, "EXIT" },
5398N/A+ { &XA_LOCK, "LOCK" },
5398N/A+ { &XA_NEXT, "NEXT" },
5398N/A+ { &XA_PREFS, "PREFS" },
5398N/A+ { &XA_PREV, "PREV" },
5398N/A+ { &XA_RESTART, "RESTART" },
5398N/A+ { &XA_SELECT, "SELECT" },
5398N/A+ { &XA_THROTTLE, "THROTTLE" },
5398N/A+ { &XA_UNTHROTTLE, "UNTHROTTLE" },
5398N/A+ { NULL, NULL } /* Must be last to terminate list */
5398N/A+};
5398N/A+
5398N/A+const struct atom_request *remote_control_atoms = remote_control_atom_list;
5398N/A+
5398N/A+/* Load a list of atoms in a single round trip to the X server instead of
5398N/A+ waiting for a synchronous round trip for each and every atom */
5398N/A+Status request_atoms ( Display *dpy,
5398N/A+ const struct atom_request **request_lists )
5398N/A+{
5398N/A+ int atom_count, n;
5398N/A+ Status result;
5398N/A+ const struct atom_request **l, *r;
5398N/A+ Atom *atoms;
5398N/A+ const char **names;
5398N/A+
5398N/A+ /* Count the number of items across all the lists passed in */
5398N/A+ atom_count = 0;
5398N/A+ for (l = request_lists; l != NULL && *l != NULL; l++)
5398N/A+ {
5398N/A+ for (r = *l; r != NULL && r->name != NULL; r++)
5398N/A+ {
5398N/A+ atom_count++;
5398N/A+ }
5398N/A+ }
5398N/A+
5398N/A+ atoms = calloc(atom_count, sizeof(Atom));
5398N/A+ names = calloc(atom_count, sizeof(char *));
5398N/A+ if (!atoms || !names)
5398N/A+ return -1;
5398N/A+
5398N/A+ n = 0;
5398N/A+ for (l = request_lists; l != NULL && *l != NULL; l++)
5398N/A+ {
5398N/A+ for (r = *l; r != NULL && r->name != NULL; r++)
5398N/A+ {
5398N/A+ names[n++] = r->name;
5398N/A+ }
5398N/A+ }
5398N/A+ result = XInternAtoms( dpy, (char **) names, atom_count, False, atoms );
5398N/A+
5398N/A+ n = 0;
5398N/A+ for (l = request_lists; l != NULL && *l != NULL; l++)
5398N/A+ {
5398N/A+ for (r = *l; r != NULL && r->name != NULL; r++)
5398N/A+ {
5398N/A+#if DEBUG_ATOMS
5398N/A+ fprintf (stderr, "atom: %s => %d\n", names[n], atoms[n]);
5398N/A+#endif
5398N/A+ *(r->atomp) = atoms[n++];
5398N/A+ }
5398N/A+ }
5398N/A+
5398N/A+ free(atoms);
5398N/A+ free(names);
5398N/A+
5398N/A+ return result;
5398N/A+}
5398N/Adiff --git a/driver/atoms.h b/driver/atoms.h
5398N/Anew file mode 100644
5559N/Aindex 0000000..09e78f3
5398N/A--- /dev/null
5398N/A+++ b/driver/atoms.h
5398N/A@@ -0,0 +1,33 @@
5398N/A+/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <jwz@jwz.org>
5398N/A+ *
5398N/A+ * Permission to use, copy, modify, distribute, and sell this software and its
5398N/A+ * documentation for any purpose is hereby granted without fee, provided that
5398N/A+ * the above copyright notice appear in all copies and that both that
5398N/A+ * copyright notice and this permission notice appear in supporting
5398N/A+ * documentation. No representations are made about the suitability of this
5398N/A+ * software for any purpose. It is provided "as is" without express or
5398N/A+ * implied warranty.
5398N/A+ */
5398N/A+
5398N/A+#ifndef _XSCREENSAVER_ATOMS_H_
5398N/A+#define _XSCREENSAVER_ATOMS_H_
5398N/A+
5398N/A+struct atom_request {
5398N/A+ Atom *atomp;
5398N/A+ const char *name;
5398N/A+};
5398N/A+
5398N/A+extern const struct atom_request *remote_control_atoms;
5398N/A+extern Status request_atoms ( Display *dpy,
5398N/A+ const struct atom_request **request_lists );
5398N/A+
5398N/A+/* Atoms to retrieve info from remote daemon */
5398N/A+extern Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
5398N/A+ XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
5398N/A+
5398N/A+/* Atoms to send commands to remote daemon */
5398N/A+extern Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
5398N/A+ XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
5398N/A+ XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
5398N/A+
5398N/A+#endif /* _XSCREENSAVER_ATOMS_H_ */
5398N/Adiff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
5559N/Aindex 6c449f2..3fa27c3 100644
5398N/A--- a/driver/demo-Gtk.c
5398N/A+++ b/driver/demo-Gtk.c
5398N/A@@ -118,6 +118,7 @@
5398N/A #include "resources.h" /* for parse_time() */
5398N/A #include "visual.h" /* for has_writable_cells() */
5398N/A #include "remote.h" /* for xscreensaver_command() */
5398N/A+#include "atoms.h"
5398N/A #include "usleep.h"
5398N/A
5398N/A #include "logo-50.xpm"
5559N/A@@ -247,12 +248,6 @@ typedef struct {
5398N/A a closure object of our own down into the various widget callbacks. */
5398N/A static state *global_state_kludge;
5398N/A
5398N/A-Atom XA_VROOT;
5398N/A-Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
5398N/A-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
5398N/A-Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
5398N/A-
5398N/A-
5398N/A static void populate_demo_window (state *, int list_elt);
5398N/A static void populate_prefs_page (state *);
5398N/A static void populate_popup_window (state *);
5559N/A@@ -5068,20 +5063,11 @@ main (int argc, char **argv)
5398N/A
5398N/A /* Intern the atoms that xscreensaver_command() needs.
5398N/A */
5398N/A- XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
5398N/A- XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
5398N/A- XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
5398N/A- XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
5398N/A- XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
5398N/A- XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
5398N/A- XA_SELECT = XInternAtom (dpy, "SELECT", False);
5398N/A- XA_DEMO = XInternAtom (dpy, "DEMO", False);
5398N/A- XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
5398N/A- XA_BLANK = XInternAtom (dpy, "BLANK", False);
5398N/A- XA_LOCK = XInternAtom (dpy, "LOCK", False);
5398N/A- XA_EXIT = XInternAtom (dpy, "EXIT", False);
5398N/A- XA_RESTART = XInternAtom (dpy, "RESTART", False);
5398N/A-
5398N/A+ {
5398N/A+ const struct atom_request *atom_lists[2] = { NULL, NULL };
5398N/A+ atom_lists[0] = remote_control_atoms;
5398N/A+ request_atoms (dpy, atom_lists);
5398N/A+ }
5398N/A
5398N/A /* Create the window and all its widgets.
5398N/A */
5398N/Adiff --git a/driver/demo-Xm.c b/driver/demo-Xm.c
5559N/Aindex 56d1aac..a3e6567 100644
5398N/A--- a/driver/demo-Xm.c
5398N/A+++ b/driver/demo-Xm.c
5398N/A@@ -82,6 +82,7 @@
5398N/A #include "resources.h" /* for parse_time() */
5398N/A #include "visual.h" /* for has_writable_cells() */
5398N/A #include "remote.h" /* for xscreensaver_command() */
5398N/A+#include "atoms.h"
5398N/A #include "usleep.h"
5398N/A
5398N/A #include <stdio.h>
5398N/A@@ -110,12 +111,6 @@ extern const char *visual_menu[];
5398N/A
5398N/A static char *short_version = 0;
5398N/A
5398N/A-Atom XA_VROOT;
5398N/A-Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
5398N/A-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
5398N/A-Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
5398N/A-
5398N/A-
5398N/A static void populate_demo_window (Widget toplevel,
5398N/A int which, prefs_pair *pair);
5398N/A static void populate_prefs_page (Widget top, prefs_pair *pair);
5398N/A@@ -1791,19 +1786,11 @@ main (int argc, char **argv)
5398N/A
5398N/A /* Intern the atoms that xscreensaver_command() needs.
5398N/A */
5398N/A- XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
5398N/A- XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
5398N/A- XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
5398N/A- XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
5398N/A- XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
5398N/A- XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
5398N/A- XA_SELECT = XInternAtom (dpy, "SELECT", False);
5398N/A- XA_DEMO = XInternAtom (dpy, "DEMO", False);
5398N/A- XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
5398N/A- XA_BLANK = XInternAtom (dpy, "BLANK", False);
5398N/A- XA_LOCK = XInternAtom (dpy, "LOCK", False);
5398N/A- XA_EXIT = XInternAtom (dpy, "EXIT", False);
5398N/A- XA_RESTART = XInternAtom (dpy, "RESTART", False);
5398N/A+ {
5398N/A+ const struct atom_request *atom_lists[2] = { NULL, NULL };
5398N/A+ atom_lists[0] = remote_control_atoms;
5398N/A+ request_atoms (dpy, atom_lists);
5398N/A+ }
5398N/A
5398N/A /* Create the window and all its widgets.
5398N/A */
5398N/Adiff --git a/driver/remote.c b/driver/remote.c
5559N/Aindex 775036a..59e30c1 100644
5398N/A--- a/driver/remote.c
5398N/A+++ b/driver/remote.c
5398N/A@@ -34,15 +34,13 @@
5398N/A #include <X11/Xos.h>
5398N/A
5398N/A #include "remote.h"
5398N/A+#include "atoms.h"
5398N/A
5398N/A #ifdef _VROOT_H_
5398N/A ERROR! you must not include vroot.h in this file
5398N/A #endif
5398N/A
5398N/A extern char *progname;
5398N/A-extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
5398N/A-extern Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_EXIT;
5398N/A-extern Atom XA_VROOT, XA_SELECT, XA_DEMO, XA_BLANK, XA_LOCK;
5398N/A
5398N/A
5398N/A static XErrorHandler old_handler = 0;
5398N/Adiff --git a/driver/windows.c b/driver/windows.c
5559N/Aindex d33f251..6acaddb 100644
5398N/A--- a/driver/windows.c
5398N/A+++ b/driver/windows.c
5559N/A@@ -69,14 +69,13 @@ typedef long PROP32;
5398N/A #include "xscreensaver.h"
5398N/A #include "visual.h"
5398N/A #include "fade.h"
5398N/A+#include "atoms.h"
5398N/A
5398N/A
5398N/A extern int kill (pid_t, int); /* signal() is in sys/signal.h... */
5398N/A
5398N/A Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
5559N/A Atom XA_NET_WM_USER_TIME;
5398N/A-Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
5398N/A-Atom XA_SCREENSAVER_STATUS;
5398N/A
5398N/A extern saver_info *global_si_kludge; /* I hate C so much... */
5398N/A
5398N/Adiff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c
5559N/Aindex 0057438..80b2813 100644
5398N/A--- a/driver/xscreensaver-command.c
5398N/A+++ b/driver/xscreensaver-command.c
5398N/A@@ -40,6 +40,7 @@
5398N/A typedef long PROP32;
5398N/A
5398N/A #include "remote.h"
5398N/A+#include "atoms.h"
5398N/A #include "version.h"
5398N/A
5398N/A #ifdef _VROOT_H_
5398N/A@@ -48,13 +49,6 @@ ERROR! you must not include vroot.h in this file
5398N/A
5398N/A char *progname;
5398N/A
5398N/A-Atom XA_VROOT;
5398N/A-Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
5398N/A-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO, XA_EXIT;
5398N/A-Atom XA_BLANK, XA_LOCK;
5398N/A-static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
5398N/A-static Atom XA_RESTART, XA_PREFS, XA_THROTTLE, XA_UNTHROTTLE;
5398N/A-
5398N/A static char *screensaver_version;
5398N/A # ifdef __GNUC__
5398N/A __extension__ /* don't warn about "string length is greater than the
5559N/A@@ -292,28 +286,11 @@ main (int argc, char **argv)
5398N/A exit (1);
5398N/A }
5398N/A
5398N/A- XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
5398N/A- XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
5398N/A- XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
5398N/A- XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
5398N/A- XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
5398N/A- XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
5398N/A- XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
5398N/A- XA_DEACTIVATE = XInternAtom (dpy, "DEACTIVATE", False);
5398N/A- XA_RESTART = XInternAtom (dpy, "RESTART", False);
5398N/A- XA_CYCLE = XInternAtom (dpy, "CYCLE", False);
5398N/A- XA_NEXT = XInternAtom (dpy, "NEXT", False);
5398N/A- XA_PREV = XInternAtom (dpy, "PREV", False);
5398N/A- XA_SELECT = XInternAtom (dpy, "SELECT", False);
5398N/A- XA_EXIT = XInternAtom (dpy, "EXIT", False);
5398N/A- XA_DEMO = XInternAtom (dpy, "DEMO", False);
5398N/A- XA_PREFS = XInternAtom (dpy, "PREFS", False);
5398N/A- XA_LOCK = XInternAtom (dpy, "LOCK", False);
5398N/A- XA_BLANK = XInternAtom (dpy, "BLANK", False);
5398N/A- XA_THROTTLE = XInternAtom (dpy, "THROTTLE", False);
5398N/A- XA_UNTHROTTLE = XInternAtom (dpy, "UNTHROTTLE", False);
5398N/A-
5398N/A- XSync (dpy, 0);
5398N/A+ {
5398N/A+ const struct atom_request *atom_lists[2] = { NULL, NULL };
5398N/A+ atom_lists[0] = remote_control_atoms;
5398N/A+ request_atoms (dpy, atom_lists);
5398N/A+ }
5398N/A
5398N/A if (cmd == &XA_WATCH)
5398N/A {
5398N/Adiff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
5559N/Aindex 45f0f0c..06f5c13 100644
5398N/A--- a/driver/xscreensaver.c
5398N/A+++ b/driver/xscreensaver.c
5559N/A@@ -232,6 +232,7 @@
5398N/A #include "visual.h"
5398N/A #include "usleep.h"
5398N/A #include "auth.h"
5398N/A+#include "atoms.h"
5398N/A
5398N/A saver_info *global_si_kludge = 0; /* I hate C so much... */
5398N/A
5559N/A@@ -240,12 +241,6 @@ char *progclass = 0;
5398N/A XrmDatabase db = 0;
5398N/A
5398N/A
5398N/A-static Atom XA_SCREENSAVER_RESPONSE;
5398N/A-static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
5398N/A-static Atom XA_RESTART, XA_SELECT;
5398N/A-static Atom XA_THROTTLE, XA_UNTHROTTLE;
5398N/A-Atom XA_DEMO, XA_PREFS, XA_EXIT, XA_LOCK, XA_BLANK;
5398N/A-
5398N/A
5398N/A static XrmOptionDescRec options [] = {
5398N/A
5559N/A@@ -667,31 +662,21 @@ connect_to_server (saver_info *si, int *argc, char **argv)
5398N/A
5398N/A db = si->prefs.db; /* resources.c needs this */
5398N/A
5398N/A- XA_VROOT = XInternAtom (si->dpy, "__SWM_VROOT", False);
5398N/A- XA_SCREENSAVER = XInternAtom (si->dpy, "SCREENSAVER", False);
5398N/A- XA_SCREENSAVER_VERSION = XInternAtom (si->dpy, "_SCREENSAVER_VERSION",False);
5398N/A- XA_SCREENSAVER_ID = XInternAtom (si->dpy, "_SCREENSAVER_ID", False);
5398N/A- XA_SCREENSAVER_STATUS = XInternAtom (si->dpy, "_SCREENSAVER_STATUS", False);
5398N/A- XA_SCREENSAVER_RESPONSE = XInternAtom (si->dpy, "_SCREENSAVER_RESPONSE",
5398N/A- False);
5398N/A- XA_XSETROOT_ID = XInternAtom (si->dpy, "_XSETROOT_ID", False);
5398N/A- XA_ESETROOT_PMAP_ID = XInternAtom (si->dpy, "ESETROOT_PMAP_ID", False);
5398N/A- XA_XROOTPMAP_ID = XInternAtom (si->dpy, "_XROOTPMAP_ID", False);
5559N/A- XA_NET_WM_USER_TIME = XInternAtom (si->dpy, "_NET_WM_USER_TIME", False);
5398N/A- XA_ACTIVATE = XInternAtom (si->dpy, "ACTIVATE", False);
5398N/A- XA_DEACTIVATE = XInternAtom (si->dpy, "DEACTIVATE", False);
5398N/A- XA_RESTART = XInternAtom (si->dpy, "RESTART", False);
5398N/A- XA_CYCLE = XInternAtom (si->dpy, "CYCLE", False);
5398N/A- XA_NEXT = XInternAtom (si->dpy, "NEXT", False);
5398N/A- XA_PREV = XInternAtom (si->dpy, "PREV", False);
5398N/A- XA_SELECT = XInternAtom (si->dpy, "SELECT", False);
5398N/A- XA_EXIT = XInternAtom (si->dpy, "EXIT", False);
5398N/A- XA_DEMO = XInternAtom (si->dpy, "DEMO", False);
5398N/A- XA_PREFS = XInternAtom (si->dpy, "PREFS", False);
5398N/A- XA_LOCK = XInternAtom (si->dpy, "LOCK", False);
5398N/A- XA_BLANK = XInternAtom (si->dpy, "BLANK", False);
5398N/A- XA_THROTTLE = XInternAtom (si->dpy, "THROTTLE", False);
5398N/A- XA_UNTHROTTLE = XInternAtom (si->dpy, "UNTHROTTLE", False);
5398N/A+ {
5398N/A+ const struct atom_request root_atoms[] =
5398N/A+ {
5398N/A+ { &XA_VROOT, "__SWM_VROOT" },
5398N/A+ { &XA_XSETROOT_ID, "_XSETROOT_ID" },
5398N/A+ { &XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID" },
5398N/A+ { &XA_XROOTPMAP_ID, "_XROOTPMAP_ID" },
5559N/A+ { &XA_NET_WM_USER_TIME, "_NET_WM_USER_TIME" },
5398N/A+ { NULL, NULL } /* Must be last to terminate list */
5398N/A+ };
5398N/A+ const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
5398N/A+ atom_lists[0] = remote_control_atoms;
5398N/A+ atom_lists[1] = root_atoms;
5398N/A+ request_atoms (si->dpy, atom_lists);
5398N/A+ }
5398N/A
5398N/A return toplevel_shell;
5398N/A }
5398N/Adiff --git a/driver/xscreensaver.h b/driver/xscreensaver.h
5559N/Aindex d67966e..064e9c4 100644
5398N/A--- a/driver/xscreensaver.h
5398N/A+++ b/driver/xscreensaver.h
5559N/A@@ -202,8 +202,5 @@ Bool safe_XF86VidModeGetViewPort (Display *, int, int *, int *);
5398N/A
5398N/A extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
5559N/A extern Atom XA_NET_WM_USER_TIME;
5398N/A-extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
5398N/A-extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
5398N/A-extern Atom XA_DEMO, XA_PREFS;
5398N/A
5398N/A #endif /* __XSCREENSAVER_H__ */
5559N/A--
5559N/A2.6.1
5398N/A