aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/KeyUtil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/KeyUtil.cc')
-rw-r--r--src/FbTk/KeyUtil.cc43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc
index 72e78eb..952463c 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.4 2003/10/13 19:31:56 fluxgen Exp $ 22// $Id: KeyUtil.cc,v 1.5 2003/12/30 18:11:44 fluxgen Exp $
23 23
24#include "KeyUtil.hh" 24#include "KeyUtil.hh"
25#include "App.hh" 25#include "App.hh"
@@ -57,6 +57,41 @@ void KeyUtil::loadModmap() {
57 XFreeModifiermap(m_modmap); 57 XFreeModifiermap(m_modmap);
58 58
59 m_modmap = XGetModifierMapping(App::instance()->display()); 59 m_modmap = XGetModifierMapping(App::instance()->display());
60 // mask to use for modifier
61 int mods[] = {
62 ShiftMask,
63 LockMask,
64 ControlMask,
65 Mod1Mask,
66 Mod2Mask,
67 Mod3Mask,
68 Mod4Mask,
69 Mod5Mask,
70 0
71 };
72
73 // find modifiers and set them
74 for (int i=0, realkey=0; i<8; ++i) {
75 for (int key=0; key<m_modmap->max_keypermod; ++key, ++realkey) {
76
77 if (m_modmap->modifiermap[realkey] == 0)
78 continue;
79
80 KeySym ks = XKeycodeToKeysym(App::instance()->display(), m_modmap->modifiermap[realkey], 0);
81
82 switch (ks) {
83 case XK_Caps_Lock:
84 m_capslock = mods[i];
85 break;
86 case XK_Scroll_Lock:
87 m_scrolllock = mods[i];
88 break;
89 case XK_Num_Lock:
90 m_numlock = mods[i];
91 break;
92 }
93 }
94 }
60} 95}
61 96
62 97
@@ -67,9 +102,9 @@ void KeyUtil::loadModmap() {
67*/ 102*/
68void KeyUtil::grabKey(unsigned int key, unsigned int mod) { 103void KeyUtil::grabKey(unsigned int key, unsigned int mod) {
69 Display *display = App::instance()->display(); 104 Display *display = App::instance()->display();
70 const unsigned int capsmod = LockMask; 105 const unsigned int capsmod = instance().m_capslock;
71 const unsigned int nummod = Mod2Mask; 106 const unsigned int nummod = instance().m_numlock;
72 const unsigned int scrollmod = Mod5Mask; 107 const unsigned int scrollmod = instance().m_scrolllock;
73 108
74 for (int screen=0; screen<ScreenCount(display); screen++) { 109 for (int screen=0; screen<ScreenCount(display); screen++) {
75 110