aboutsummaryrefslogtreecommitdiff
path: root/dmenu.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2015-09-28 00:06:05 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-09-28 00:15:13 +0200
commitc42c3780274e6b12eaeab918cf7c13d2c36cf253 (patch)
tree0cdf571f2a15a1f44e91a2e4c7080a7372036049 /dmenu.c
parentc15a95a061bdb8235220b37638d1b586611f0ac6 (diff)
downloaddmenu-c42c3780274e6b12eaeab918cf7c13d2c36cf253.tar.gz
dmenu-c42c3780274e6b12eaeab918cf7c13d2c36cf253.tar.bz2
dmenu-c42c3780274e6b12eaeab918cf7c13d2c36cf253.zip
Replace deprecated usleep() with nanosleep()
Diffstat (limited to 'dmenu.c')
-rw-r--r--dmenu.c5
1 files 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 <stdlib.h>
#include <string.h>
#include <strings.h>
-#include <unistd.h>
+#include <time.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
@@ -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");
}