1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Fix grab keyboard to wait on success.

This commit is contained in:
Dave Davenport 2016-02-28 10:36:13 +01:00
parent 6d0d6d9eb2
commit 460cad8bc8

View file

@ -313,13 +313,17 @@ int take_keyboard ( xcb_connection_t *xcb_connection, xcb_window_t w )
{ {
for ( int i = 0; i < 500; i++ ) { for ( int i = 0; i < 500; i++ ) {
xcb_grab_keyboard_cookie_t cc = xcb_grab_keyboard ( xcb_connection, 1, w, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC, xcb_grab_keyboard_cookie_t cc = xcb_grab_keyboard ( xcb_connection,
1, w, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC); XCB_GRAB_MODE_ASYNC);
xcb_grab_keyboard_reply_t *r = xcb_grab_keyboard_reply ( xcb_connection, cc, NULL); xcb_grab_keyboard_reply_t *r = xcb_grab_keyboard_reply ( xcb_connection, cc, NULL);
if ( r ) { if ( r ) {
free ( r ); if ( r->status == XCB_GRAB_STATUS_SUCCESS) {
free(r);
return 1; return 1;
} }
free ( r );
}
usleep ( 1000 ); usleep ( 1000 );
} }