naughty: check for D-Bus availability
[awesome.git] / key.h
blob796872b9e9a890ae925fa91556d3fde9499610ab
1 /*
2 * key.h - Keybinding helpers
4 * Copyright © 2008 Pierre Habouzit <madcoder@debian.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef AWESOME_KEYBINDING_H
23 #define AWESOME_KEYBINDING_H
25 #include <xcb/xcb.h>
26 #include "luaa.h"
27 #include "common/array.h"
29 typedef struct keyb_t
31 /** Ref count */
32 int refcount;
33 /** Key modifier */
34 unsigned long mod;
35 /** Keysym */
36 xcb_keysym_t keysym;
37 /** Keycode */
38 xcb_keycode_t keycode;
39 /** Lua function to execute on press */
40 luaA_ref press;
41 /** Lua function to execute on release */
42 luaA_ref release;
43 } keyb_t;
45 ARRAY_TYPE(keyb_t *, key)
47 /** Key bindings */
48 typedef struct
50 key_array_t by_code;
51 key_array_t by_sym;
52 } keybindings_t;
54 keyb_t *key_find(keybindings_t *, const xcb_key_press_event_t *);
55 xcb_keysym_t key_getkeysym(xcb_keycode_t, uint16_t);
57 void luaA_key_array_set(lua_State *, int, keybindings_t *);
58 int luaA_key_array_get(lua_State *, keybindings_t *);
60 void window_grabkeys(xcb_window_t, keybindings_t *);
62 int luaA_key_new(lua_State *);
64 #endif