]> Dogcows Code - chaz/openbox/blob - obt/keyboard.h
add some tests for obt pieces (binary search, .desktop parsking, linkbase, and inotif...
[chaz/openbox] / 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 #include <X11/keysym.h>
25
26 G_BEGIN_DECLS
27
28 /*! These keys are bound to the modifier masks in any fashion,
29 except for CapsLock, Shift, and Control. */
30 typedef enum {
31 OBT_KEYBOARD_MODKEY_NONE,
32 OBT_KEYBOARD_MODKEY_CAPSLOCK,
33 OBT_KEYBOARD_MODKEY_NUMLOCK,
34 OBT_KEYBOARD_MODKEY_SCROLLLOCK,
35 OBT_KEYBOARD_MODKEY_SHIFT,
36 OBT_KEYBOARD_MODKEY_CONTROL,
37 OBT_KEYBOARD_MODKEY_SUPER,
38 OBT_KEYBOARD_MODKEY_HYPER,
39 OBT_KEYBOARD_MODKEY_META,
40 OBT_KEYBOARD_MODKEY_ALT,
41
42 OBT_KEYBOARD_NUM_MODKEYS
43 } ObtModkeysKey;
44
45 typedef struct _ObtIC ObtIC;
46
47 void obt_keyboard_reload(void);
48
49 /*! Get the modifier mask(s) for a keyboard event.
50 (eg. a keycode bound to Alt_L could return a mask of (Mod1Mask | Mask3Mask))
51 */
52 guint obt_keyboard_keyevent_to_modmask(XEvent *e);
53
54 /*! Strip off all modifiers except for the modifier keys. This strips stuff
55 like Button1Mask, and also LockMask, NumlockMask, and ScrolllockMask */
56 guint obt_keyboard_only_modmasks(guint mask);
57
58 /*! Get the modifier masks for a modifier key. This includes both the left and
59 right keys when there are both. */
60 guint obt_keyboard_modkey_to_modmask(ObtModkeysKey key);
61
62 /*! Get the modifier key which was pressed or released in a keyboard event */
63 ObtModkeysKey obt_keyboard_keyevent_to_modkey(XEvent *e);
64
65 /*! Convert a KeySym to all the KeyCodes which generate it. */
66 KeyCode* obt_keyboard_keysym_to_keycode(KeySym sym);
67
68 /*! Translate a KeyPress event to the unicode character it represents */
69 gunichar obt_keyboard_keypress_to_unichar(ObtIC *ic, XEvent *ev);
70
71 /*! Translate a KeyPress event to the KeySym that it represents. Use this
72 for control keys, not for getting text input! */
73 KeySym obt_keyboard_keypress_to_keysym(XEvent *ev);
74
75 /*! Create an input context for a window.
76 @client The top-level client window for the input context.
77 @focus The subwindow within the client for the input context.
78 */
79 ObtIC* obt_keyboard_context_new(Window client, Window focus);
80
81 void obt_keyboard_context_ref(ObtIC *ic);
82 void obt_keyboard_context_unref(ObtIC *ic);
83
84 G_END_DECLS
85
86 #endif /* __obt_keyboard_h */
This page took 0.031755 seconds and 4 git commands to generate.