2 /* ======================================================================= *\
3 File : kbmap.h, kbmap.h,v 1.3 1996/12/10 04:35:57 larsbj Exp
4 Author : chb, 30.Oct.1995
6 Purpose: class definitions for XKeyEvent keymap handling
7 \* ======================================================================= */
18 #define KB_PREALLOC 16
19 #define KB_HASHSIZE 128 // yes, yes - I know. 128 is not exactly prime :-)
20 // ... but we are dealing with ASCII chars mostly.
34 /// Keymap for prefix keys
37 /// Action for !prefix keys
42 /// Defines key maps and actions for key sequences
53 /// Bind a key-sequence to an action
54 /** Returns 0 on success. Otherwise, position in string where
56 int bind(char const* seq, int action);
59 int print(char* buf, int maxlen) const;
61 /// Look up a key in the keymap
62 int lookup(KeySym key, unsigned mod, kb_sequence *seq);
64 /// Given an action, find all keybindings.
65 LString findbinding(int action) const;
67 /// Define a new key sequence
68 int defkey(kb_sequence *seq, int action, int idx = 0);
70 /// Size of the table (<0: hashtab)
73 /// Holds the defined keys
74 /** Both kinds of tables ends with NoSymbol */
77 /// Table for linear array
80 /// Hash table holding key lists
86 /// Holds a key sequence and the current and standard keymaps
93 modifiers = staticmod;
104 if (sequence != staticseq) {
110 /// Add a key to the key sequence and look it up in the curmap
111 /** Add a key to the key sequence and look it up in the curmap
112 if the latter is defined. */
113 int addkey(KeySym key, unsigned mod, unsigned nmod = 0);
116 int print(char *buf, int maxlen, bool when_defined = false) const; //RVDK_PATCH_5
119 int printOptions(char *buf, int maxlen) const;
121 /// Make length negative to mark the sequence as deleted
134 int parse(char const *s);
136 /// Keymap to use if a new sequence is starting
139 /// Keymap to use for the next key
142 /// Array holding the current key sequence
143 /** If sequence[length-1] < 0xff it can be used as ISO8859 char */
144 unsigned int *sequence;
147 unsigned int *modifiers;
149 /// Current length of key sequence
153 /// Static array preallocated for sequence
154 unsigned int staticseq[KB_PREALLOC];
157 unsigned int staticmod[KB_PREALLOC];
159 /// Physically allocated storage size