fprintf (stderr, "%s: couldn't grab pointer! (%s)\n",
blurb(), grab_string(mstatus));
- return (kstatus == GrabSuccess ||
- mstatus == GrabSuccess);
+
+ /* When should we allow blanking to proceed? The current theory
+ is that a keyboard grab is manditory; a mouse grab is optional.
+
+ - If we don't have a keyboard grab, then we won't be able to
+ read a password to unlock, so the kbd grab is manditory.
+ (We can't conditionalize this on locked_p, because someone
+ might run "xscreensaver-command -lock" at any time.)
+
+ - If we don't have a mouse grab, then we might not see mouse
+ clicks as a signal to unblank -- but we will still see kbd
+ activity, so that's not a disaster.
+ */
+
+ if (kstatus != GrabSuccess) /* Do not blank without a kbd grab. */
+ return False;
+
+ return True; /* Grab is good, go ahead and blank. */
}
static void
Atom type;
int format;
unsigned long nitems, bytesafter;
- char *version;
+ unsigned char *version;
if (XGetWindowProperty (dpy, kids[i], XA_SCREENSAVER_VERSION, 0, 1,
False, XA_STRING, &type, &format, &nitems,
- &bytesafter, (unsigned char **) &version)
+ &bytesafter, &version)
== Success
&& type != None)
{
- char *id;
+ unsigned char *id;
if (!XGetWindowProperty (dpy, kids[i], XA_SCREENSAVER_ID, 0, 512,
False, XA_STRING, &type, &format, &nitems,
- &bytesafter, (unsigned char **) &id)
+ &bytesafter, &id)
== Success
|| type == None)
- id = "???";
+ id = (unsigned char *) "???";
fprintf (stderr,
"%s: already running on display %s (window 0x%x)\n from process %s.\n",
- blurb(), DisplayString (dpy), (int) kids [i], id);
+ blurb(), DisplayString (dpy), (int) kids [i],
+ (char *) id);
status = True;
}
}
Atom type;
int format;
unsigned long nitems, bytesafter;
- Pixmap *dataP = 0;
+ unsigned char *dataP = 0;
/* If the user has been using xv or xsetroot as a screensaver (to display
an image on the screensaver window, as a kind of slideshow) then the
*/
if (XGetWindowProperty (dpy, window, prop, 0, 1,
True, AnyPropertyType, &type, &format, &nitems,
- &bytesafter, (unsigned char **) &dataP)
+ &bytesafter, &dataP)
== Success
&& type != None)
{
- if (dataP && *dataP && type == XA_PIXMAP && format == 32 &&
+ Pixmap *pixP = (Pixmap *) dataP;
+ if (pixP && *pixP && type == XA_PIXMAP && format == 32 &&
nitems == 1 && bytesafter == 0)
{
if (verbose_p)
fprintf (stderr, "%s: destroying %s data (0x%lX).\n",
- blurb(), atom_name, *dataP);
- safe_XKillClient (dpy, *dataP);
+ blurb(), atom_name, *pixP);
+ safe_XKillClient (dpy, *pixP);
}
else
fprintf (stderr,
"\t%lu, %lu; type: %lu, format: %d, "
"nitems: %lu, bytesafter %ld\n",
blurb(), atom_name,
- (unsigned long) dataP, (dataP ? *dataP : 0), type,
+ (unsigned long) pixP, (pixP ? *pixP : 0), type,
format, nitems, bytesafter);
}
}
Atom type;
int format;
unsigned long nitems, bytesafter;
- Window *vrootP = 0;
+ unsigned char *dataP = 0;
+ Window *vrootP;
int j;
/* Skip this window if it is the xscreensaver window of any other
if (XGetWindowProperty (dpy, kids[i], XA_VROOT, 0, 1, False, XA_WINDOW,
&type, &format, &nitems, &bytesafter,
- (unsigned char **) &vrootP)
+ &dataP)
!= Success)
continue;
- if (! vrootP)
+ if (! dataP)
continue;
+
+ vrootP = (Window *) dataP;
if (ssi->real_vroot)
{
if (*vrootP == ssi->screensaver_window) abort ();
fprintf (stderr, "%s: %s received: restarting...\n",
blurb(), signal_name(sig));
- unblank_screen (si);
- kill_screenhack (si);
- XSync (si->dpy, False);
+
+ if (si->screen_blanked_p)
+ {
+ unblank_screen (si);
+ kill_screenhack (si);
+ XSync (si->dpy, False);
+ }
+
restart_process (si); /* Does not return */
abort ();
}
mscreen);
+# if 0
if (si->using_mit_saver_extension || si->using_sgi_saver_extension)
/* If we're using a server extension, then failure to get a grab is
not a big deal -- even without the grab, we will still be able
to un-blank when there is user activity, since the server will
tell us. */
+ /* #### No, that's not true: if we don't have a keyboard grab,
+ then we can't read passwords to unlock.
+ */
ok = True;
+# endif /* 0 */
if (!ok)
return False;
Visual *new_v = 0;
Bool got_it;
+ /* On some systems (most recently, MacOS X) OpenGL programs get confused
+ when you kill one and re-start another on the same window. So maybe
+ it's best to just always destroy and recreate the xscreensaver window
+ when changing hacks, instead of trying to reuse the old one?
+ */
+ Bool always_recreate_window_p = True;
+
if (visual_name && *visual_name)
{
if (!strcmp(visual_name, "default-i") ||
ssi->install_cmap_p = install_cmap_p;
if (new_v &&
- ((ssi->current_visual != new_v) ||
+ (always_recreate_window_p ||
+ (ssi->current_visual != new_v) ||
(install_cmap_p != was_installed_p)))
{
Colormap old_c = ssi->cmap;