Skip to content

Commit

Permalink
Revert "A locked hotkey should catch everything"
Browse files Browse the repository at this point in the history
This reverts commit 6988a37.
  • Loading branch information
baskerville committed Oct 7, 2017
1 parent 6988a37 commit c481822
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/sxhkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/sxhkd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 7 additions & 8 deletions src/types.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand All @@ -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 {
Expand All @@ -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++;
Expand All @@ -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);

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c481822

Please sign in to comment.