From 2903379c490116f86f1380c8c648cfb57f68e848 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 20 Feb 2002 23:10:48 +0000 Subject: added parameter to keyactions --- src/Keys.cc | 41 ++++++++++++++++++++++++++++++++++++++--- src/Keys.hh | 6 +++++- 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Keys.cc,v 1.9 2002/01/21 01:48:47 fluxgen Exp $ +//$Id: Keys.cc,v 1.10 2002/02/20 23:10:48 fluxgen Exp $ #ifdef HAVE_CONFIG_H # include "config.h" @@ -81,6 +81,7 @@ Keys::t_actionstr Keys::m_actionlist[] = { {"Lower", LOWER}, {"Close", CLOSE}, {"AbortKeychain", ABORTKEYCHAIN}, + {"Workspace", WORKSPACE}, {"Workspace1", WORKSPACE1}, {"Workspace2", WORKSPACE2}, {"Workspace3", WORKSPACE3}, @@ -269,10 +270,41 @@ bool Keys::load(char *filename) { } last_key->action = m_actionlist[i].action; - if (last_key->action == Keys::EXECUTE) + switch(last_key->action) { + case Keys::EXECUTE: last_key->execcommand = - const_cast(StringUtil::strcasestr(linebuffer.get(), getActionStr(Keys::EXECUTE))+ + const_cast + (StringUtil::strcasestr(linebuffer.get(), + getActionStr(Keys::EXECUTE))+ strlen(getActionStr(Keys::EXECUTE))); + break; + case WORKSPACE: + if (argc + 1 < val.size()) + last_key->param = atoi( val[argc+1].c_str()); + else + last_key->param = 0; + break; + case LEFTWORKSPACE: + case RIGHTWORKSPACE: + case NEXTWORKSPACE: + case PREVWORKSPACE: + if (argc + 1 < val.size()) + last_key->param = atoi( val[argc+1].c_str()); + else + last_key->param = 1; + break; + case NUDGERIGHT: + case NUDGELEFT: + case NUDGEUP: + case NUDGEDOWN: + if (argc + 1 < val.size()) + last_key->param = atoi( val[argc+1].c_str()); + else + last_key->param = 2; + break; + default: + break; + } //add the keychain to list if (!mergeTree(current_key)) @@ -421,6 +453,7 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) { } else { if (m_keylist[i]->action == Keys::EXECUTE) m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute + m_param = m_keylist[i]->param; return m_keylist[i]->action; } } @@ -560,6 +593,7 @@ Keys::t_key::t_key(unsigned int key_, unsigned int mod_, KeyAction action_) { action = action_; key = key_; mod = mod_; + param = 0; } Keys::t_key::t_key(t_key *k) { @@ -567,6 +601,7 @@ Keys::t_key::t_key(t_key *k) { key = k->key; mod = k->mod; execcommand = k->execcommand; + param = k-> param; } Keys::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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Keys.hh,v 1.6 2002/02/17 18:57:47 fluxgen Exp $ +// $Id: Keys.hh,v 1.7 2002/02/20 23:10:48 fluxgen Exp $ #ifndef KEYS_HH #define KEYS_HH @@ -36,6 +36,7 @@ enum KeyAction{ RAISE, LOWER, CLOSE, ABORTKEYCHAIN, + WORKSPACE, WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4, WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8, WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12, @@ -60,6 +61,7 @@ enum KeyAction{ bool reconfigure(char *filename); const char *getActionStr(KeyAction action); std::string getExecCommand() { return m_execcmdstring; } + int getParam() const { return m_param; } private: void deleteTree(); @@ -100,6 +102,7 @@ private: unsigned int mod; std::vector keylist; std::string execcommand; + int param; // parameter to comands }; bool mergeTree(t_key *newtree, t_key *basetree=0); @@ -117,6 +120,7 @@ private: std::vector m_keylist; t_key *m_abortkey; //abortkey for keygrabbing chain std::string m_execcmdstring; //copy of the execcommandstring + int m_param; // copy of the param argument Display *m_display; }; -- cgit v0.11.2