-/* xscreensaver, Copyright (c) 1992, 1995, 1997
+/* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998
* Jamie Zawinski <jwz@netscape.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
#include <X11/CoreP.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>
+
+#ifdef __sgi
+# include <X11/SGIScheme.h> /* for SgiUseSchemes() */
+#endif /* __sgi */
+
#ifdef HAVE_XMU
# ifndef VMS
# include <X11/Xmu/Error.h>
{ "-install", ".installColormap", XrmoptionNoArg, "True" },
{ "-noinstall",".installColormap", XrmoptionNoArg, "False" },
{ "-visual", ".visualID", XrmoptionSepArg, 0 },
+ { "-window-id", ".windowID", XrmoptionSepArg, 0 },
{ 0, 0, 0, 0 }
};
"*mono: false",
"*installColormap: false",
"*visualID: default",
+ "*windowID: ",
0
};
Visual *visual;
Colormap cmap;
Bool root_p;
+ Window on_window = 0;
XEvent event;
Boolean dont_clear /*, dont_map */;
char version[255];
pre_merge_options ();
#endif
merge_options ();
+
+#ifdef __sgi
+ /* We have to do this on SGI to prevent the background color from being
+ overridden by the current desktop color scheme (we'd like our backgrounds
+ to be black, thanks.) This should be the same as setting the
+ "*useSchemes: none" resource, but it's not -- if that resource is
+ present in the `default_defaults' above, it doesn't work, though it
+ does work when passed as an -xrm arg on the command line. So screw it,
+ turn them off from C instead.
+ */
+ SgiUseSchemes ("none");
+#endif /* __sgi */
+
toplevel = XtAppInitialize (&app, progclass, merged_options,
merged_options_size, &argc, argv,
merged_defaults, 0, 0);
mono_p = True;
root_p = get_boolean_resource ("root", "Boolean");
- if (root_p)
+
+ {
+ char *s = get_string_resource ("windowID", "WindowID");
+ if (s && *s)
+ on_window = get_integer_resource ("windowID", "WindowID");
+ if (s) free (s);
+ }
+
+ if (on_window)
+ {
+ XWindowAttributes xgwa;
+ window = (Window) on_window;
+ XtDestroyWidget (toplevel);
+ XGetWindowAttributes (dpy, window, &xgwa);
+ cmap = xgwa.colormap;
+ visual = xgwa.visual;
+ }
+ else if (root_p)
{
XWindowAttributes xgwa;
window = RootWindowOfScreen (XtScreen (toplevel));
XClearWindow (dpy, window);
}
- if (!root_p)
+ if (!root_p && !on_window)
/* wait for it to be mapped */
XIfEvent (dpy, &event, MapNotify_event_p, (XPointer) window);