i3/src/key_press.c
Michael Stapelberg f354f53435 Ensure all *.[ch] files include config.h
Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
2016-10-23 21:09:24 +02:00

34 lines
930 B
C

/*
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
* key_press.c: key press handler
*
*/
#include "all.h"
/*
* 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) {
const bool key_release = (event->response_type == XCB_KEY_RELEASE);
last_timestamp = event->time;
DLOG("%s %d, state raw = 0x%x\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, NULL);
command_result_free(result);
}