added parameter to keyactions
This commit is contained in:
parent
f7c88e4da3
commit
2903379c49
2 changed files with 43 additions and 4 deletions
41
src/Keys.cc
41
src/Keys.cc
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
@ -81,6 +81,7 @@ Keys::t_actionstr Keys::m_actionlist[] = {
|
||||||
{"Lower", LOWER},
|
{"Lower", LOWER},
|
||||||
{"Close", CLOSE},
|
{"Close", CLOSE},
|
||||||
{"AbortKeychain", ABORTKEYCHAIN},
|
{"AbortKeychain", ABORTKEYCHAIN},
|
||||||
|
{"Workspace", WORKSPACE},
|
||||||
{"Workspace1", WORKSPACE1},
|
{"Workspace1", WORKSPACE1},
|
||||||
{"Workspace2", WORKSPACE2},
|
{"Workspace2", WORKSPACE2},
|
||||||
{"Workspace3", WORKSPACE3},
|
{"Workspace3", WORKSPACE3},
|
||||||
|
@ -269,10 +270,41 @@ bool Keys::load(char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
last_key->action = m_actionlist[i].action;
|
last_key->action = m_actionlist[i].action;
|
||||||
if (last_key->action == Keys::EXECUTE)
|
switch(last_key->action) {
|
||||||
|
case Keys::EXECUTE:
|
||||||
last_key->execcommand =
|
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)));
|
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
|
//add the keychain to list
|
||||||
if (!mergeTree(current_key))
|
if (!mergeTree(current_key))
|
||||||
|
@ -421,6 +453,7 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) {
|
||||||
} else {
|
} else {
|
||||||
if (m_keylist[i]->action == Keys::EXECUTE)
|
if (m_keylist[i]->action == Keys::EXECUTE)
|
||||||
m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute
|
m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute
|
||||||
|
m_param = m_keylist[i]->param;
|
||||||
return m_keylist[i]->action;
|
return m_keylist[i]->action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,6 +593,7 @@ Keys::t_key::t_key(unsigned int key_, unsigned int mod_, KeyAction action_) {
|
||||||
action = action_;
|
action = action_;
|
||||||
key = key_;
|
key = key_;
|
||||||
mod = mod_;
|
mod = mod_;
|
||||||
|
param = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys::t_key::t_key(t_key *k) {
|
Keys::t_key::t_key(t_key *k) {
|
||||||
|
@ -567,6 +601,7 @@ Keys::t_key::t_key(t_key *k) {
|
||||||
key = k->key;
|
key = k->key;
|
||||||
mod = k->mod;
|
mod = k->mod;
|
||||||
execcommand = k->execcommand;
|
execcommand = k->execcommand;
|
||||||
|
param = k-> param;
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys::t_key::~t_key() {
|
Keys::t_key::~t_key() {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef KEYS_HH
|
||||||
#define KEYS_HH
|
#define KEYS_HH
|
||||||
|
@ -36,6 +36,7 @@ enum KeyAction{
|
||||||
RAISE, LOWER,
|
RAISE, LOWER,
|
||||||
CLOSE,
|
CLOSE,
|
||||||
ABORTKEYCHAIN,
|
ABORTKEYCHAIN,
|
||||||
|
WORKSPACE,
|
||||||
WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4,
|
WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4,
|
||||||
WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8,
|
WORKSPACE5, WORKSPACE6, WORKSPACE7, WORKSPACE8,
|
||||||
WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12,
|
WORKSPACE9, WORKSPACE10, WORKSPACE11, WORKSPACE12,
|
||||||
|
@ -60,6 +61,7 @@ enum KeyAction{
|
||||||
bool reconfigure(char *filename);
|
bool reconfigure(char *filename);
|
||||||
const char *getActionStr(KeyAction action);
|
const char *getActionStr(KeyAction action);
|
||||||
std::string getExecCommand() { return m_execcmdstring; }
|
std::string getExecCommand() { return m_execcmdstring; }
|
||||||
|
int getParam() const { return m_param; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void deleteTree();
|
void deleteTree();
|
||||||
|
@ -100,6 +102,7 @@ private:
|
||||||
unsigned int mod;
|
unsigned int mod;
|
||||||
std::vector<t_key *> keylist;
|
std::vector<t_key *> keylist;
|
||||||
std::string execcommand;
|
std::string execcommand;
|
||||||
|
int param; // parameter to comands
|
||||||
};
|
};
|
||||||
|
|
||||||
bool mergeTree(t_key *newtree, t_key *basetree=0);
|
bool mergeTree(t_key *newtree, t_key *basetree=0);
|
||||||
|
@ -117,6 +120,7 @@ private:
|
||||||
std::vector<t_key *> m_keylist;
|
std::vector<t_key *> m_keylist;
|
||||||
t_key *m_abortkey; //abortkey for keygrabbing chain
|
t_key *m_abortkey; //abortkey for keygrabbing chain
|
||||||
std::string m_execcmdstring; //copy of the execcommandstring
|
std::string m_execcmdstring; //copy of the execcommandstring
|
||||||
|
int m_param; // copy of the param argument
|
||||||
Display *m_display;
|
Display *m_display;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue