mirror of git://git.suckless.org/dwm
added mappingnotify event for kb refreshes
This commit is contained in:
parent
9eef9f7b02
commit
0f3acce042
12
event.c
12
event.c
|
@ -276,6 +276,16 @@ leavenotify(XEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mappingnotify(XEvent *e)
|
||||||
|
{
|
||||||
|
XMappingEvent *ev = &e->xmapping;
|
||||||
|
|
||||||
|
XRefreshKeyboardMapping(ev);
|
||||||
|
if(ev->request == MappingKeyboard)
|
||||||
|
grabkeys();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maprequest(XEvent *e)
|
maprequest(XEvent *e)
|
||||||
{
|
{
|
||||||
|
@ -348,6 +358,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[LeaveNotify] = leavenotify,
|
[LeaveNotify] = leavenotify,
|
||||||
[Expose] = expose,
|
[Expose] = expose,
|
||||||
[KeyPress] = keypress,
|
[KeyPress] = keypress,
|
||||||
|
[MappingNotify] = mappingnotify,
|
||||||
[MapRequest] = maprequest,
|
[MapRequest] = maprequest,
|
||||||
[PropertyNotify] = propertynotify,
|
[PropertyNotify] = propertynotify,
|
||||||
[UnmapNotify] = unmapnotify
|
[UnmapNotify] = unmapnotify
|
||||||
|
@ -360,6 +371,7 @@ grabkeys()
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
KeyCode code;
|
KeyCode code;
|
||||||
|
|
||||||
|
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||||
for(i = 0; i < len; i++) {
|
for(i = 0; i < len; i++) {
|
||||||
code = XKeysymToKeycode(dpy, key[i].keysym);
|
code = XKeysymToKeycode(dpy, key[i].keysym);
|
||||||
XGrabKey(dpy, code, key[i].mod, root, True,
|
XGrabKey(dpy, code, key[i].mod, root, True,
|
||||||
|
|
Loading…
Reference in New Issue