aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/KeyUtil.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-01-05 16:54:34 (GMT)
committermarkt <markt>2007-01-05 16:54:34 (GMT)
commit8930a711ee101c1a02f579a2ee8ebbe39065c085 (patch)
treecce01b032cb6c7e76e820590490e7c08ab758112 /src/FbTk/KeyUtil.cc
parent64fcedda00205f0c0b9464967f06322d4c7afa91 (diff)
downloadfluxbox-8930a711ee101c1a02f579a2ee8ebbe39065c085.zip
fluxbox-8930a711ee101c1a02f579a2ee8ebbe39065c085.tar.bz2
only grab keybindings on screens managed by fluxbox
Diffstat (limited to 'src/FbTk/KeyUtil.cc')
-rw-r--r--src/FbTk/KeyUtil.cc95
1 files changed, 43 insertions, 52 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc
index de9f947..b02a76b 100644
--- a/src/FbTk/KeyUtil.cc
+++ b/src/FbTk/KeyUtil.cc
@@ -112,57 +112,51 @@ void KeyUtil::loadModmap() {
112 Grabs a key with the modifier 112 Grabs a key with the modifier
113 and with numlock,capslock and scrollock 113 and with numlock,capslock and scrollock
114*/ 114*/
115void KeyUtil::grabKey(unsigned int key, unsigned int mod) { 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(); 117 const unsigned int capsmod = instance().capslock();
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 for (int screen=0; screen<ScreenCount(display); screen++) { 121 XGrabKey(display, key, mod,
122 122 win, True,
123 Window root = RootWindow(display, screen); 123 GrabModeAsync, GrabModeAsync);
124 124
125 XGrabKey(display, key, mod, 125 // Grab with numlock, capslock and scrlock
126 root, True, 126
127 GrabModeAsync, GrabModeAsync); 127 //numlock
128 128 XGrabKey(display, key, mod|nummod,
129 // Grab with numlock, capslock and scrlock 129 win, True,
130 130 GrabModeAsync, GrabModeAsync);
131 //numlock 131 //scrolllock
132 XGrabKey(display, key, mod|nummod, 132 XGrabKey(display, key, mod|scrollmod,
133 root, True, 133 win, True,
134 GrabModeAsync, GrabModeAsync); 134 GrabModeAsync, GrabModeAsync);
135 //scrolllock 135 //capslock
136 XGrabKey(display, key, mod|scrollmod, 136 XGrabKey(display, key, mod|capsmod,
137 root, True, 137 win, True,
138 GrabModeAsync, GrabModeAsync); 138 GrabModeAsync, GrabModeAsync);
139 //capslock 139
140 XGrabKey(display, key, mod|capsmod, 140 //capslock+numlock
141 root, True, 141 XGrabKey(display, key, mod|capsmod|nummod,
142 GrabModeAsync, GrabModeAsync); 142 win, True,
143 143 GrabModeAsync, GrabModeAsync);
144 //capslock+numlock 144
145 XGrabKey(display, key, mod|capsmod|nummod, 145 //capslock+scrolllock
146 root, True, 146 XGrabKey(display, key, mod|capsmod|scrollmod,
147 GrabModeAsync, GrabModeAsync); 147 win, True,
148 148 GrabModeAsync, GrabModeAsync);
149 //capslock+scrolllock 149
150 XGrabKey(display, key, mod|capsmod|scrollmod, 150 //capslock+numlock+scrolllock
151 root, True, 151 XGrabKey(display, key, mod|capsmod|scrollmod|nummod,
152 GrabModeAsync, GrabModeAsync); 152 win, True,
153 153 GrabModeAsync, GrabModeAsync);
154 //capslock+numlock+scrolllock 154
155 XGrabKey(display, key, mod|capsmod|scrollmod|nummod, 155 //numlock+scrollLock
156 root, True, 156 XGrabKey(display, key, mod|nummod|scrollmod,
157 GrabModeAsync, GrabModeAsync); 157 win, True,
158 158 GrabModeAsync, GrabModeAsync);
159 //numlock+scrollLock 159
160 XGrabKey(display, key, mod|nummod|scrollmod,
161 root, True,
162 GrabModeAsync, GrabModeAsync);
163
164 }
165
166} 160}
167 161
168/** 162/**
@@ -196,12 +190,9 @@ unsigned int KeyUtil::getModifier(const char *modstr) {
196} 190}
197 191
198/// Ungrabs the keys 192/// Ungrabs the keys
199void KeyUtil::ungrabKeys() { 193void KeyUtil::ungrabKeys(Window win) {
200 Display * display = App::instance()->display(); 194 Display * display = App::instance()->display();
201 for (int screen=0; screen<ScreenCount(display); screen++) { 195 XUngrabKey(display, AnyKey, AnyModifier, win);
202 XUngrabKey(display, AnyKey, AnyModifier,
203 RootWindow(display, screen));
204 }
205} 196}
206 197
207unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) { 198unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) {