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 \* ==================================================================== */
20 #define KB_PREALLOC 16
33 /// Keymap for prefix keys
36 /// Action for !prefix keys
41 /// Defines key maps and actions for key sequences
52 /// Bind a key-sequence to an action
53 /** Returns 0 on success. Otherwise, position in string where
55 int bind(char const * seq, int action);
58 void print(string & buf) const;
60 /// Look up a key in the keymap
61 int lookup(KeySym key, unsigned mod, kb_sequence * seq);
63 /// Given an action, find all keybindings.
64 string findbinding(int action) const;
66 /// Define a new key sequence
67 int defkey(kb_sequence * seq, int action, int idx = 0);
69 /// Size of the table (<0: hashtab)
72 /// Holds the defined keys
73 /// Table for linear array, table ends with NoSymbol.
78 /// Holds a key sequence and the current and standard keymaps
85 modifiers = staticmod;
96 if (sequence != staticseq) {
102 /// Add a key to the key sequence and look it up in the curmap
103 /** Add a key to the key sequence and look it up in the curmap
104 if the latter is defined. */
105 int addkey(KeySym key, unsigned mod, unsigned nmod = 0);
108 int print(string & buf, bool when_defined = false) const;
111 int printOptions(string & buf) const;
113 /// Make length negative to mark the sequence as deleted
126 int parse(char const * s);
128 /// Keymap to use if a new sequence is starting
131 /// Keymap to use for the next key
134 /// Array holding the current key sequence
135 /** If sequence[length-1] < 0xff it can be used as ISO8859 char */
136 unsigned int * sequence;
139 unsigned int * modifiers;
141 /// Current length of key sequence
145 /// Static array preallocated for sequence
146 unsigned int staticseq[KB_PREALLOC];
149 unsigned int staticmod[KB_PREALLOC];
151 /// Physically allocated storage size