http://mulliner.org/bluetooth/xkbdbthid-0.1_src.tar.gz
[xkbdbthid.git] / xkbd-0.8.15_bthid / src / libvirtkeys.h
1 /*
2  * virtkeyslib.h - Definitions for the virtkeys library.
3  * Copyright (c) 2000, Merle F. McClelland for CompanionLink
4  * 
5  * See the files COPYRIGHT and LICENSE for distribution information.
6  *
7  * Note that these routines are somewhat oriented to a virtual keyboard
8  * design, but are also intended to support handwriting input windows
9  * that have very similar needs.
10  * 
11  */
12
13 #define SHOWSEQUENCES
14 #include <sys/param.h>
15
16 extern int debug;
17
18 #ifndef TRUE
19 #define TRUE    1
20 #define FALSE   0
21 #endif
22
23 enum keyType { regularKey, shiftKey, capsKey, controlKey, metaKey, altKey, specialCharKey, numKeyTypes };
24
25 enum modifierMode { unshiftedMode, shiftedMode, unshiftedSpecialCharMode, shiftedSpecialCharMode, numModes };
26
27 enum keyDirection { keyDown, keyUp, keyDownUp };
28
29 struct keycodeEntry
30 {
31             KeyCode             keycode;
32             enum keyDirection           direction;              // Indicates key down, key up, or down/up
33 };
34
35 #define MAXKEYCODES     10
36 #define MAXLABELLEN     10
37
38 struct keyDescriptionEntry
39 {
40         enum keyType    theType;
41         int             col;
42         int             row;
43         int             width;
44
45         // The following array is not used for the modifier keys Shift, Caps, and SpecialChar, as pressing
46         // these keys do not actually send key codes. 
47
48         struct          keycodeEntry outputSequence[numModes][MAXKEYCODES];     // Terminated with 0
49         void            *objectData;    // Can be used to hold a pointer to data associated with the key
50         char            *label[numModes];
51         int             labelIsPath;
52         int             regularCAPS;    // Indicates that the key, in regular mode, responds to the CAPS lock modifier
53         int             specialCAPS;    // Indicates that the key, in special mode, responds to the CAPS lock modifier
54 };
55
56 #define MAXLINECHARS    300
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 int setupKeyboardVariables(Display *dpy);
63
64 int lookupKeyCodeSequence(KeySym ks, struct keycodeEntry *keycodeEntryTable, char **labelBuffer);
65
66 int loadKeySymTable();
67
68 // Routines to manage and use the XTest extension
69
70 int setupXTest();
71
72 void closeXTest();
73
74 // And these routines actually send sequences of keycodes and up/down indicators via the XTest extension
75
76 void sendKeySequence(struct keycodeEntry *entries, int controlMode, int metaMode, int altMode, int shiftMode);
77
78
79 void sendKey(KeyCode character, enum keyDirection keydirection);
80
81 #ifdef __cplusplus
82 }
83 #endif