sxhkd-rc

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

commit c48182274132e2f586f15ec81f1b8075b101ea0c
parent 6988a37ae8179db217b5c9936fcb32896b1d9182
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Sat,  7 Oct 2017 13:40:58 +0200

Revert "A locked hotkey should catch everything"

This reverts commit 6988a37ae8179db217b5c9936fcb32896b1d9182.

Diffstat:
Msrc/sxhkd.c | 3+--
Msrc/sxhkd.h | 3+--
Msrc/types.c | 15+++++++--------
3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/sxhkd.c b/src/sxhkd.c @@ -121,8 +121,7 @@ int main(int argc, char *argv[]) fd_set descriptors; - reload = toggle_grab = bell = chained = false; - locked = NULL; + reload = toggle_grab = bell = chained = locked = false; running = true; xcb_flush(dpy); diff --git a/src/sxhkd.h b/src/sxhkd.h @@ -58,8 +58,7 @@ int mapping_count; int timeout; hotkey_t *hotkeys_head, *hotkeys_tail; -bool running, grabbed, toggle_grab, reload, bell, chained; -hotkey_t *locked; +bool running, grabbed, toggle_grab, reload, bell, chained, locked; chord_t *escape_chord; uint16_t num_lock; diff --git a/src/types.c b/src/types.c @@ -37,9 +37,8 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel for (hotkey_t *hk = hotkeys_head; hk != NULL; hk = hk->next) { chain_t *c = hk->chain; - if ((chained && c->state == c->head) || (locked != NULL && hk != locked)) { + if (chained && c->state == c->head) continue; - } if (match_chord(c->state, event_type, keysym, button, modfield)) { if (status_fifo != NULL && num_active == 0) { if (!chained) { @@ -52,8 +51,8 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel } if (replay_event != NULL && c->state->replay_event) *replay_event = true; - if (locked == NULL && c->state->lock_chain) { - locked = hk; + if (!locked && c->state->lock_chain) { + locked = true; if (timeout > 0) alarm(0); } @@ -65,7 +64,7 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel result = hk; continue; } - if (chained && locked == NULL) + if (chained && !locked) abort_chain(); return hk; } else { @@ -74,7 +73,7 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel grab_chord(c->state); } } else if (chained) { - if (locked == NULL && c->state->event_type == event_type) + if (!locked && c->state->event_type == event_type) c->state = c->head; else num_active++; @@ -94,7 +93,7 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel abort_chain(); return find_hotkey(keysym, button, modfield, event_type, replay_event); } - if (chained && locked == NULL && timeout > 0) + if (chained && !locked && timeout > 0) alarm(timeout); PRINTF("num active %i\n", num_active); @@ -224,7 +223,7 @@ void abort_chain(void) for (hotkey_t *hk = hotkeys_head; hk != NULL; hk = hk->next) hk->chain->state = hk->chain->head; chained = false; - locked = NULL; + locked = false; if (timeout > 0) alarm(0); ungrab();