This commit is contained in:
QC 2015-05-02 12:42:36 +02:00
parent ab715bf6b6
commit a974db887a
3 changed files with 7 additions and 17 deletions

View File

@ -104,7 +104,6 @@ DefaultBinding bindings[NUM_ABE] =
},
{
.id = ACCEPT_ENTRY,
// TODO: split Shift return in separate state.
.name = "kb-accept-entry",
.keybinding = "Control+j,Control+m,Return,KP_Enter",
},

View File

@ -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.
// We grab this using the rootwindow (as dmenu does it).
// this seems to result in the smallest delay for most people.
// TODO: Merge this loop back into take_keyboard.
int has_keyboard = FALSE;
for ( int i = 0; i < 500 &&
!( has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) ) );
i++ ) {
usleep ( 1000 );
}
int has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) );
if ( !has_keyboard ) {
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.
// We grab this using the rootwindow (as dmenu does it).
// this seems to result in the smallest delay for most people.
// TODO: Merge this loop back into take_keyboard.
int has_keyboard = FALSE;
for ( int i = 0; i < 500 &&
!( has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) ) );
i++ ) {
usleep ( 1000 );
}
int has_keyboard = take_keyboard ( display, DefaultRootWindow ( display ) );
if ( !has_keyboard ) {
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 );

View File

@ -243,8 +243,11 @@ int window_send_message ( Display *display, Window target,
int take_keyboard ( Display *display, Window w )
{
if ( XGrabKeyboard ( display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime ) == GrabSuccess ) {
return 1;
for ( int i = 0; i < 500; i++) {
if ( XGrabKeyboard ( display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime ) == GrabSuccess ) {
return 1;
}
usleep ( 1000 );
}
return 0;