int handle_bindings(int ch, const char *args) { binding_t *b; for (b = bindings; b; b = b->next) { if (ch == b->ch) { run_binding(b, args); return 1; } } return 0; }
/* * There was a KeyPress or KeyRelease (both events have the same fields). We * compare this key code with our bindings table and pass the bound action to * parse_command(). * */ void handle_key_press(xcb_key_press_event_t *event) { bool key_release = (event->response_type == XCB_KEY_RELEASE); last_timestamp = event->time; DLOG("%s %d, state raw = %d\n", (key_release ? "KeyRelease" : "KeyPress"), event->detail, event->state); Binding *bind = get_binding_from_xcb_event((xcb_generic_event_t *)event); /* if we couldn't find a binding, we are done */ if (bind == NULL) return; CommandResult *result = run_binding(bind); if (result->needs_tree_render) tree_render(); command_result_free(result); }