diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-07-22 21:01:55 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-07-22 21:01:55 +0000 |
commit | 6009bef6a7c348ad714dc66cacf486d2006fc932 (patch) | |
tree | 48729f4f7dabc3d2c4e054cf7ae133eadf095ea6 /app/cwm | |
parent | e25072ce8fd9d3c5729b500ecfaaf46ae2c4d0d4 (diff) |
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 'app/cwm')
-rw-r--r-- | app/cwm/calmwm.c | 3 | ||||
-rw-r--r-- | app/cwm/calmwm.h | 3 | ||||
-rw-r--r-- | app/cwm/xevents.c | 23 |
3 files changed, 26 insertions, 3 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c index 77f9f52a7..6508f1d40 100644 --- a/app/cwm/calmwm.c +++ b/app/cwm/calmwm.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: calmwm.c,v 1.26 2008/07/22 20:51:54 oga Exp $ + * $Id: calmwm.c,v 1.27 2008/07/22 21:01:54 oga Exp $ */ #include "headers.h" @@ -101,6 +101,7 @@ main(int argc, char **argv) XEV_QUICK(NULL, NULL, Expose, xev_handle_expose, NULL); XEV_QUICK(NULL, NULL, DestroyNotify, xev_handle_destroynotify, NULL); XEV_QUICK(NULL, NULL, ClientMessage, xev_handle_clientmessage, NULL); + XEV_QUICK(NULL, NULL, MappingNotify, xev_handle_mapping, NULL); xev_loop(); diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index d7835ecd3..4737a1900 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -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: calmwm.h,v 1.64 2008/07/22 20:51:54 oga Exp $ + * $Id: calmwm.h,v 1.65 2008/07/22 21:01:54 oga Exp $ */ #ifndef _CALMWM_H_ @@ -369,6 +369,7 @@ void xev_handle_keyrelease(struct xevent *, XEvent *); void xev_handle_expose(struct xevent *, XEvent *); void xev_handle_clientmessage(struct xevent *, XEvent *); void xev_handle_shape(struct xevent *, XEvent *); +void xev_handle_mapping(struct xevent *, XEvent *); #define XEV_QUICK(a, b, c, d, e) do { \ xev_register(xev_new(a, b, c, d, e)); \ diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c index 3efb3ba18..c28f5504a 100644 --- a/app/cwm/xevents.c +++ b/app/cwm/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 */ |