about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
authorAnselm R.Garbe <arg@10ksloc.org>2006-08-14 16:08:52 +0200
committerAnselm R.Garbe <arg@10ksloc.org>2006-08-14 16:08:52 +0200
commit0f3acce0429bc5d2906eaf9279abc5565b189d33 (patch)
tree61dd803f0957e9379c479a6fbaea7b0755414936 /event.c
parent9eef9f7b0277a893fb5e22ac109f785faf573580 (diff)
downloaddwm-0f3acce0429bc5d2906eaf9279abc5565b189d33.tar.gz
added mappingnotify event for kb refreshes
Diffstat (limited to 'event.c')
-rw-r--r--event.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/event.c b/event.c
index 1e077fa..85205d9 100644
--- a/event.c
+++ b/event.c
@@ -277,6 +277,16 @@ leavenotify(XEvent *e)
 }
 
 static void
+mappingnotify(XEvent *e)
+{
+	XMappingEvent *ev = &e->xmapping;
+
+	XRefreshKeyboardMapping(ev);
+	if(ev->request == MappingKeyboard)
+		grabkeys();
+}
+
+static void
 maprequest(XEvent *e)
 {
 	static XWindowAttributes wa;
@@ -348,6 +358,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
 	[LeaveNotify] = leavenotify,
 	[Expose] = expose,
 	[KeyPress] = keypress,
+	[MappingNotify] = mappingnotify,
 	[MapRequest] = maprequest,
 	[PropertyNotify] = propertynotify,
 	[UnmapNotify] = unmapnotify
@@ -360,6 +371,7 @@ grabkeys()
 	unsigned int i;
 	KeyCode code;
 
+	XUngrabKey(dpy, AnyKey, AnyModifier, root);
 	for(i = 0; i < len; i++) {
 		code = XKeysymToKeycode(dpy, key[i].keysym);
 		XGrabKey(dpy, code, key[i].mod, root, True,