Xinqi Bao's Git
projects
/
dmenu.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
7312041
)
attempt to grab the keyboard only 1000 times, not forever.
author
Anselm R. Garbe <
[email protected]
>
Wed, 7 Mar 2007 10:01:14 +0000
(11:01 +0100)
committer
Anselm R. Garbe <
[email protected]
>
Wed, 7 Mar 2007 10:01:14 +0000
(11:01 +0100)
config.mk
patch
|
blob
|
history
main.c
patch
|
blob
|
history
diff --git
a/config.mk
b/config.mk
index
07b323b
..
75cc46d
100644
(file)
--- a/
config.mk
+++ b/
config.mk
@@
-1,5
+1,5
@@
# dmenu version
# dmenu version
-VERSION = 2.
7
+VERSION = 2.
8
# Customize below to fit your system
# Customize below to fit your system
diff --git
a/main.c
b/main.c
index
0f07773
..
fa03ec8
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-108,11
+108,17
@@
drawmenu(void) {
XFlush(dpy);
}
XFlush(dpy);
}
-static
void
+static
Bool
grabkeyboard(void) {
grabkeyboard(void) {
- while(XGrabKeyboard(dpy, root, True, GrabModeAsync,
- GrabModeAsync, CurrentTime) != GrabSuccess)
+ unsigned int len;
+
+ for(len = 1000; len; len--) {
+ if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
+ == GrabSuccess)
+ break;
usleep(1000);
usleep(1000);
+ }
+ return len > 0;
}
static unsigned long
}
static unsigned long
@@
-456,10
+462,10
@@
main(int argc, char *argv[]) {
root = RootWindow(dpy, screen);
if(isatty(STDIN_FILENO)) {
maxname = readstdin();
root = RootWindow(dpy, screen);
if(isatty(STDIN_FILENO)) {
maxname = readstdin();
- grabkeyboard();
+
running =
grabkeyboard();
}
else { /* prevent keypress loss */
}
else { /* prevent keypress loss */
- grabkeyboard();
+
running =
grabkeyboard();
maxname = readstdin();
}
/* init modifier map */
maxname = readstdin();
}
/* init modifier map */