aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-02-20 23:10:48 (GMT)
committerfluxgen <fluxgen>2002-02-20 23:10:48 (GMT)
commit2903379c490116f86f1380c8c648cfb57f68e848 (patch)
tree2abf7822a6fc671f2ec49e826d274421e952bd88 /src
parentf7c88e4da3b7e8e39711a70fd27d0c464ce1bcde (diff)
downloadfluxbox-2903379c490116f86f1380c8c648cfb57f68e848.zip
fluxbox-2903379c490116f86f1380c8c648cfb57f68e848.tar.bz2
added parameter to keyactions
Diffstat (limited to 'src')
-rw-r--r--src/Keys.cc41
-rw-r--r--src/Keys.hh6
2 files changed, 43 insertions, 4 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index 54ae77a..079bdb6 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -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.cc,v 1.9 2002/01/21 01:48:47 fluxgen Exp $ 22//$Id: Keys.cc,v 1.10 2002/02/20 23:10:48 fluxgen Exp $
23 23
24#ifdef HAVE_CONFIG_H 24#ifdef HAVE_CONFIG_H
25# include "config.h" 25# include "config.h"
@@ -81,6 +81,7 @@ Keys::t_actionstr Keys::m_actionlist[] = {
81 {"Lower", LOWER}, 81 {"Lower", LOWER},
82 {"Close", CLOSE}, 82 {"Close", CLOSE},
83 {"AbortKeychain", ABORTKEYCHAIN}, 83 {"AbortKeychain", ABORTKEYCHAIN},
84 {"Workspace", WORKSPACE},
84 {"Workspace1", WORKSPACE1}, 85 {"Workspace1", WORKSPACE1},
85 {"Workspace2", WORKSPACE2}, 86 {"Workspace2", WORKSPACE2},
86 {"Workspace3", WORKSPACE3}, 87 {"Workspace3", WORKSPACE3},
@@ -269,10 +270,41 @@ bool Keys::load(char *filename) {
269 } 270 }
270 271
271 last_key->action = m_actionlist[i].action; 272 last_key->action = m_actionlist[i].action;
272 if (last_key->action == Keys::EXECUTE) 273 switch(last_key->action) {
274 case Keys::EXECUTE:
273 last_key->execcommand = 275 last_key->execcommand =
274 const_cast<char *>(StringUtil::strcasestr(linebuffer.get(), getActionStr(Keys::EXECUTE))+ 276 const_cast<char *>
277 (StringUtil::strcasestr(linebuffer.get(),
278 getActionStr(Keys::EXECUTE))+
275 strlen(getActionStr(Keys::EXECUTE))); 279 strlen(getActionStr(Keys::EXECUTE)));
280 break;
281 case WORKSPACE:
282 if (argc + 1 < val.size())
283 last_key->param = atoi( val[argc+1].c_str());
284 else
285 last_key->param = 0;
286 break;
287 case LEFTWORKSPACE:
288 case RIGHTWORKSPACE:
289 case NEXTWORKSPACE:
290 case PREVWORKSPACE:
291 if (argc + 1 < val.size())
292 last_key->param = atoi( val[argc+1].c_str());
293 else
294 last_key->param = 1;
295 break;
296 case NUDGERIGHT:
297 case NUDGELEFT:
298 case NUDGEUP:
299 case NUDGEDOWN:
300 if (argc + 1 < val.size())
301 last_key->param = atoi( val[argc+1].c_str());
302 else
303 last_key->param = 2;
304 break;
305 default:
306 break;
307 }
276 308
277 //add the keychain to list 309 //add the keychain to list
278 if (!mergeTree(current_key)) 310 if (!mergeTree(current_key))
@@ -421,6 +453,7 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) {
421 } else { 453 } else {
422 if (m_keylist[i]->action == Keys::EXECUTE) 454 if (m_keylist[i]->action == Keys::EXECUTE)
423 m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute 455 m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute
456 m_param = m_keylist[i]->param;
424 return m_keylist[i]->action; 457 return m_keylist[i]->action;
425 } 458 }
426 } 459 }
@@ -560,6 +593,7 @@ Keys::t_key::t_key(unsigned int key_, unsigned int mod_, KeyAction action_) {
560 action = action_; 593 action = action_;
561 key = key_; 594 key = key_;
562 mod = mod_; 595 mod = mod_;
596 param = 0;
563} 597}
564 598
565Keys::t_key::t_key(t_key *k) { 599Keys::t_key::t_key(t_key *k) {
@@ -567,6 +601,7 @@ Keys::t_key::t_key(t_key *k) {
567 key = k->key; 601 key = k->key;
568 mod = k->mod; 602 mod = k->mod;
569 execcommand = k->execcommand; 603 execcommand = k->execcommand;
604 param = k-> param;
570} 605}
571 606
572Keys::t_key::~t_key() { 607Keys::t_key::~t_key() {
diff --git a/src/Keys.hh b/src/Keys.hh
index 143715b..8c018bb 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.6 2002/02/17 18:57:47 fluxgen Exp $ 22// $Id: Keys.hh,v 1.7 2002/02/20 23:10:48 fluxgen Exp $
23 23
24#ifndef KEYS_HH 24#ifndef KEYS_HH
25#define KEYS_HH 25#define KEYS_HH
@@ -36,6 +36,7 @@ enum KeyAction{
36 RAISE, LOWER, 36 RAISE, LOWER,
37 CLOSE, 37 CLOSE,
38 ABORTKEYCHAIN, 38 ABORTKEYCHAIN,
39 WORKSPACE,
39 WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4, 40 WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4,
40 WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8, 41 WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8,
41 WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12, 42 WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12,
@@ -60,6 +61,7 @@ enum KeyAction{
60 bool reconfigure(char *filename); 61 bool reconfigure(char *filename);
61 const char *getActionStr(KeyAction action); 62 const char *getActionStr(KeyAction action);
62 std::string getExecCommand() { return m_execcmdstring; } 63 std::string getExecCommand() { return m_execcmdstring; }
64 int getParam() const { return m_param; }
63 65
64private: 66private:
65 void deleteTree(); 67 void deleteTree();
@@ -100,6 +102,7 @@ private:
100 unsigned int mod; 102 unsigned int mod;
101 std::vector<t_key *> keylist; 103 std::vector<t_key *> keylist;
102 std::string execcommand; 104 std::string execcommand;
105 int param; // parameter to comands
103 }; 106 };
104 107
105 bool mergeTree(t_key *newtree, t_key *basetree=0); 108 bool mergeTree(t_key *newtree, t_key *basetree=0);
@@ -117,6 +120,7 @@ private:
117 std::vector<t_key *> m_keylist; 120 std::vector<t_key *> m_keylist;
118 t_key *m_abortkey; //abortkey for keygrabbing chain 121 t_key *m_abortkey; //abortkey for keygrabbing chain
119 std::string m_execcmdstring; //copy of the execcommandstring 122 std::string m_execcmdstring; //copy of the execcommandstring
123 int m_param; // copy of the param argument
120 Display *m_display; 124 Display *m_display;
121}; 125};
122 126