aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2009-12-18 07:05:07 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2009-12-18 07:05:07 (GMT)
commit46261a8284730a16d664fa89423fc5728ed284b4 (patch)
treec81d7962fe924f5bfca44dc0254304cb537544b9 /src/FbTk
parent79859c94482e4602eb22c35b988027ab199734a6 (diff)
downloadfluxbox_paul-46261a8284730a16d664fa89423fc5728ed284b4.zip
fluxbox_paul-46261a8284730a16d664fa89423fc5728ed284b4.tar.bz2
implemented 'MoveN' and 'ClickN' support in keys file.
the hardcoded 'OnTitlebar Mouse1 :Raise' (see Window.cc, FluxboxWindow::buttonPressEvent()) is disabled for now, should be added to fluxbox-update_configs
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/KeyUtil.cc56
1 files changed, 31 insertions, 25 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc
index 0578b9c..6ffe2a2 100644
--- a/src/FbTk/KeyUtil.cc
+++ b/src/FbTk/KeyUtil.cc
@@ -42,16 +42,16 @@ struct t_modlist{
42}; 42};
43 43
44const struct t_modlist modlist[] = { 44const struct t_modlist modlist[] = {
45 {"SHIFT", ShiftMask}, 45 {"shift", ShiftMask},
46 {"LOCK", LockMask}, 46 {"lock", LockMask},
47 {"CONTROL", ControlMask}, 47 {"control", ControlMask},
48 {"MOD1", Mod1Mask}, 48 {"mod1", Mod1Mask},
49 {"MOD2", Mod2Mask}, 49 {"mod2", Mod2Mask},
50 {"MOD3", Mod3Mask}, 50 {"mod3", Mod3Mask},
51 {"MOD4", Mod4Mask}, 51 {"mod4", Mod4Mask},
52 {"MOD5", Mod5Mask}, 52 {"mod5", Mod5Mask},
53 {"ALT", Mod1Mask}, 53 {"alt", Mod1Mask},
54 {"CTRL", ControlMask}, 54 {"ctrl", ControlMask},
55 {0, 0} 55 {0, 0}
56}; 56};
57 57
@@ -88,7 +88,7 @@ void KeyUtil::loadModmap() {
88 XFreeModifiermap(m_modmap); 88 XFreeModifiermap(m_modmap);
89 89
90 m_modmap = XGetModifierMapping(App::instance()->display()); 90 m_modmap = XGetModifierMapping(App::instance()->display());
91 91
92 // find modifiers and set them 92 // find modifiers and set them
93 for (int i=0, realkey=0; i<8; ++i) { 93 for (int i=0, realkey=0; i<8; ++i) {
94 for (int key=0; key<m_modmap->max_keypermod; ++key, ++realkey) { 94 for (int key=0; key<m_modmap->max_keypermod; ++key, ++realkey) {
@@ -96,7 +96,7 @@ void KeyUtil::loadModmap() {
96 if (m_modmap->modifiermap[realkey] == 0) 96 if (m_modmap->modifiermap[realkey] == 0)
97 continue; 97 continue;
98 98
99 KeySym ks = XKeycodeToKeysym(App::instance()->display(), 99 KeySym ks = XKeycodeToKeysym(App::instance()->display(),
100 m_modmap->modifiermap[realkey], 0); 100 m_modmap->modifiermap[realkey], 0);
101 101
102 switch (ks) { 102 switch (ks) {
@@ -154,12 +154,18 @@ void KeyUtil::grabButton(unsigned int button, unsigned int mod, Window win,
154*/ 154*/
155 155
156unsigned int KeyUtil::getKey(const char *keystr) { 156unsigned int KeyUtil::getKey(const char *keystr) {
157 if (!keystr) 157
158 return 0; 158 KeyCode code = 0;
159 KeySym sym = XStringToKeysym(keystr); 159
160 if (sym==NoSymbol) 160 if (keystr) {
161 return 0; 161
162 return XKeysymToKeycode(App::instance()->display(), sym); 162 KeySym sym = XStringToKeysym(keystr);
163 if (sym != NoSymbol) {
164 code = XKeysymToKeycode(App::instance()->display(), sym);
165 }
166 }
167
168 return code;
163} 169}
164 170
165 171
@@ -169,14 +175,14 @@ unsigned int KeyUtil::getKey(const char *keystr) {
169unsigned int KeyUtil::getModifier(const char *modstr) { 175unsigned int KeyUtil::getModifier(const char *modstr) {
170 if (!modstr) 176 if (!modstr)
171 return 0; 177 return 0;
172 178
173 // find mod mask string 179 // find mod mask string
174 for (unsigned int i=0; modlist[i].str !=0; i++) { 180 for (unsigned int i=0; modlist[i].str !=0; i++) {
175 if (modlist[i] == modstr) 181 if (modlist[i] == modstr)
176 return modlist[i].mask; 182 return modlist[i].mask;
177 } 183 }
178 184
179 return 0; 185 return 0;
180} 186}
181 187
182/// Ungrabs the keys 188/// Ungrabs the keys
@@ -193,7 +199,7 @@ void KeyUtil::ungrabButtons(Window win) {
193unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) { 199unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) {
194 XModifierKeymap *modmap = instance().m_modmap; 200 XModifierKeymap *modmap = instance().m_modmap;
195 201
196 if (!modmap) 202 if (!modmap)
197 return 0; 203 return 0;
198 204
199 // search through modmap for this keycode 205 // search through modmap for this keycode
@@ -204,7 +210,7 @@ unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) {
204 if (modmap->modifiermap[modmap->max_keypermod*mod + key] == keycode) { 210 if (modmap->modifiermap[modmap->max_keypermod*mod + key] == keycode) {
205 return modlist[mod].mask; 211 return modlist[mod].mask;
206 } 212 }
207 } 213 }
208 } 214 }
209 // no luck 215 // no luck
210 return 0; 216 return 0;