projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://packetstormsecurity.org/UNIX/admin/xscreensaver-3.28.tar.gz
[xscreensaver]
/
driver
/
windows.c
diff --git
a/driver/windows.c
b/driver/windows.c
index b092a72b62d82baae3231b3155d61019a8bc8a51..29e046190fed02b12ece386ba3a496c2c3d875bf 100644
(file)
--- a/
driver/windows.c
+++ b/
driver/windows.c
@@
-1,5
+1,5
@@
/* windows.c --- turning the screen black; dealing with visuals, virtual roots.
/* windows.c --- turning the screen black; dealing with visuals, virtual roots.
- * xscreensaver, Copyright (c) 1991-200
0
Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1991-200
1
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
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@
-159,28
+159,39
@@
static Bool
grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor)
{
Status mstatus, kstatus;
grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor)
{
Status mstatus, kstatus;
- XSync (si->dpy, False);
+ int i;
+ int retries = 4;
- kstatus = grab_kbd (si, window);
- if (kstatus != GrabSuccess)
- { /* try again in a second */
- sleep (1);
+ for (i = 0; i < retries; i++)
+ {
+ XSync (si->dpy, False);
kstatus = grab_kbd (si, window);
kstatus = grab_kbd (si, window);
- if (kstatus != GrabSuccess)
- fprintf (stderr, "%s: couldn't grab keyboard! (%s)\n",
- blurb(), grab_string(kstatus));
- }
+ if (kstatus == GrabSuccess)
+ break;
- mstatus = grab_mouse (si, window, cursor);
- if (mstatus != GrabSuccess)
- { /* try again in a second */
+ /* else, wait a second and try to grab again. */
sleep (1);
sleep (1);
+ }
+
+ if (kstatus != GrabSuccess)
+ fprintf (stderr, "%s: couldn't grab keyboard! (%s)\n",
+ blurb(), grab_string(kstatus));
+
+ for (i = 0; i < retries; i++)
+ {
+ XSync (si->dpy, False);
mstatus = grab_mouse (si, window, cursor);
mstatus = grab_mouse (si, window, cursor);
- if (mstatus != GrabSuccess)
- fprintf (stderr, "%s: couldn't grab pointer! (%s)\n",
- blurb(), grab_string(mstatus));
+ if (mstatus == GrabSuccess)
+ break;
+
+ /* else, wait a second and try to grab again. */
+ sleep (1);
}
}
+ if (mstatus != GrabSuccess)
+ fprintf (stderr, "%s: couldn't grab pointer! (%s)\n",
+ blurb(), grab_string(mstatus));
+
return (kstatus == GrabSuccess ||
mstatus == GrabSuccess);
}
return (kstatus == GrabSuccess ||
mstatus == GrabSuccess);
}