]> git.sur5r.net Git - i3/i3/blob - src/key_press.c
Merge branch 'release-4.16.1'
[i3/i3] / src / key_press.c
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * key_press.c: key press handler
8  *
9  */
10 #include "all.h"
11
12 /*
13  * There was a KeyPress or KeyRelease (both events have the same fields). We
14  * compare this key code with our bindings table and pass the bound action to
15  * parse_command().
16  *
17  */
18 void handle_key_press(xcb_key_press_event_t *event) {
19     const bool key_release = (event->response_type == XCB_KEY_RELEASE);
20
21     last_timestamp = event->time;
22
23     DLOG("%s %d, state raw = 0x%x\n", (key_release ? "KeyRelease" : "KeyPress"), event->detail, event->state);
24
25     Binding *bind = get_binding_from_xcb_event((xcb_generic_event_t *)event);
26
27     /* if we couldn't find a binding, we are done */
28     if (bind == NULL)
29         return;
30
31     CommandResult *result = run_binding(bind, NULL);
32     command_result_free(result);
33 }