aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/KeyUtil.cc57
-rw-r--r--src/FbTk/KeyUtil.hh2
2 files changed, 23 insertions, 36 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc
index b02a76b..3f413a9 100644
--- a/src/FbTk/KeyUtil.cc
+++ b/src/FbTk/KeyUtil.cc
@@ -118,44 +118,29 @@ void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) {
118 const unsigned int nummod = instance().numlock(); 118 const unsigned int nummod = instance().numlock();
119 const unsigned int scrollmod = instance().scrolllock(); 119 const unsigned int scrollmod = instance().scrolllock();
120 120
121 XGrabKey(display, key, mod,
122 win, True,
123 GrabModeAsync, GrabModeAsync);
124
125 // Grab with numlock, capslock and scrlock 121 // Grab with numlock, capslock and scrlock
122 for (int i = 0; i < 8; i++) {
123 XGrabKey(display, key, mod | (i & 1 ? capsmod : 0) |
124 (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0),
125 win, True, GrabModeAsync, GrabModeAsync);
126 }
127
128}
126 129
127 //numlock 130void KeyUtil::grabButton(unsigned int button, unsigned int mod, Window win,
128 XGrabKey(display, key, mod|nummod, 131 unsigned int event_mask, Cursor cursor) {
129 win, True, 132 Display *display = App::instance()->display();
130 GrabModeAsync, GrabModeAsync); 133 const unsigned int capsmod = instance().capslock();
131 //scrolllock 134 const unsigned int nummod = instance().numlock();
132 XGrabKey(display, key, mod|scrollmod, 135 const unsigned int scrollmod = instance().scrolllock();
133 win, True, 136
134 GrabModeAsync, GrabModeAsync); 137 // Grab with numlock, capslock and scrlock
135 //capslock 138 for (int i = 0; i < 8; i++) {
136 XGrabKey(display, key, mod|capsmod, 139 XGrabButton(display, button, mod | (i & 1 ? capsmod : 0) |
137 win, True, 140 (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0),
138 GrabModeAsync, GrabModeAsync); 141 win, True, event_mask, GrabModeAsync, GrabModeAsync,
139 142 None, cursor);
140 //capslock+numlock 143 }
141 XGrabKey(display, key, mod|capsmod|nummod,
142 win, True,
143 GrabModeAsync, GrabModeAsync);
144
145 //capslock+scrolllock
146 XGrabKey(display, key, mod|capsmod|scrollmod,
147 win, True,
148 GrabModeAsync, GrabModeAsync);
149
150 //capslock+numlock+scrolllock
151 XGrabKey(display, key, mod|capsmod|scrollmod|nummod,
152 win, True,
153 GrabModeAsync, GrabModeAsync);
154
155 //numlock+scrollLock
156 XGrabKey(display, key, mod|nummod|scrollmod,
157 win, True,
158 GrabModeAsync, GrabModeAsync);
159 144
160} 145}
161 146
diff --git a/src/FbTk/KeyUtil.hh b/src/FbTk/KeyUtil.hh
index 902d27e..eb2cdd5 100644
--- a/src/FbTk/KeyUtil.hh
+++ b/src/FbTk/KeyUtil.hh
@@ -44,6 +44,8 @@ public:
44 Grab the specified key 44 Grab the specified key
45 */ 45 */
46 static void grabKey(unsigned int key, unsigned int mod, Window win); 46 static void grabKey(unsigned int key, unsigned int mod, Window win);
47 static void grabButton(unsigned int button, unsigned int mod, Window win,
48 unsigned int event_mask, Cursor cursor = None);
47 49
48 /** 50 /**
49 convert the string to the keysym 51 convert the string to the keysym