all repos — dmenu @ c42c3780274e6b12eaeab918cf7c13d2c36cf253

my build of dmenu

Replace deprecated usleep() with nanosleep()
Quentin Rameau quinq@fifth.space
Mon, 28 Sep 2015 00:06:05 +0200
commit

c42c3780274e6b12eaeab918cf7c13d2c36cf253

parent

c15a95a061bdb8235220b37638d1b586611f0ac6

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M dmenu.cdmenu.c

@@ -6,7 +6,7 @@ #include <stdio.h>

#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 @@

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 @@ for (i = 0; i < 1000; i++) {

if (XGrabKeyboard(dpy, DefaultRootWindow(dpy), True, GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess) return; - usleep(1000); + nanosleep(&ts, NULL); } die("cannot grab keyboard\n"); }