From 5b7200daf22adb266a3cefd5ae87d06161357eaf Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 9 Mar 2008 12:25:20 +0100 Subject: [PATCH] [awesome-menu] Try harder to grab keyboard Signed-off-by: Julien Danjou --- awesome-menu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/awesome-menu.c b/awesome-menu.c index cd06bbbd..465f98b4 100644 --- a/awesome-menu.c +++ b/awesome-menu.c @@ -620,8 +620,14 @@ main(int argc, char **argv) compute_match(); - if(XGrabKeyboard(disp, DefaultRootWindow(disp), True, - GrabModeAsync, GrabModeAsync, CurrentTime) != GrabSuccess) + for(opt = 1000; opt; opt--) + { + if(XGrabKeyboard(disp, DefaultRootWindow(disp), True, + GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess) + break; + usleep(1000); + } + if(!opt) eprint("cannot grab keyboard"); redraw();