Button4MotionMask | Button5MotionMask | ButtonMotionMask)
+static const char *
+grab_string(int status)
+{
+ switch (status)
+ {
+ case GrabSuccess: return "GrabSuccess";
+ case AlreadyGrabbed: return "AlreadyGrabbed";
+ case GrabInvalidTime: return "GrabInvalidTime";
+ case GrabNotViewable: return "GrabNotViewable";
+ case GrabFrozen: return "GrabFrozen";
+ default:
+ {
+ static char foo[255];
+ sprintf(foo, "unknown status: %d", status);
+ return foo;
+ }
+ }
+}
+
static int
grab_kbd(saver_info *si, Window w)
{
if (p->verbose_p)
fprintf(stderr, "%s: grabbing keyboard on 0x%x... %s.\n",
- blurb(), (unsigned long) w,
- (status == GrabSuccess ? "GrabSuccess" :
- status == AlreadyGrabbed ? "AlreadyGrabbed" :
- status == GrabInvalidTime ? "GrabInvalidTime" :
- status == GrabNotViewable ? "GrabNotViewable" :
- status == GrabFrozen ? "GrabFrozen" :
- "???"));
-
+ blurb(), (unsigned long) w, grab_string(status));
return status;
}
-static const char *
-grab_string(int status)
-{
- switch (status)
- {
- case GrabSuccess: return "GrabSuccess"; break;
- case AlreadyGrabbed: return "AlreadyGrabbed"; break;
- case GrabInvalidTime: return "GrabInvalidTime"; break;
- case GrabNotViewable: return "GrabNotViewable"; break;
- case GrabFrozen: return "GrabFrozen"; break;
- default:
- {
- static char foo[255];
- sprintf(foo, "unknown status: %d", status);
- return foo;
- }
- }
-}
-
static int
grab_mouse (saver_info *si, Window w, Cursor cursor)
}
-Bool
+static Bool
grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor)
{
Status mstatus, kstatus;
mstatus == GrabSuccess);
}
-void
+static void
ungrab_keyboard_and_mouse (saver_info *si)
{
ungrab_mouse (si);
}
}
-void
+Bool
blank_screen (saver_info *si)
{
int i;
+ Bool ok;
/* Note: we do our grabs on the root window, not on the screensaver window.
If we grabbed on the saver window, then the demo mode and lock dialog
boxes wouldn't get any events.
*/
- grab_keyboard_and_mouse (si,
- /*si->screens[0].screensaver_window,*/
- RootWindowOfScreen(si->screens[0].screen),
- (si->demoing_p
- ? 0
- : si->screens[0].cursor));
+ ok = grab_keyboard_and_mouse (si,
+ /*si->screens[0].screensaver_window,*/
+ RootWindowOfScreen(si->screens[0].screen),
+ (si->demoing_p
+ ? 0
+ : si->screens[0].cursor));
+
+
+ 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. */
+ ok = True;
+
+ if (!ok)
+ return False;
for (i = 0; i < si->nscreens; i++)
{
#endif
si->screen_blanked_p = True;
+
+ return True;
}
void