diff options
Diffstat (limited to 'event.c')
| -rw-r--r-- | event.c | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -277,6 +277,16 @@ leavenotify(XEvent *e) | |||
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | static void | 279 | static void |
| 280 | mappingnotify(XEvent *e) | ||
| 281 | { | ||
| 282 | XMappingEvent *ev = &e->xmapping; | ||
| 283 | |||
| 284 | XRefreshKeyboardMapping(ev); | ||
| 285 | if(ev->request == MappingKeyboard) | ||
| 286 | grabkeys(); | ||
| 287 | } | ||
| 288 | |||
| 289 | static void | ||
| 280 | maprequest(XEvent *e) | 290 | maprequest(XEvent *e) |
| 281 | { | 291 | { |
| 282 | static XWindowAttributes wa; | 292 | static XWindowAttributes wa; |
| @@ -348,6 +358,7 @@ void (*handler[LASTEvent]) (XEvent *) = { | |||
| 348 | [LeaveNotify] = leavenotify, | 358 | [LeaveNotify] = leavenotify, |
| 349 | [Expose] = expose, | 359 | [Expose] = expose, |
| 350 | [KeyPress] = keypress, | 360 | [KeyPress] = keypress, |
| 361 | [MappingNotify] = mappingnotify, | ||
| 351 | [MapRequest] = maprequest, | 362 | [MapRequest] = maprequest, |
| 352 | [PropertyNotify] = propertynotify, | 363 | [PropertyNotify] = propertynotify, |
| 353 | [UnmapNotify] = unmapnotify | 364 | [UnmapNotify] = unmapnotify |
| @@ -360,6 +371,7 @@ grabkeys() | |||
| 360 | unsigned int i; | 371 | unsigned int i; |
| 361 | KeyCode code; | 372 | KeyCode code; |
| 362 | 373 | ||
| 374 | XUngrabKey(dpy, AnyKey, AnyModifier, root); | ||
| 363 | for(i = 0; i < len; i++) { | 375 | for(i = 0; i < len; i++) { |
| 364 | code = XKeysymToKeycode(dpy, key[i].keysym); | 376 | code = XKeysymToKeycode(dpy, key[i].keysym); |
| 365 | XGrabKey(dpy, code, key[i].mod, root, True, | 377 | XGrabKey(dpy, code, key[i].mod, root, True, |
