summary refs log tree commit diff
path: root/xevents.c
diff options
context:
space:
mode:
authoroga <oga>2008-07-22 21:01:54 +0000
committeroga <oga>2008-07-22 21:01:54 +0000
commit04441482d4ceab6eab0eaadc5188997a245bf061 (patch)
treee4503178a9c64b969123b4ef028003a4b0f96794 /xevents.c
parent0df9e0673c948d588be79ba5beef761d3709b3d5 (diff)
downloadcwm-04441482d4ceab6eab0eaadc5188997a245bf061.tar.gz
cwm-04441482d4ceab6eab0eaadc5188997a245bf061.tar.xz
cwm-04441482d4ceab6eab0eaadc5188997a245bf061.zip
fix the froggy problem.
Implement a handler for the MappingEvent, meaning that the keymap has changed.
When this happens, ungrab all bindings, update the map, and regrab.

Fixes the problem where some keybindings wouldn't work under non us or
uk keymaps (especially the .fr map, it seems). Issue noticed by
ajacoutot@, ratchov@, and a few people on misc. Based on an initial diff
from ratchov@.

ok okan.
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/xevents.c b/xevents.c
index 0da23d7..274af43 100644
--- a/xevents.c
+++ b/xevents.c
@@ -375,6 +375,27 @@ xev_handle_shape(struct xevent *xev, XEvent *ee)
 		client_do_shape(cc);
 }
 
+/* 
+ * Called when the keymap has changed.
+ * Ungrab all keys, reload keymap and then regrab
+ */
+void
+xev_handle_mapping(struct xevent *xev, XEvent *ee)
+{
+	XMappingEvent		*e = &ee->xmapping;
+	struct keybinding	*kb;
+
+	TAILQ_FOREACH(kb, &Conf.keybindingq, entry)
+		conf_ungrab(&Conf, kb);
+
+	XRefreshKeyboardMapping(e);
+
+	TAILQ_FOREACH(kb, &Conf.keybindingq, entry)
+		conf_grab(&Conf, kb);
+
+	xev_register(xev);
+}
+
 /*
  * X Event handling
  */