-/* xscreensaver, Copyright (c) 1991-1993 Jamie Zawinski <jwz@lucid.com>
+/* xscreensaver, Copyright (c) 1991-1993 Jamie Zawinski <jwz@mcom.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
*/
#include <stdio.h>
+
+#ifdef VMS
+typedef char * caddr_t;
+#endif
+
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xos.h>
+#ifndef VMS
#include <X11/Xmu/SysUtil.h>
+#else
+#include "sys$common:[decw$include.xmu]SysUtil.h"
+#endif
#include <signal.h> /* for the signal names */
#include "xscreensaver.h"
#if __STDC__
+#ifndef __DECC
extern int kill (pid_t, int); /* signal() is in sys/signal.h... */
+#else
+extern int kill (int, int);
+#endif
#endif /* __STDC__ */
extern Bool lock_p, demo_mode_p;
Atom XA_VROOT, XA_XSETROOT_ID;
Atom XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
+#if __STDC__
+extern void describe_visual (FILE *, Display *, Visual *);
+#endif
+
Window screensaver_window = 0;
Cursor cursor;
Colormap cmap, cmap2;
GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime)
void
-grab_keyboard_and_mouse ()
+grab_keyboard_and_mouse P((void))
{
Status status;
XSync (dpy, False);
}
void
-ungrab_keyboard_and_mouse ()
+ungrab_keyboard_and_mouse P((void))
{
XUngrabPointer (dpy, CurrentTime);
XUngrabKeyboard (dpy, CurrentTime);
#endif
static void
+#if __STDC__
+store_vroot_property (Window win, Window value)
+#else
store_vroot_property (win, value)
Window win, value;
+#endif
{
#if 0
printf ("%s: storing XA_VROOT = 0x%x (%s) = 0x%x (%s)\n", progname,
}
static void
+#if __STDC__
+remove_vroot_property (Window win)
+#else
remove_vroot_property (win)
Window win;
+#endif
{
#if 0
printf ("%s: removing XA_VROOT from 0x%x (%s)\n", progname, win,
static void
-kill_xsetroot_data ()
+kill_xsetroot_data P((void))
{
Atom type;
int format;
static void handle_signals P((Bool on_p));
static void
-save_real_vroot ()
+save_real_vroot P((void))
{
int i;
Window root = RootWindowOfScreen (screen);
}
static Bool
-restore_real_vroot_1 ()
+restore_real_vroot_1 P((void))
{
if (verbose_p && real_vroot)
printf ("%s: restoring __SWM_VROOT property on the real vroot (0x%x).\n",
static void
+#if __STDC__
+catch_signal (int sig, char *signame, Bool on_p)
+#else
catch_signal (sig, signame, on_p)
int sig;
char *signame;
Bool on_p;
+#endif
{
if (! on_p)
signal (sig, SIG_DFL);
catch_signal (SIGILL, "SIGILL", on_p);
catch_signal (SIGTRAP, "SIGTRAP", on_p);
catch_signal (SIGIOT, "SIGIOT", on_p);
+#ifndef VMS
catch_signal (SIGABRT, "SIGABRT", on_p);
+#endif
#ifdef SIGEMT
catch_signal (SIGEMT, "SIGEMT", on_p);
#endif
catch_signal (SIGFPE, "SIGFPE", on_p);
catch_signal (SIGBUS, "SIGBUS", on_p);
catch_signal (SIGSEGV, "SIGSEGV", on_p);
+#ifdef SIGSYS
catch_signal (SIGSYS, "SIGSYS", on_p);
+#endif
catch_signal (SIGTERM, "SIGTERM", on_p);
#ifdef SIGXCPU
catch_signal (SIGXCPU, "SIGXCPU", on_p);
/* Managing the actual screensaver window */
void
-initialize_screensaver_window ()
+initialize_screensaver_window P((void))
{
/* This resets the screensaver window as fully as possible, since there's
no way of knowing what some random client may have done to us in the
int height = HeightOfScreen (screen);
char id [2048];
+ black.red = black.green = black.blue = 0;
+
if (cmap == DefaultColormapOfScreen (screen))
cmap = 0;
fade_p = unfade_p = 0;
}
- attrmask = CWOverrideRedirect | CWEventMask | CWBackingStore | CWColormap;
+ attrmask = (CWOverrideRedirect | CWEventMask | CWBackingStore | CWColormap |
+ CWBackPixel | CWBackingPixel | CWBorderPixel);
attrs.override_redirect = True;
attrs.event_mask = (KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask);
attrs.backing_store = NotUseful;
attrs.colormap = cmap;
+ attrs.background_pixel = black_pixel;
+ attrs.backing_pixel = black_pixel;
+ attrs.border_pixel = black_pixel;
-/* if (demo_mode_p || lock_p || locked_p) width = width / 2; #### */
+/* if (demo_mode_p || lock_p) width = width / 2; #### */
if (screensaver_window)
{
}
else
{
+ if (! verbose_p)
+ ;
+ else if (visual == DefaultVisualOfScreen (screen))
+ {
+ fprintf (stderr, "%s: using default visual ", progname);
+ describe_visual (stderr, dpy, visual);
+ }
+ else
+ {
+ fprintf (stderr, "%s: using visual: ", progname);
+ describe_visual (stderr, dpy, visual);
+ fprintf (stderr, "%s: default visual: ", progname);
+ describe_visual (stderr, dpy, DefaultVisualOfScreen (screen));
+ }
+
screensaver_window =
XCreateWindow (dpy, RootWindowOfScreen (screen), 0, 0, width, height,
0, visual_depth, InputOutput, visual, attrmask,
XChangeProperty (dpy, screensaver_window, XA_SCREENSAVER_ID, XA_STRING, 8,
PropModeReplace, (unsigned char *) id, strlen (id));
- black.red = black.green = black.blue = 0;
if (!cursor)
{
Pixmap bit;
fade_colormap (dpy, current_map, cmap2, fade_seconds, fade_ticks, True);
XClearWindow (dpy, screensaver_window);
XMapRaised (dpy, screensaver_window);
+ /* Once the saver window is up, restore the colormap.
+ (The "black" pixels of the two colormaps are compatible.) */
XInstallColormap (dpy, cmap);
if (grabbed == GrabSuccess)
XUngrabPointer (dpy, CurrentTime);