commit 903c6bbb19a5a0329a92e0c3f59b0aeab7e0a203
parent 3025a889cbd04b1a7fc836b49d793b24c3780ddc
Author: Bastien Dejean <nihilhill@gmail.com>
Date: Wed, 3 Jul 2013 11:35:39 +0200
Only grab when needed
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'.
Diffstat:
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Sourcedeps b/Sourcedeps
@@ -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
diff --git a/grab.c b/grab.c
@@ -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)
diff --git a/types.c b/types.c
@@ -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)
{
@@ -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)
@@ -169,6 +171,8 @@ void abort_chain(void)
chained = false;
if (timeout > 0)
alarm(0);
+ ungrab();
+ grab();
}
void destroy_chain(chain_t *chain)