added mappingnotify event for kb refreshes
0f3acce0
1 file(s) · +12 −0
| 277 | 277 | } |
|
| 278 | 278 | ||
| 279 | 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 | 290 | maprequest(XEvent *e) |
|
| 281 | 291 | { |
|
| 282 | 292 | static XWindowAttributes wa; |
|
| 348 | 358 | [LeaveNotify] = leavenotify, |
|
| 349 | 359 | [Expose] = expose, |
|
| 350 | 360 | [KeyPress] = keypress, |
|
| 361 | + | [MappingNotify] = mappingnotify, |
|
| 351 | 362 | [MapRequest] = maprequest, |
|
| 352 | 363 | [PropertyNotify] = propertynotify, |
|
| 353 | 364 | [UnmapNotify] = unmapnotify |
|
| 360 | 371 | unsigned int i; |
|
| 361 | 372 | KeyCode code; |
|
| 362 | 373 | ||
| 374 | + | XUngrabKey(dpy, AnyKey, AnyModifier, root); |
|
| 363 | 375 | for(i = 0; i < len; i++) { |
|
| 364 | 376 | code = XKeysymToKeycode(dpy, key[i].keysym); |
|
| 365 | 377 | XGrabKey(dpy, code, key[i].mod, root, True, |
|