1 /** 2 * @file key.h 3 * @author Joe Wingbermuehle 4 * @date 2004-2006 5 * 6 * @brief Header for the key binding functions. 7 * 8 */ 9 10 #ifndef KEY_H 11 #define KEY_H 12 13 /** Enumeration of key binding types. 14 * Note that we use the high bits to store additional information 15 * for some key types (for example the desktop number). 16 */ 17 typedef unsigned short KeyType; 18 #define KEY_NONE 0 19 #define KEY_UP 1 20 #define KEY_DOWN 2 21 #define KEY_RIGHT 3 22 #define KEY_LEFT 4 23 #define KEY_ESC 5 24 #define KEY_ENTER 6 25 #define KEY_NEXT 7 26 #define KEY_NEXTSTACK 8 27 #define KEY_PREV 9 28 #define KEY_PREVSTACK 10 29 #define KEY_CLOSE 11 30 #define KEY_MIN 12 31 #define KEY_MAX 13 32 #define KEY_SHADE 14 33 #define KEY_STICK 15 34 #define KEY_MOVE 16 35 #define KEY_RESIZE 17 36 #define KEY_ROOT 18 37 #define KEY_WIN 19 38 #define KEY_DESKTOP 20 39 #define KEY_RDESKTOP 21 40 #define KEY_LDESKTOP 22 41 #define KEY_UDESKTOP 23 42 #define KEY_DDESKTOP 24 43 #define KEY_SHOWDESK 25 44 #define KEY_SHOWTRAY 26 45 #define KEY_EXEC 27 46 #define KEY_RESTART 28 47 #define KEY_EXIT 29 48 #define KEY_FULLSCREEN 30 49 #define KEY_SENDR 31 50 #define KEY_SENDL 32 51 #define KEY_SENDU 33 52 #define KEY_SENDD 34 53 #define KEY_MAXTOP 35 54 #define KEY_MAXBOTTOM 36 55 #define KEY_MAXLEFT 37 56 #define KEY_MAXRIGHT 38 57 #define KEY_MAXV 39 58 #define KEY_MAXH 40 59 #define KEY_RESTORE 41 60 61 void InitializeKeys(void); 62 void StartupKeys(void); 63 void ShutdownKeys(void); 64 void DestroyKeys(void); 65 66 /** Mask of 'lock' keys. */ 67 extern unsigned int lockMask; 68 69 /** Get the action to take from a key event. 70 * @param event The event. 71 */ 72 KeyType GetKey(const XKeyEvent *event); 73 74 /** Parse a modifier string. 75 * @param str The modifier string. 76 * @return The modifier mask. 77 */ 78 unsigned int ParseModifierString(const char *str); 79 80 /** Insert a key binding. 81 * @param key The key binding type. 82 * @param modifiers The modifier mask. 83 * @param stroke The key stroke (not needed if code given). 84 * @param code The key code (not needed if stroke given). 85 * @param command Extra parameter needed for some key binding types. 86 */ 87 void InsertBinding(KeyType key, const char *modifiers, const char *stroke, 88 const char *code, const char *command); 89 90 /** Run a command caused by a key binding. 91 * @param event The event causing the command to be run. 92 */ 93 void RunKeyCommand(const XKeyEvent *event); 94 95 /** Show a root menu caused by a key binding. 96 * @param event The event that caused the menu to be shown. 97 */ 98 void ShowKeyMenu(const XKeyEvent *event); 99 100 /** Validate key bindings. 101 * This will log an error if an invalid key binding is found. 102 * This is called after parsing the configuration file. 103 */ 104 void ValidateKeys(void); 105 106 #endif /* KEY_H */ 107