diff options
author | markt <markt> | 2007-01-05 16:54:34 (GMT) |
---|---|---|
committer | markt <markt> | 2007-01-05 16:54:34 (GMT) |
commit | 8930a711ee101c1a02f579a2ee8ebbe39065c085 (patch) | |
tree | cce01b032cb6c7e76e820590490e7c08ab758112 /src/FbTk | |
parent | 64fcedda00205f0c0b9464967f06322d4c7afa91 (diff) | |
download | fluxbox_lack-8930a711ee101c1a02f579a2ee8ebbe39065c085.zip fluxbox_lack-8930a711ee101c1a02f579a2ee8ebbe39065c085.tar.bz2 |
only grab keybindings on screens managed by fluxbox
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/KeyUtil.cc | 95 | ||||
-rw-r--r-- | src/FbTk/KeyUtil.hh | 4 |
2 files changed, 45 insertions, 54 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 | */ |
115 | void KeyUtil::grabKey(unsigned int key, unsigned int mod) { | 115 | void 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 |
199 | void KeyUtil::ungrabKeys() { | 193 | void 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 | ||
207 | unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) { | 198 | unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) { |
diff --git a/src/FbTk/KeyUtil.hh b/src/FbTk/KeyUtil.hh index e1f1276..902d27e 100644 --- a/src/FbTk/KeyUtil.hh +++ b/src/FbTk/KeyUtil.hh | |||
@@ -43,7 +43,7 @@ public: | |||
43 | /** | 43 | /** |
44 | Grab the specified key | 44 | Grab the specified key |
45 | */ | 45 | */ |
46 | static void grabKey(unsigned int key, unsigned int mod); | 46 | static void grabKey(unsigned int key, unsigned int mod, Window win); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | convert the string to the keysym | 49 | convert the string to the keysym |
@@ -59,7 +59,7 @@ public: | |||
59 | /** | 59 | /** |
60 | ungrabs all keys | 60 | ungrabs all keys |
61 | */ | 61 | */ |
62 | static void ungrabKeys(); | 62 | static void ungrabKeys(Window win); |
63 | 63 | ||
64 | /** | 64 | /** |
65 | Strip out modifiers we want to ignore | 65 | Strip out modifiers we want to ignore |