diff options
author | fluxgen <fluxgen> | 2001-12-29 10:32:04 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2001-12-29 10:32:04 (GMT) |
commit | c79fb75a3b9a2b8fa828d4eea517651d730a6eec (patch) | |
tree | 458d31dc69adaad67062b06e790cc8dc7965308e | |
parent | e0dce8166ca9406a50e908569bb294ce57a76b7f (diff) | |
download | fluxbox_paul-c79fb75a3b9a2b8fa828d4eea517651d730a6eec.zip fluxbox_paul-c79fb75a3b9a2b8fa828d4eea517651d730a6eec.tar.bz2 |
Changed keygrab constants to upper-case
-rw-r--r-- | src/Keys.cc | 129 | ||||
-rw-r--r-- | src/Keys.hh | 41 |
2 files changed, 88 insertions, 82 deletions
diff --git a/src/Keys.cc b/src/Keys.cc index fad11af..62404ef 100644 --- a/src/Keys.cc +++ b/src/Keys.cc | |||
@@ -24,6 +24,12 @@ | |||
24 | # include "config.h" | 24 | # include "config.h" |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include "Keys.hh" | ||
28 | |||
29 | #ifndef _FLUXBOX_HH_ | ||
30 | # include "fluxbox.hh" | ||
31 | #endif | ||
32 | |||
27 | #ifdef HAVE_STDIO_H | 33 | #ifdef HAVE_STDIO_H |
28 | # include <stdio.h> | 34 | # include <stdio.h> |
29 | #endif // HAVE_STDIO_H | 35 | #endif // HAVE_STDIO_H |
@@ -62,61 +68,58 @@ | |||
62 | #include <X11/Xproto.h> | 68 | #include <X11/Xproto.h> |
63 | #include <X11/keysym.h> | 69 | #include <X11/keysym.h> |
64 | 70 | ||
65 | #include "Keys.hh" | ||
66 | #include "fluxbox.hh" | ||
67 | |||
68 | #include <iostream> | 71 | #include <iostream> |
69 | #include <fstream> | 72 | #include <fstream> |
70 | 73 | ||
71 | using namespace std; | 74 | using namespace std; |
72 | 75 | ||
73 | Keys::t_actionstr Keys::m_actionlist[] = { | 76 | Keys::t_actionstr Keys::m_actionlist[] = { |
74 | {"Minimize", grabIconify}, | 77 | {"Minimize", ICONIFY}, |
75 | {"Raise", grabRaise}, | 78 | {"Raise", RAISE}, |
76 | {"Lower", grabLower}, | 79 | {"Lower", LOWER}, |
77 | {"Close", grabClose}, | 80 | {"Close", CLOSE}, |
78 | {"AbortKeychain", grabAbortKeychain}, | 81 | {"AbortKeychain", ABORTKEYCHAIN}, |
79 | {"Workspace1", grabWorkspace1}, | 82 | {"Workspace1", WORKSPACE1}, |
80 | {"Workspace2", grabWorkspace2}, | 83 | {"Workspace2", WORKSPACE2}, |
81 | {"Workspace3", grabWorkspace3}, | 84 | {"Workspace3", WORKSPACE3}, |
82 | {"Workspace4", grabWorkspace4}, | 85 | {"Workspace4", WORKSPACE4}, |
83 | {"Workspace5", grabWorkspace5}, | 86 | {"Workspace5", WORKSPACE5}, |
84 | {"Workspace6", grabWorkspace6}, | 87 | {"Workspace6", WORKSPACE6}, |
85 | {"Workspace7", grabWorkspace7}, | 88 | {"Workspace7", WORKSPACE7}, |
86 | {"Workspace8", grabWorkspace8}, | 89 | {"Workspace8", WORKSPACE8}, |
87 | {"Workspace9", grabWorkspace9}, | 90 | {"Workspace9", WORKSPACE9}, |
88 | {"Workspace10", grabWorkspace10}, | 91 | {"Workspace10", WORKSPACE10}, |
89 | {"Workspace11", grabWorkspace11}, | 92 | {"Workspace11", WORKSPACE11}, |
90 | {"Workspace12", grabWorkspace12}, | 93 | {"Workspace12", WORKSPACE12}, |
91 | {"NextWorkspace", grabNextWorkspace}, | 94 | {"NextWorkspace", NEXTWORKSPACE}, |
92 | {"PrevWorkspace", grabPrevWorkspace}, | 95 | {"PrevWorkspace", PREVWORKSPACE}, |
93 | {"LeftWorkspace", grabLeftWorkspace}, | 96 | {"LeftWorkspace", LEFTWORKSPACE}, |
94 | {"RightWorkspace", grabRightWorkspace}, | 97 | {"RightWorkspace", RIGHTWORKSPACE}, |
95 | {"KillWindow", grabKillWindow}, | 98 | {"KillWindow", KILLWINDOW}, |
96 | {"NextWindow", grabNextWindow}, | 99 | {"NextWindow", NEXTWINDOW}, |
97 | {"PrevWindow", grabPrevWindow}, | 100 | {"PrevWindow", PREVWINDOW}, |
98 | {"NextTab", grabNextTab}, | 101 | {"NextTab", NEXTTAB}, |
99 | {"PrevTab", grabPrevTab}, | 102 | {"PrevTab", PREVTAB}, |
100 | {"ShadeWindow", grabShade}, | 103 | {"ShadeWindow", SHADE}, |
101 | {"MaximizeWindow", grabMaximize}, | 104 | {"MaximizeWindow", MAXIMIZE}, |
102 | {"StickWindow", grabStick}, | 105 | {"StickWindow", STICK}, |
103 | {"ExecCommand", grabExecute}, | 106 | {"ExecCommand", EXECUTE}, |
104 | {"MaximizeVertical", grabVertMax}, | 107 | {"MaximizeVertical", VERTMAX}, |
105 | {"MaximizeHorizontal", grabHorizMax}, | 108 | {"MaximizeHorizontal", HORIZMAX}, |
106 | {"NudgeRight", grabNudgeRight}, | 109 | {"NudgeRight", NUDGERIGHT}, |
107 | {"NudgeLeft", grabNudgeLeft}, | 110 | {"NudgeLeft", NUDGELEFT}, |
108 | {"NudgeUp", grabNudgeUp}, | 111 | {"NudgeUp", NUDGEUP}, |
109 | {"NudgeDown", grabNudgeDown}, | 112 | {"NudgeDown", NUDGEDOWN}, |
110 | {"BigNudgeRight", grabBigNudgeRight}, | 113 | {"BigNudgeRight", BIGNUDGERIGHT}, |
111 | {"BigNudgeLeft", grabBigNudgeLeft}, | 114 | {"BigNudgeLeft", BIGNUDGELEFT}, |
112 | {"BigNudgeUp", grabBigNudgeUp}, | 115 | {"BigNudgeUp", BIGNUDGEUP}, |
113 | {"BigNudgeDown", grabBigNudgeDown}, | 116 | {"BigNudgeDown", BIGNUDGEDOWN}, |
114 | {"HorizontalIncrement", grabHorizInc}, | 117 | {"HorizontalIncrement", HORIZINC}, |
115 | {"VerticalIncrement", grabVertInc}, | 118 | {"VerticalIncrement", VERTINC}, |
116 | {"HorizontalDecrement", grabHorizDec}, | 119 | {"HorizontalDecrement", HORIZDEC}, |
117 | {"VerticalDecrement", grabVertDec}, | 120 | {"VerticalDecrement", VERTDEC}, |
118 | {"ToggleDecor", grabToggleDecor}, | 121 | {"ToggleDecor", TOGGLEDECOR}, |
119 | {0, lastKeygrab} | 122 | {0, LASTKEYGRAB} |
120 | }; | 123 | }; |
121 | 124 | ||
122 | Keys::Keys(char *filename) { | 125 | Keys::Keys(char *filename) { |
@@ -127,6 +130,7 @@ Keys::Keys(char *filename) { | |||
127 | Keys::~Keys() { | 130 | Keys::~Keys() { |
128 | deleteTree(); | 131 | deleteTree(); |
129 | } | 132 | } |
133 | |||
130 | //--------- deleteTree ----------- | 134 | //--------- deleteTree ----------- |
131 | // Destroys the keytree and m_abortkey | 135 | // Destroys the keytree and m_abortkey |
132 | //-------------------------------- | 136 | //-------------------------------- |
@@ -141,11 +145,12 @@ void Keys::deleteTree() { | |||
141 | m_abortkey=0; | 145 | m_abortkey=0; |
142 | } | 146 | } |
143 | } | 147 | } |
148 | |||
144 | //-------------- load ---------------- | 149 | //-------------- load ---------------- |
145 | // Load and grab keys | 150 | // Load and grab keys |
146 | // Returns true on success else false | 151 | // Returns true on success else false |
147 | // TODO: error checking and nls on them? | 152 | // TODO: error checking and (nls on them? ) |
148 | // and possible replacement of strtok | 153 | // possible replacement of strtok |
149 | //------------------------------------ | 154 | //------------------------------------ |
150 | bool Keys::load(char *filename) { | 155 | bool Keys::load(char *filename) { |
151 | if (!filename) | 156 | if (!filename) |
@@ -220,12 +225,12 @@ bool Keys::load(char *filename) { | |||
220 | 225 | ||
221 | unsigned int i=0; | 226 | unsigned int i=0; |
222 | 227 | ||
223 | for (i=0; i< lastKeygrab; i++) { | 228 | for (i=0; i< LASTKEYGRAB; i++) { |
224 | if (strcasecmp(m_actionlist[i].string, val) == 0) | 229 | if (strcasecmp(m_actionlist[i].string, val) == 0) |
225 | break; | 230 | break; |
226 | } | 231 | } |
227 | 232 | ||
228 | if (i < lastKeygrab ) { | 233 | if (i < LASTKEYGRAB ) { |
229 | if (!current_key) { | 234 | if (!current_key) { |
230 | cerr<<"Error on line: "<<line<<endl; | 235 | cerr<<"Error on line: "<<line<<endl; |
231 | cerr<<linebuffer<<endl; | 236 | cerr<<linebuffer<<endl; |
@@ -236,13 +241,13 @@ bool Keys::load(char *filename) { | |||
236 | } | 241 | } |
237 | 242 | ||
238 | //special case for grabAbortKeychain | 243 | //special case for grabAbortKeychain |
239 | if (m_actionlist[i].action == grabAbortKeychain) { | 244 | if (m_actionlist[i].action == ABORTKEYCHAIN) { |
240 | if (last_key!=current_key) | 245 | if (last_key!=current_key) |
241 | cerr<<"Keys: "<<m_actionlist[i].string<<" cant be in chained mode"<<endl; | 246 | cerr<<"Keys: "<<m_actionlist[i].string<<" cant be in chained mode"<<endl; |
242 | else if (m_abortkey) | 247 | else if (m_abortkey) |
243 | cerr<<"Keys: "<<m_actionlist[i].string<<" is already bound."<<endl; | 248 | cerr<<"Keys: "<<m_actionlist[i].string<<" is already bound."<<endl; |
244 | else | 249 | else |
245 | m_abortkey = new t_key(current_key->key, current_key->mod, grabAbortKeychain); | 250 | m_abortkey = new t_key(current_key->key, current_key->mod, ABORTKEYCHAIN); |
246 | 251 | ||
247 | delete current_key; | 252 | delete current_key; |
248 | current_key = 0; | 253 | current_key = 0; |
@@ -251,7 +256,7 @@ bool Keys::load(char *filename) { | |||
251 | } | 256 | } |
252 | 257 | ||
253 | last_key->action = m_actionlist[i].action; | 258 | last_key->action = m_actionlist[i].action; |
254 | if (last_key->action == grabExecute) | 259 | if (last_key->action == Keys::EXECUTE) |
255 | last_key->execcommand = &linebuffer[linepos]; | 260 | last_key->execcommand = &linebuffer[linepos]; |
256 | 261 | ||
257 | //add the keychain to list | 262 | //add the keychain to list |
@@ -259,7 +264,7 @@ bool Keys::load(char *filename) { | |||
259 | cerr<<"Keys: Faild to merge keytree!"<<endl; | 264 | cerr<<"Keys: Faild to merge keytree!"<<endl; |
260 | 265 | ||
261 | #ifdef DEBUG | 266 | #ifdef DEBUG |
262 | if (m_actionlist[i].action == Keys::grabExecute) { | 267 | if (m_actionlist[i].action == Keys::EXECUTE) { |
263 | 268 | ||
264 | cerr<<"linepos:"<<linepos<<endl; | 269 | cerr<<"linepos:"<<linepos<<endl; |
265 | cerr<<"buffer:"<<&linebuffer[linepos]<<endl; | 270 | cerr<<"buffer:"<<&linebuffer[linepos]<<endl; |
@@ -424,7 +429,7 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) { | |||
424 | next_key = m_keylist[i]; | 429 | next_key = m_keylist[i]; |
425 | break; //end for-loop | 430 | break; //end for-loop |
426 | } else { | 431 | } else { |
427 | if (m_keylist[i]->action == grabExecute) | 432 | if (m_keylist[i]->action == Keys::EXECUTE) |
428 | m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute | 433 | m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute |
429 | return m_keylist[i]->action; | 434 | return m_keylist[i]->action; |
430 | } | 435 | } |
@@ -438,21 +443,21 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) { | |||
438 | next_key = temp_key; | 443 | next_key = temp_key; |
439 | } else { | 444 | } else { |
440 | next_key = 0; | 445 | next_key = 0; |
441 | if (temp_key->action == grabExecute) | 446 | if (temp_key->action == Keys::EXECUTE) |
442 | m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute | 447 | m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute |
443 | return temp_key->action; | 448 | return temp_key->action; |
444 | } | 449 | } |
445 | } else { | 450 | } else { |
446 | temp_key = next_key; | 451 | temp_key = next_key; |
447 | next_key = 0; | 452 | next_key = 0; |
448 | if (temp_key->action == grabExecute) | 453 | if (temp_key->action == Keys::EXECUTE) |
449 | m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute | 454 | m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute |
450 | return temp_key->action; | 455 | return temp_key->action; |
451 | } | 456 | } |
452 | 457 | ||
453 | } | 458 | } |
454 | 459 | ||
455 | return lastKeygrab; | 460 | return Keys::LASTKEYGRAB; |
456 | } | 461 | } |
457 | 462 | ||
458 | //--------- reconfigure ------------- | 463 | //--------- reconfigure ------------- |
@@ -520,7 +525,7 @@ bool Keys::mergeTree(t_key *newtree, t_key *basetree) { | |||
520 | for (; baselist_i<m_keylist.size(); baselist_i++) { | 525 | for (; baselist_i<m_keylist.size(); baselist_i++) { |
521 | if (m_keylist[baselist_i]->mod == newtree->mod && | 526 | if (m_keylist[baselist_i]->mod == newtree->mod && |
522 | m_keylist[baselist_i]->key == newtree->key) { | 527 | m_keylist[baselist_i]->key == newtree->key) { |
523 | if (newtree->keylist.size() && m_keylist[baselist_i]->action == lastKeygrab) { | 528 | if (newtree->keylist.size() && m_keylist[baselist_i]->action == LASTKEYGRAB) { |
524 | //assumes the newtree only have one branch | 529 | //assumes the newtree only have one branch |
525 | return mergeTree(newtree->keylist[0], m_keylist[baselist_i]); | 530 | return mergeTree(newtree->keylist[0], m_keylist[baselist_i]); |
526 | } else | 531 | } else |
diff --git a/src/Keys.hh b/src/Keys.hh index 3b19aaa..8f32465 100644 --- a/src/Keys.hh +++ b/src/Keys.hh | |||
@@ -23,29 +23,30 @@ | |||
23 | 23 | ||
24 | #include <string> | 24 | #include <string> |
25 | #include <vector> | 25 | #include <vector> |
26 | 26 | #include <X11/Xlib.h> | |
27 | |||
27 | class Keys | 28 | class Keys |
28 | { | 29 | { |
29 | public: | 30 | public: |
30 | enum KeyAction{ | 31 | enum KeyAction{ |
31 | grabIconify=0, | 32 | ICONIFY=0, |
32 | grabRaise, | 33 | RAISE, |
33 | grabLower, | 34 | LOWER, |
34 | grabClose, | 35 | CLOSE, |
35 | grabAbortKeychain, | 36 | ABORTKEYCHAIN, |
36 | grabWorkspace1, grabWorkspace2, grabWorkspace3, grabWorkspace4, grabWorkspace5, | 37 | WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4, WORKSPACE5, |
37 | grabWorkspace6, grabWorkspace7, grabWorkspace8, grabWorkspace9, grabWorkspace10, | 38 | WORKSPACE6, WORKSPACE7, WORKSPACE8, WORKSPACE9, WORKSPACE10, |
38 | grabWorkspace11, grabWorkspace12, grabNextWorkspace, grabPrevWorkspace, | 39 | WORKSPACE11, WORKSPACE12, NEXTWORKSPACE, PREVWORKSPACE, |
39 | grabLeftWorkspace, grabRightWorkspace, | 40 | LEFTWORKSPACE, RIGHTWORKSPACE, |
40 | grabKillWindow, grabNextWindow, grabPrevWindow, | 41 | KILLWINDOW, NEXTWINDOW, PREVWINDOW, |
41 | grabNextTab, grabPrevTab, | 42 | NEXTTAB, PREVTAB, |
42 | grabShade, grabMaximize, grabStick, grabExecute, grabVertMax, | 43 | SHADE, MAXIMIZE, STICK, EXECUTE, VERTMAX, |
43 | grabHorizMax, grabNudgeRight, grabNudgeLeft,grabNudgeUp, | 44 | HORIZMAX, NUDGERIGHT, NUDGELEFT,NUDGEUP, |
44 | grabNudgeDown, grabBigNudgeRight, grabBigNudgeLeft, | 45 | NUDGEDOWN, BIGNUDGERIGHT, BIGNUDGELEFT, |
45 | grabBigNudgeUp, grabBigNudgeDown, | 46 | BIGNUDGEUP, BIGNUDGEDOWN, |
46 | grabHorizInc, grabVertInc, grabHorizDec, grabVertDec, | 47 | HORIZINC, VERTINC, HORIZDEC, VERTDEC, |
47 | grabToggleDecor, | 48 | TOGGLEDECOR, |
48 | lastKeygrab | 49 | LASTKEYGRAB |
49 | }; | 50 | }; |
50 | 51 | ||
51 | Keys(char *filename); | 52 | Keys(char *filename); |
@@ -66,7 +67,7 @@ private: | |||
66 | 67 | ||
67 | class t_key { | 68 | class t_key { |
68 | public: | 69 | public: |
69 | t_key(unsigned int key, unsigned int mod, KeyAction action_ = lastKeygrab); | 70 | t_key(unsigned int key, unsigned int mod, KeyAction action_ = Keys::LASTKEYGRAB); |
70 | t_key(t_key *k); | 71 | t_key(t_key *k); |
71 | ~t_key(); | 72 | ~t_key(); |
72 | 73 | ||