diff options
author | rathnor <rathnor> | 2002-12-01 13:42:15 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2002-12-01 13:42:15 (GMT) |
commit | 28b5c604490094e187494dcc566bd3d7a05a2c25 (patch) | |
tree | 8f78f5714a5cd055c10b067a2656fe7b2338e71a /src/Keys.hh | |
parent | b9134162f9633784d9097df18769a699a62650fe (diff) | |
download | fluxbox-28b5c604490094e187494dcc566bd3d7a05a2c25.zip fluxbox-28b5c604490094e187494dcc566bd3d7a05a2c25.tar.bz2 |
Indenting from tabs to emacs 4-space
Diffstat (limited to 'src/Keys.hh')
-rw-r--r-- | src/Keys.hh | 274 |
1 files changed, 137 insertions, 137 deletions
diff --git a/src/Keys.hh b/src/Keys.hh index 20080d7..91a774e 100644 --- a/src/Keys.hh +++ b/src/Keys.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: Keys.hh,v 1.17 2002/11/27 22:07:42 fluxgen Exp $ | 22 | // $Id: Keys.hh,v 1.18 2002/12/01 13:41:57 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef KEYS_HH | 24 | #ifndef KEYS_HH |
25 | #define KEYS_HH | 25 | #define KEYS_HH |
@@ -31,157 +31,157 @@ | |||
31 | class Keys | 31 | class Keys |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | /** | 34 | /** |
35 | Key actions | 35 | Key actions |
36 | */ | 36 | */ |
37 | enum KeyAction{ | 37 | enum KeyAction{ |
38 | ICONIFY=0, | 38 | ICONIFY=0, |
39 | RAISE, LOWER, | 39 | RAISE, LOWER, |
40 | CLOSE, | 40 | CLOSE, |
41 | ABORTKEYCHAIN, | 41 | ABORTKEYCHAIN, |
42 | WORKSPACE, | 42 | WORKSPACE, |
43 | WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4, | 43 | WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4, |
44 | WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8, | 44 | WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8, |
45 | WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12, | 45 | WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12, |
46 | SENDTOWORKSPACE, // Send window to a workspace | 46 | SENDTOWORKSPACE, // Send window to a workspace |
47 | NEXTWORKSPACE, PREVWORKSPACE, | 47 | NEXTWORKSPACE, PREVWORKSPACE, |
48 | LEFTWORKSPACE, RIGHTWORKSPACE, | 48 | LEFTWORKSPACE, RIGHTWORKSPACE, |
49 | KILLWINDOW, NEXTWINDOW, PREVWINDOW, | 49 | KILLWINDOW, NEXTWINDOW, PREVWINDOW, |
50 | NEXTTAB, PREVTAB, FIRSTTAB, LASTTAB, MOVETABPREV, MOVETABNEXT, | 50 | NEXTTAB, PREVTAB, FIRSTTAB, LASTTAB, MOVETABPREV, MOVETABNEXT, |
51 | SHADE, MAXIMIZE, | 51 | SHADE, MAXIMIZE, |
52 | STICK, // Make Sticky | 52 | STICK, // Make Sticky |
53 | EXECUTE, // Run command | 53 | EXECUTE, // Run command |
54 | VERTMAX, // Maximize vertical | 54 | VERTMAX, // Maximize vertical |
55 | HORIZMAX, // Maximize horizontal | 55 | HORIZMAX, // Maximize horizontal |
56 | NUDGERIGHT, NUDGELEFT,NUDGEUP, NUDGEDOWN, | 56 | NUDGERIGHT, NUDGELEFT,NUDGEUP, NUDGEDOWN, |
57 | BIGNUDGERIGHT, BIGNUDGELEFT, BIGNUDGEUP, BIGNUDGEDOWN, | 57 | BIGNUDGERIGHT, BIGNUDGELEFT, BIGNUDGEUP, BIGNUDGEDOWN, |
58 | HORIZINC, VERTINC, HORIZDEC, VERTDEC, | 58 | HORIZINC, VERTINC, HORIZDEC, VERTDEC, |
59 | TOGGLEDECOR,// toggle visibility of decor (title, frame, handles) | 59 | TOGGLEDECOR,// toggle visibility of decor (title, frame, handles) |
60 | TOGGLETAB, // toggle visibilty of tab | 60 | TOGGLETAB, // toggle visibilty of tab |
61 | ROOTMENU, // pop up rootmenu | 61 | ROOTMENU, // pop up rootmenu |
62 | LASTKEYGRAB //mark end of keygrabbs | 62 | LASTKEYGRAB //mark end of keygrabbs |
63 | }; | 63 | }; |
64 | /** | 64 | /** |
65 | Constructor | 65 | Constructor |
66 | @param display display connection | 66 | @param display display connection |
67 | @param filename file to load, default none | 67 | @param filename file to load, default none |
68 | */ | 68 | */ |
69 | Keys(Display *display, const char *filename=0); | 69 | Keys(Display *display, const char *filename=0); |
70 | /// destructor | 70 | /// destructor |
71 | ~Keys(); | 71 | ~Keys(); |
72 | /** | 72 | /** |
73 | Load configuration from file | 73 | Load configuration from file |
74 | @return true on success, else false | 74 | @return true on success, else false |
75 | */ | 75 | */ |
76 | bool load(const char *filename=0); | 76 | bool load(const char *filename=0); |
77 | /** | 77 | /** |
78 | Determine action from XKeyEvent | 78 | Determine action from XKeyEvent |
79 | @return KeyAction value | 79 | @return KeyAction value |
80 | */ | 80 | */ |
81 | KeyAction getAction(XKeyEvent *ke); | 81 | KeyAction getAction(XKeyEvent *ke); |
82 | /** | 82 | /** |
83 | Reload configuration from filename | 83 | Reload configuration from filename |
84 | @return true on success, else false | 84 | @return true on success, else false |
85 | */ | 85 | */ |
86 | bool reconfigure(const char *filename); | 86 | bool reconfigure(const char *filename); |
87 | /** | 87 | /** |
88 | Get string value of the KeyAction enum value | 88 | Get string value of the KeyAction enum value |
89 | @return string of action | 89 | @return string of action |
90 | */ | 90 | */ |
91 | const char *getActionStr(KeyAction action); | 91 | const char *getActionStr(KeyAction action); |
92 | /** | 92 | /** |
93 | Get command to execute (key action EXECUTE) | 93 | Get command to execute (key action EXECUTE) |
94 | @return string to command | 94 | @return string to command |
95 | */ | 95 | */ |
96 | const std::string &getExecCommand() { return m_execcmdstring; } | 96 | const std::string &getExecCommand() { return m_execcmdstring; } |
97 | /** | 97 | /** |
98 | @return number of parameters | 98 | @return number of parameters |
99 | */ | 99 | */ |
100 | int getParam() const { return m_param; } | 100 | int getParam() const { return m_param; } |
101 | 101 | ||
102 | private: | 102 | private: |
103 | void deleteTree(); | 103 | void deleteTree(); |
104 | void ungrabKeys(); | 104 | void ungrabKeys(); |
105 | void bindKey(unsigned int key, unsigned int mod); | 105 | void bindKey(unsigned int key, unsigned int mod); |
106 | /** | 106 | /** |
107 | @param modstr modifier string (i.e Mod4, Mod5) | 107 | @param modstr modifier string (i.e Mod4, Mod5) |
108 | @return modifier number that match modstr | 108 | @return modifier number that match modstr |
109 | */ | 109 | */ |
110 | unsigned int getModifier(const char *modstr); | 110 | unsigned int getModifier(const char *modstr); |
111 | /** | 111 | /** |
112 | @param keystr a key string (i.e F1, Enter) | 112 | @param keystr a key string (i.e F1, Enter) |
113 | @return key number that match keystr | 113 | @return key number that match keystr |
114 | */ | 114 | */ |
115 | unsigned int getKey(const char *keystr); | 115 | unsigned int getKey(const char *keystr); |
116 | /** | 116 | /** |
117 | grab a key | 117 | grab a key |
118 | @param key the key | 118 | @param key the key |
119 | @param mod the modifier | 119 | @param mod the modifier |
120 | */ | 120 | */ |
121 | void grabKey(unsigned int key, unsigned int mod); | 121 | void grabKey(unsigned int key, unsigned int mod); |
122 | std::string filename; | 122 | std::string filename; |
123 | 123 | ||
124 | class t_key { | 124 | class t_key { |
125 | public: | 125 | public: |
126 | t_key(unsigned int key, unsigned int mod, KeyAction action_ = Keys::LASTKEYGRAB); | 126 | t_key(unsigned int key, unsigned int mod, KeyAction action_ = Keys::LASTKEYGRAB); |
127 | t_key(t_key *k); | 127 | t_key(t_key *k); |
128 | ~t_key(); | 128 | ~t_key(); |
129 | 129 | ||
130 | inline t_key *find(unsigned int key_, unsigned int mod_) { | 130 | inline t_key *find(unsigned int key_, unsigned int mod_) { |
131 | for (unsigned int i=0; i<keylist.size(); i++) { | 131 | for (unsigned int i=0; i<keylist.size(); i++) { |
132 | if (keylist[i]->key == key_ && keylist[i]->mod == mod_) | 132 | if (keylist[i]->key == key_ && keylist[i]->mod == mod_) |
133 | return keylist[i]; | 133 | return keylist[i]; |
134 | } | 134 | } |
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | inline t_key *find(XKeyEvent *ke) { | 137 | inline t_key *find(XKeyEvent *ke) { |
138 | for (unsigned int i=0; i<keylist.size(); i++) { | 138 | for (unsigned int i=0; i<keylist.size(); i++) { |
139 | if (keylist[i]->key == ke->keycode && keylist[i]->mod == ke->state) | 139 | if (keylist[i]->key == ke->keycode && keylist[i]->mod == ke->state) |
140 | return keylist[i]; | 140 | return keylist[i]; |
141 | } | 141 | } |
142 | return 0; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
145 | inline bool operator == (XKeyEvent *ke) { | 145 | inline bool operator == (XKeyEvent *ke) { |
146 | return (mod == ke->state && key == ke->keycode); | 146 | return (mod == ke->state && key == ke->keycode); |
147 | } | 147 | } |
148 | 148 | ||
149 | KeyAction action; | 149 | KeyAction action; |
150 | unsigned int key; | 150 | unsigned int key; |
151 | unsigned int mod; | 151 | unsigned int mod; |
152 | std::vector<t_key *> keylist; | 152 | std::vector<t_key *> keylist; |
153 | std::string execcommand; | 153 | std::string execcommand; |
154 | int param; // parameter to comands | 154 | int param; // parameter to comands |
155 | }; | 155 | }; |
156 | /** | 156 | /** |
157 | merge two linked list | 157 | merge two linked list |
158 | @return true on success, else false | 158 | @return true on success, else false |
159 | */ | 159 | */ |
160 | bool mergeTree(t_key *newtree, t_key *basetree=0); | 160 | bool mergeTree(t_key *newtree, t_key *basetree=0); |
161 | 161 | ||
162 | #ifdef DEBUG | 162 | #ifdef DEBUG |
163 | /// debug function | 163 | /// debug function |
164 | void showTree(); | 164 | void showTree(); |
165 | /// debug function | 165 | /// debug function |
166 | void showKeyTree(t_key *key, unsigned int w=0); | 166 | void showKeyTree(t_key *key, unsigned int w=0); |
167 | #endif //DEBUG | 167 | #endif //DEBUG |
168 | /// determine key modifier maps for caps-, num- and scrolllock | 168 | /// determine key modifier maps for caps-, num- and scrolllock |
169 | void determineModmap(); | 169 | void determineModmap(); |
170 | 170 | ||
171 | struct t_actionstr{ | 171 | struct t_actionstr{ |
172 | const char *string; | 172 | const char *string; |
173 | KeyAction action; | 173 | KeyAction action; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | int m_capslock_mod, m_numlock_mod, m_scrolllock_mod; ///< modifiers | 176 | int m_capslock_mod, m_numlock_mod, m_scrolllock_mod; ///< modifiers |
177 | 177 | ||
178 | static t_actionstr m_actionlist[]; | 178 | static t_actionstr m_actionlist[]; |
179 | 179 | ||
180 | std::vector<t_key *> m_keylist; | 180 | std::vector<t_key *> m_keylist; |
181 | t_key *m_abortkey; ///< abortkey for keygrabbing chain | 181 | t_key *m_abortkey; ///< abortkey for keygrabbing chain |
182 | std::string m_execcmdstring; ///< copy of the execcommandstring | 182 | std::string m_execcmdstring; ///< copy of the execcommandstring |
183 | int m_param; ///< copy of the param argument | 183 | int m_param; ///< copy of the param argument |
184 | Display *m_display; ///< display connection | 184 | Display *m_display; ///< display connection |
185 | }; | 185 | }; |
186 | 186 | ||
187 | #endif // _KEYS_HH_ | 187 | #endif // _KEYS_HH_ |