summaryrefslogtreecommitdiff
path: root/src/FbTk/KeyUtil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/KeyUtil.cc')
-rw-r--r--src/FbTk/KeyUtil.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc
index 6985139..abf91fe 100644
--- a/src/FbTk/KeyUtil.cc
+++ b/src/FbTk/KeyUtil.cc
@@ -62,7 +62,7 @@ KeyUtil &KeyUtil::instance() {
62 62
63 63
64KeyUtil::KeyUtil() 64KeyUtil::KeyUtil()
65 : m_modmap(0), m_capslock(0), m_numlock(0), m_scrolllock(0) 65 : m_modmap(0), m_numlock(0), m_scrolllock(0)
66{ 66{
67 init(); 67 init();
68} 68}
@@ -93,9 +93,9 @@ void KeyUtil::loadModmap() {
93 m_modmap->modifiermap[realkey], 0); 93 m_modmap->modifiermap[realkey], 0);
94 94
95 switch (ks) { 95 switch (ks) {
96 case XK_Caps_Lock: 96 // we just want to clean the Lock modifier, not specifically the
97 m_capslock = modlist[i].mask; 97 // XK_Caps_Lock key
98 break; 98 // the others tend to vary from distro to distro, though
99 case XK_Scroll_Lock: 99 case XK_Scroll_Lock:
100 m_scrolllock = modlist[i].mask; 100 m_scrolllock = modlist[i].mask;
101 break; 101 break;
@@ -114,13 +114,12 @@ void KeyUtil::loadModmap() {
114*/ 114*/
115void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) { 115void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) {
116 Display *display = App::instance()->display(); 116 Display *display = App::instance()->display();
117 const unsigned int capsmod = instance().capslock();
118 const unsigned int nummod = instance().numlock(); 117 const unsigned int nummod = instance().numlock();
119 const unsigned int scrollmod = instance().scrolllock(); 118 const unsigned int scrollmod = instance().scrolllock();
120 119
121 // Grab with numlock, capslock and scrlock 120 // Grab with numlock, capslock and scrlock
122 for (int i = 0; i < 8; i++) { 121 for (int i = 0; i < 8; i++) {
123 XGrabKey(display, key, mod | (i & 1 ? capsmod : 0) | 122 XGrabKey(display, key, mod | (i & 1 ? LockMask : 0) |
124 (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), 123 (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0),
125 win, True, GrabModeAsync, GrabModeAsync); 124 win, True, GrabModeAsync, GrabModeAsync);
126 } 125 }
@@ -130,13 +129,12 @@ void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) {
130void KeyUtil::grabButton(unsigned int button, unsigned int mod, Window win, 129void KeyUtil::grabButton(unsigned int button, unsigned int mod, Window win,
131 unsigned int event_mask, Cursor cursor) { 130 unsigned int event_mask, Cursor cursor) {
132 Display *display = App::instance()->display(); 131 Display *display = App::instance()->display();
133 const unsigned int capsmod = instance().capslock();
134 const unsigned int nummod = instance().numlock(); 132 const unsigned int nummod = instance().numlock();
135 const unsigned int scrollmod = instance().scrolllock(); 133 const unsigned int scrollmod = instance().scrolllock();
136 134
137 // Grab with numlock, capslock and scrlock 135 // Grab with numlock, capslock and scrlock
138 for (int i = 0; i < 8; i++) { 136 for (int i = 0; i < 8; i++) {
139 XGrabButton(display, button, mod | (i & 1 ? capsmod : 0) | 137 XGrabButton(display, button, mod | (i & 1 ? LockMask : 0) |
140 (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), 138 (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0),
141 win, False, event_mask, GrabModeAsync, GrabModeAsync, 139 win, False, event_mask, GrabModeAsync, GrabModeAsync,
142 None, cursor); 140 None, cursor);