http://ftp.x.org/contrib/applications/xscreensaver-3.03.tar.gz
[xscreensaver] / hacks / screenhack.c
index ace18c57e88e58660854bed43c8c641a44e1504b..4d169939018de416fe59c05513d15aaab4b5ea1c 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998
- *  Jamie Zawinski <jwz@netscape.com>
+ *  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
 #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>
@@ -66,7 +71,7 @@ static XrmOptionDescRec default_options [] = {
 };
 
 static char *default_defaults[] = {
-  "*root:              false",
+  ".root:              false",
   "*geometry:          600x480", /* this should be .geometry, but nooooo... */
   "*mono:              false",
   "*installColormap:   false",
@@ -110,6 +115,23 @@ merge_options (void)
          def_defaults_size * sizeof(*defaults));
   memcpy (merged_defaults + def_defaults_size, defaults,
          (defaults_size + 1) * sizeof(*defaults));
+
+  /* This totally sucks.  Xt should behave like this by default.
+     If the string in `defaults' looks like ".foo", change that
+     to "Progclass.foo".
+   */
+  {
+    char **s;
+    for (s = merged_defaults; *s; s++)
+      if (**s == '.')
+       {
+         const char *oldr = *s;
+         char *newr = (char *) malloc(strlen(oldr) + strlen(progclass) + 3);
+         strcpy (newr, progclass);
+         strcat (newr, oldr);
+         *s = newr;
+       }
+  }
 }
 
 \f
@@ -165,6 +187,19 @@ main (int argc, char **argv)
   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);
@@ -191,7 +226,7 @@ main (int argc, char **argv)
       Bool help_p = !strcmp(argv[1], "-help");
       fprintf (stderr, "%s\n", version);
       for (s = progclass; *s; s++) fprintf(stderr, " ");
-      fprintf (stderr, "  http://people.netscape.com/jwz/xscreensaver/\n\n");
+      fprintf (stderr, "  http://www.jwz.org/xscreensaver/\n\n");
 
       if (!help_p)
        fprintf(stderr, "Unrecognised option: %s\n", argv[1]);