mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
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.
This commit is contained in:
parent
0df9e0673c
commit
04441482d4
1
calmwm.c
1
calmwm.c
@ -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();
|
||||
|
||||
|
1
calmwm.h
1
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)); \
|
||||
|
21
xevents.c
21
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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user