mirror of https://github.com/davatorium/rofi.git
Fix issue #153.
This commit is contained in:
parent
ab715bf6b6
commit
a974db887a
|
@ -104,7 +104,6 @@ DefaultBinding bindings[NUM_ABE] =
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.id = ACCEPT_ENTRY,
|
.id = ACCEPT_ENTRY,
|
||||||
// TODO: split Shift return in separate state.
|
|
||||||
.name = "kb-accept-entry",
|
.name = "kb-accept-entry",
|
||||||
.keybinding = "Control+j,Control+m,Return,KP_Enter",
|
.keybinding = "Control+j,Control+m,Return,KP_Enter",
|
||||||
},
|
},
|
||||||
|
|
|
@ -936,13 +936,7 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
|
||||||
// Try to grab the keyboard as early as possible.
|
// Try to grab the keyboard as early as possible.
|
||||||
// We grab this using the rootwindow (as dmenu does it).
|
// We grab this using the rootwindow (as dmenu does it).
|
||||||
// this seems to result in the smallest delay for most people.
|
// this seems to result in the smallest delay for most people.
|
||||||
// TODO: Merge this loop back into take_keyboard.
|
int has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) );
|
||||||
int has_keyboard = FALSE;
|
|
||||||
for ( int i = 0; i < 500 &&
|
|
||||||
!( has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) ) );
|
|
||||||
i++ ) {
|
|
||||||
usleep ( 1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !has_keyboard ) {
|
if ( !has_keyboard ) {
|
||||||
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 );
|
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 );
|
||||||
|
@ -1288,13 +1282,7 @@ void error_dialog ( const char *msg )
|
||||||
// Try to grab the keyboard as early as possible.
|
// Try to grab the keyboard as early as possible.
|
||||||
// We grab this using the rootwindow (as dmenu does it).
|
// We grab this using the rootwindow (as dmenu does it).
|
||||||
// this seems to result in the smallest delay for most people.
|
// this seems to result in the smallest delay for most people.
|
||||||
// TODO: Merge this loop back into take_keyboard.
|
int has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) );
|
||||||
int has_keyboard = FALSE;
|
|
||||||
for ( int i = 0; i < 500 &&
|
|
||||||
!( has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) ) );
|
|
||||||
i++ ) {
|
|
||||||
usleep ( 1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !has_keyboard ) {
|
if ( !has_keyboard ) {
|
||||||
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 );
|
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 );
|
||||||
|
|
|
@ -243,8 +243,11 @@ int window_send_message ( Display *display, Window target,
|
||||||
|
|
||||||
int take_keyboard ( Display *display, Window w )
|
int take_keyboard ( Display *display, Window w )
|
||||||
{
|
{
|
||||||
if ( XGrabKeyboard ( display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime ) == GrabSuccess ) {
|
for ( int i = 0; i < 500; i++) {
|
||||||
return 1;
|
if ( XGrabKeyboard ( display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime ) == GrabSuccess ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
usleep ( 1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue