aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Keys.cc8
-rw-r--r--src/Keys.hh48
2 files changed, 43 insertions, 13 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index 00d6532..128ccf4 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.16 2002/05/02 07:10:03 fluxgen Exp $ 22//$Id: Keys.cc,v 1.17 2002/07/27 18:03:39 fluxgen Exp $
23 23
24#ifdef HAVE_CONFIG_H 24#ifdef HAVE_CONFIG_H
25#include "config.h" 25#include "config.h"
@@ -131,7 +131,7 @@ Keys::t_actionstr Keys::m_actionlist[] = {
131 {0, LASTKEYGRAB} 131 {0, LASTKEYGRAB}
132 }; 132 };
133 133
134Keys::Keys(Display *display, char *filename): 134Keys::Keys(Display *display, const char *filename):
135m_abortkey(0), 135m_abortkey(0),
136m_display(display) 136m_display(display)
137{ 137{
@@ -175,7 +175,7 @@ void Keys::ungrabKeys() {
175// Returns true on success else false 175// Returns true on success else false
176// TODO: error checking 176// TODO: error checking
177//------------------------------------ 177//------------------------------------
178bool Keys::load(char *filename) { 178bool Keys::load(const char *filename) {
179 if (!filename) 179 if (!filename)
180 return false; 180 return false;
181 181
@@ -501,7 +501,7 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) {
501// deletes the tree and load configuration 501// deletes the tree and load configuration
502// returns true on success else false 502// returns true on success else false
503//----------------------------------- 503//-----------------------------------
504bool Keys::reconfigure(char *filename) { 504bool Keys::reconfigure(const char *filename) {
505 deleteTree(); 505 deleteTree();
506 return load(filename); 506 return load(filename);
507} 507}
diff --git a/src/Keys.hh b/src/Keys.hh
index 7fbea6d..843f3a9 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.13 2002/06/29 10:44:50 fluxgen Exp $ 22// $Id: Keys.hh,v 1.14 2002/07/27 18:03:39 fluxgen Exp $
23 23
24#ifndef KEYS_HH 24#ifndef KEYS_HH
25#define KEYS_HH 25#define KEYS_HH
@@ -60,13 +60,37 @@ public:
60 LASTKEYGRAB //mark end of keygrabbs 60 LASTKEYGRAB //mark end of keygrabbs
61 }; 61 };
62 62
63 Keys(Display *display, char *filename=0); 63 Keys(Display *display, const char *filename=0);
64 /// destructor
64 ~Keys(); 65 ~Keys();
65 bool load(char *filename=0); 66 /**
67 Load configuration from file
68 @return true on success, else false
69 */
70 bool load(const char *filename=0);
71 /**
72 Determine action from XKeyEvent
73 @return KeyAction value
74 */
66 KeyAction getAction(XKeyEvent *ke); 75 KeyAction getAction(XKeyEvent *ke);
67 bool reconfigure(char *filename); 76 /**
77 Reload configuration from filename
78 @return true on success, else false
79 */
80 bool reconfigure(const char *filename);
81 /**
82 Get string value of the KeyAction enum value
83 @return string of action
84 */
68 const char *getActionStr(KeyAction action); 85 const char *getActionStr(KeyAction action);
69 std::string getExecCommand() { return m_execcmdstring; } 86 /**
87 Get command to execute (key action EXECUTE)
88 @return string to command
89 */
90 const std::string &getExecCommand() { return m_execcmdstring; }
91 /**
92 @return number of parameters
93 */
70 int getParam() const { return m_param; } 94 int getParam() const { return m_param; }
71 95
72private: 96private:
@@ -110,17 +134,23 @@ private:
110 std::string execcommand; 134 std::string execcommand;
111 int param; // parameter to comands 135 int param; // parameter to comands
112 }; 136 };
113 137 /**
138 merge two linked list
139 @return true on success, else false
140 */
114 bool mergeTree(t_key *newtree, t_key *basetree=0); 141 bool mergeTree(t_key *newtree, t_key *basetree=0);
115 #ifdef DEBUG 142#ifdef DEBUG
116 //debug functions 143 /// debug function
117 void showTree(); 144 void showTree();
145 /// debug function
118 void showKeyTree(t_key *key, unsigned int w=0); 146 void showKeyTree(t_key *key, unsigned int w=0);
119 #endif //DEBUG 147#endif //DEBUG
148
120 struct t_actionstr{ 149 struct t_actionstr{
121 const char *string; 150 const char *string;
122 KeyAction action; 151 KeyAction action;
123 }; 152 };
153
124 static t_actionstr m_actionlist[]; 154 static t_actionstr m_actionlist[];
125 155
126 std::vector<t_key *> m_keylist; 156 std::vector<t_key *> m_keylist;