]> icculus.org git repositories - dana/openbox.git/blob - obt/keyboard.h
use g_debug for debug messages
[dana/openbox.git] / obt / keyboard.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    obt/keyboard.h for the Openbox window manager
4    Copyright (c) 2007        Dana Jansens
5
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.
10
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.
15
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __obt_keyboard_h
20 #define __obt_keyboard_h
21
22 #include <glib.h>
23 #include <X11/Xlib.h>
24
25 G_BEGIN_DECLS
26
27 /*! These keys are bound to the modifier masks in any fashion,
28   except for CapsLock, Shift, and Control. */
29 typedef enum {
30     OBT_KEYBOARD_MODKEY_CAPSLOCK,
31     OBT_KEYBOARD_MODKEY_NUMLOCK,
32     OBT_KEYBOARD_MODKEY_SCROLLLOCK,
33     OBT_KEYBOARD_MODKEY_SHIFT,
34     OBT_KEYBOARD_MODKEY_CONTROL,
35     OBT_KEYBOARD_MODKEY_SUPER,
36     OBT_KEYBOARD_MODKEY_HYPER,
37     OBT_KEYBOARD_MODKEY_META,
38     OBT_KEYBOARD_MODKEY_ALT,
39
40     OBT_KEYBOARD_NUM_MODKEYS
41 } ObtModkeysKey;
42
43 void obt_keyboard_reload(void);
44
45 /*! Get the modifier mask(s) for a KeyCode. (eg. a keycode bound to Alt_L could
46   return a mask of (Mod1Mask | Mask3Mask)) */
47 guint obt_keyboard_keycode_to_modmask(guint keycode);
48
49 /*! Strip off all modifiers except for the modifier keys. This strips stuff
50   like Button1Mask, and also LockMask, NumlockMask, and ScrolllockMask */
51 guint obt_keyboard_only_modmasks(guint mask);
52
53 /*! Get the modifier masks for a modifier key. This includes both the left and
54   right keys when there are both. */
55 guint obt_keyboard_modkey_to_modmask(ObtModkeysKey key);
56
57 /*! Convert a KeySym to a KeyCode, because the X function is terrible - says
58   valgrind. */
59 KeyCode obt_keyboard_keysym_to_keycode(KeySym sym);
60
61 /*! Give the string form of a KeyCode */
62 gchar *obt_keyboard_keycode_to_string(guint keycode);
63
64 /*! Translate a KeyCode to the unicode character it represents */
65 gunichar obt_keyboard_keycode_to_unichar(guint keycode);
66
67
68 G_END_DECLS
69
70 #endif /* __obt_keyboard_h */