From c42c3780274e6b12eaeab918cf7c13d2c36cf253 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 28 Sep 2015 00:06:05 +0200 Subject: Replace deprecated usleep() with nanosleep() --- dmenu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dmenu.c b/dmenu.c index 49a6583..aa6e5d8 100644 --- a/dmenu.c +++ b/dmenu.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -203,6 +203,7 @@ drawmenu(void) static void grabkeyboard(void) { + struct timespec ts = { .tv_sec = 1, .tv_nsec = 0 }; int i; /* try to grab keyboard, we may have to wait for another process to ungrab */ @@ -210,7 +211,7 @@ grabkeyboard(void) if (XGrabKeyboard(dpy, DefaultRootWindow(dpy), True, GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess) return; - usleep(1000); + nanosleep(&ts, NULL); } die("cannot grab keyboard\n"); } -- cgit v1.2.3-13-gbd6f