sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
Log | Files | Refs | README | LICENSE

commit 7c4c42e762256a08155e2d1b33c8eaf037333ebd
parent f2893649edd8522eb0254b11715ae0ff400dbeb3
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Sun, 23 Jun 2013 11:11:15 +0200

When there's no waiters, abort the chain

Diffstat:
Mtypes.c | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/types.c b/types.c @@ -8,6 +8,7 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield, uint8_t event_type, bool *replay_event) { int hits = 0; + int num_waiters = 0; for (hotkey_t *hk = hotkeys; hk != NULL; hk = hk->next) { chain_t *c = hk->chain; @@ -22,10 +23,14 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel return hk; } else { c->state = c->state->next; + num_waiters++; } hits++; - } else if (chained && c->state->event_type == event_type) { - c->state = c->head; + } else if (chained) { + if (c->state->event_type == event_type) + c->state = c->head; + else + num_waiters++; } } @@ -43,6 +48,11 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel } } + PRINTF("num waiters %i\n", num_waiters); + + if (chained && num_waiters == 0) + abort_chain(); + return NULL; }