Skip to content

Commit

Permalink
Only grab when needed
Browse files Browse the repository at this point in the history
We don't want to initially grab chord at level one and up as it will
have unwanted side effects, the following:
    super + a ; {0-9}
        echo foo
will swallow key press events for the number keys, and pressing '32' in
an Inkscape text field will result in the following input: '23'.
  • Loading branch information
baskerville committed Jul 3, 2013
1 parent 3025a88 commit 903c6bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sourcedeps
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ grab.o: grab.c grab.h helpers.h parse.h sxhkd.h types.h
helpers.o: helpers.c helpers.h sxhkd.h types.h
parse.o: parse.c helpers.h locales.h parse.h sxhkd.h types.h
sxhkd.o: sxhkd.c grab.h helpers.h parse.h sxhkd.h types.h
types.o: types.c helpers.h parse.h sxhkd.h types.h
types.o: types.c grab.h helpers.h parse.h sxhkd.h types.h
3 changes: 1 addition & 2 deletions grab.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
void grab(void)
{
for (hotkey_t *hk = hotkeys; hk != NULL; hk = hk->next)
for (chord_t *chord = hk->chain->head; chord != NULL; chord = chord->next)
grab_chord(chord);
grab_chord(hk->chain->head);
}

void grab_chord(chord_t *chord)
Expand Down
4 changes: 4 additions & 0 deletions types.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <unistd.h>
#include "types.h"
#include "parse.h"
#include "grab.h"

hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield, uint8_t event_type, bool *replay_event)
{
Expand Down Expand Up @@ -32,6 +33,7 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel
} else {
c->state = c->state->next;
num_active++;
grab_chord(c->state);
}
} else if (chained) {
if (c->state->event_type == event_type)
Expand Down Expand Up @@ -169,6 +171,8 @@ void abort_chain(void)
chained = false;
if (timeout > 0)
alarm(0);
ungrab();
grab();
}

void destroy_chain(chain_t *chain)
Expand Down

0 comments on commit 903c6bb

Please sign in to comment.