+
+static void
+bogus_clientmessage_warning (saver_info *si, XEvent *event)
+{
+#if 0 /* Oh, fuck it. GNOME likes to spew random ClientMessages at us
+ all the time. This is presumably indicative of an error in
+ the sender of that ClientMessage: if we're getting it and
+ ignoring it, then it's not reaching the intended recipient.
+ But people complain to me about this all the time ("waaah!
+ xscreensaver is printing to it's stderr and that gets my
+ panties all in a bunch!") And I'm sick of hearing about it.
+ So we'll just ignore these messages and let GNOME go right
+ ahead and continue to stumble along in its malfunction.
+ */
+
+ saver_preferences *p = &si->prefs;
+ char *str = XGetAtomName_safe (si->dpy, event->xclient.message_type);
+ Window w = event->xclient.window;
+ char wdesc[255];
+ int screen = 0;
+ Bool root_p = False;
+
+ *wdesc = 0;
+ for (screen = 0; screen < si->nscreens; screen++)
+ if (w == si->screens[screen].screensaver_window)
+ {
+ strcpy (wdesc, "xscreensaver");
+ break;
+ }
+ else if (w == RootWindow (si->dpy, screen))
+ {
+ strcpy (wdesc, "root");
+ root_p = True;
+ break;
+ }
+
+ /* If this ClientMessage was sent to the real root window instead of to the
+ xscreensaver window, then it might be intended for someone else who is
+ listening on the root window (e.g., the window manager). So only print
+ the warning if: we are in debug mode; or if the bogus message was
+ actually sent to one of the xscreensaver-created windows.
+ */
+ if (root_p && !p->debug_p)
+ return;
+
+ if (!*wdesc)
+ {
+ XErrorHandler old_handler;
+ XClassHint hint;
+ XWindowAttributes xgwa;
+ memset (&hint, 0, sizeof(hint));
+ memset (&xgwa, 0, sizeof(xgwa));
+
+ XSync (si->dpy, False);
+ old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
+ XGetClassHint (si->dpy, w, &hint);
+ XGetWindowAttributes (si->dpy, w, &xgwa);
+ XSync (si->dpy, False);
+ XSetErrorHandler (old_handler);
+ XSync (si->dpy, False);
+
+ screen = (xgwa.screen ? screen_number (xgwa.screen) : -1);
+
+ sprintf (wdesc, "%.20s / %.20s",
+ (hint.res_name ? hint.res_name : "(null)"),
+ (hint.res_class ? hint.res_class : "(null)"));
+ if (hint.res_name) XFree (hint.res_name);
+ if (hint.res_class) XFree (hint.res_class);
+ }
+
+ fprintf (stderr, "%s: %d: unrecognised ClientMessage \"%s\" received\n",
+ blurb(), screen, (str ? str : "(null)"));
+ fprintf (stderr, "%s: %d: for window 0x%lx (%s)\n",
+ blurb(), screen, (unsigned long) w, wdesc);
+ if (str) XFree (str);
+
+#endif /* 0 */
+}
+
+