From dd42db089ff9274876abed27db09073d2450fa29 Mon Sep 17 00:00:00 2001 From: oga Date: Tue, 22 Jul 2008 21:01:54 +0000 Subject: 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. --- xevents.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'xevents.c') diff --git a/xevents.c b/xevents.c index 3efb3ba..c28f550 100644 --- a/xevents.c +++ b/xevents.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: xevents.c,v 1.25 2008/07/11 14:21:28 okan Exp $ + * $Id: xevents.c,v 1.26 2008/07/22 21:01:54 oga Exp $ */ /* @@ -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 */ -- cgit v1.2.3-2-gb3c3