grabbing: make the retry loop much slower (waits up to half a second)
This should fix a race condition where the Mod-key was not released in time when starting i3lock using a key combination.
This commit is contained in:
parent
c24922f0f2
commit
7f42665245
9
xcb.c
9
xcb.c
|
@ -13,6 +13,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
|
||||||
|
@ -138,7 +139,7 @@ void grab_pointer_and_keyboard(xcb_connection_t *conn, xcb_screen_t *screen) {
|
||||||
xcb_grab_keyboard_cookie_t kcookie;
|
xcb_grab_keyboard_cookie_t kcookie;
|
||||||
xcb_grab_keyboard_reply_t *kreply;
|
xcb_grab_keyboard_reply_t *kreply;
|
||||||
|
|
||||||
int tries = 1000;
|
int tries = 10000;
|
||||||
|
|
||||||
while (tries-- > 0) {
|
while (tries-- > 0) {
|
||||||
pcookie = xcb_grab_pointer(
|
pcookie = xcb_grab_pointer(
|
||||||
|
@ -158,6 +159,9 @@ void grab_pointer_and_keyboard(xcb_connection_t *conn, xcb_screen_t *screen) {
|
||||||
free(preply);
|
free(preply);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make this quite a bit slower */
|
||||||
|
usleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (tries-- > 0) {
|
while (tries-- > 0) {
|
||||||
|
@ -175,6 +179,9 @@ void grab_pointer_and_keyboard(xcb_connection_t *conn, xcb_screen_t *screen) {
|
||||||
free(kreply);
|
free(kreply);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make this quite a bit slower */
|
||||||
|
usleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tries <= 0)
|
if (tries <= 0)
|
||||||
|
|
Loading…
Reference in New Issue