added parameter to keyactions
fluxgen fluxgen
2 files changed,
43 insertions(+),
4 deletions(-)
M
src/Keys.cc
→
src/Keys.cc
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ {"Raise", RAISE},
{"Lower", LOWER}, {"Close", CLOSE}, {"AbortKeychain", ABORTKEYCHAIN}, + {"Workspace", WORKSPACE}, {"Workspace1", WORKSPACE1}, {"Workspace2", WORKSPACE2}, {"Workspace3", WORKSPACE3},@@ -269,10 +270,41 @@ break; //break out and read next line
} 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<char *>(StringUtil::strcasestr(linebuffer.get(), getActionStr(Keys::EXECUTE))+ + const_cast<char *> + (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 @@ break; //end for-loop
} 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 @@ action = k->action;
key = k->key; mod = k->mod; execcommand = k->execcommand; + param = k-> param; } Keys::t_key::~t_key() {
M
src/Keys.hh
→
src/Keys.hh
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ ICONIFY=0,
RAISE, LOWER, CLOSE, ABORTKEYCHAIN, + WORKSPACE, WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4, WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8, WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12,@@ -60,6 +61,7 @@ KeyAction getAction(XKeyEvent *ke);
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 @@ unsigned int key;
unsigned int mod; std::vector<t_key *> keylist; std::string execcommand; + int param; // parameter to comands }; bool mergeTree(t_key *newtree, t_key *basetree=0);@@ -117,6 +120,7 @@
std::vector<t_key *> 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; };