aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/KeyUtil.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc
index a24abad..f492fd2 100644
--- a/src/FbTk/KeyUtil.cc
+++ b/src/FbTk/KeyUtil.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: KeyUtil.cc,v 1.7 2004/02/10 18:55:12 fluxgen Exp $ 22// $Id: KeyUtil.cc,v 1.8 2004/09/01 00:08:14 akir Exp $
23 23
24#include "KeyUtil.hh" 24#include "KeyUtil.hh"
25#include "App.hh" 25#include "App.hh"
@@ -95,7 +95,6 @@ void KeyUtil::loadModmap() {
95} 95}
96 96
97 97
98
99/** 98/**
100 Grabs a key with the modifier 99 Grabs a key with the modifier
101 and with numlock,capslock and scrollock 100 and with numlock,capslock and scrollock
@@ -156,6 +155,7 @@ void KeyUtil::grabKey(unsigned int key, unsigned int mod) {
156/** 155/**
157 @return keycode of keystr on success else 0 156 @return keycode of keystr on success else 0
158*/ 157*/
158
159unsigned int KeyUtil::getKey(const char *keystr) { 159unsigned int KeyUtil::getKey(const char *keystr) {
160 if (!keystr) 160 if (!keystr)
161 return 0; 161 return 0;
@@ -163,19 +163,22 @@ unsigned int KeyUtil::getKey(const char *keystr) {
163 XStringToKeysym(keystr)); 163 XStringToKeysym(keystr));
164} 164}
165 165
166
167struct t_modlist{
168 char *str;
169 unsigned int mask;
170 bool operator == (const char *modstr) const {
171 return (strcasecmp(str, modstr) == 0 && mask !=0);
172 }
173};
174
166/** 175/**
167 @return the modifier for the modstr else zero on failure. 176 @return the modifier for the modstr else zero on failure.
168*/ 177*/
169unsigned int KeyUtil::getModifier(const char *modstr) { 178unsigned int KeyUtil::getModifier(const char *modstr) {
170 if (!modstr) 179 if (!modstr)
171 return 0; 180 return 0;
172 struct t_modlist{ 181 const static struct t_modlist modlist[] = {
173 char *str;
174 unsigned int mask;
175 bool operator == (const char *modstr) const {
176 return (strcasecmp(str, modstr) == 0 && mask !=0);
177 }
178 } modlist[] = {
179 {"SHIFT", ShiftMask}, 182 {"SHIFT", ShiftMask},
180 {"CONTROL", ControlMask}, 183 {"CONTROL", ControlMask},
181 {"MOD1", Mod1Mask}, 184 {"MOD1", Mod1Mask},