aewl

changeset 279:2cedfbefd025

added mappingnotify event for kb refreshes
author Anselm R.Garbe <arg@10ksloc.org>
date Mon, 14 Aug 2006 16:08:52 +0200
parents c1187ddcd7f7
children 87cdbff4962e
files event.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/event.c	Mon Aug 14 15:43:04 2006 +0200
     1.2 +++ b/event.c	Mon Aug 14 16:08:52 2006 +0200
     1.3 @@ -277,6 +277,16 @@
     1.4  }
     1.5  
     1.6  static void
     1.7 +mappingnotify(XEvent *e)
     1.8 +{
     1.9 +	XMappingEvent *ev = &e->xmapping;
    1.10 +
    1.11 +	XRefreshKeyboardMapping(ev);
    1.12 +	if(ev->request == MappingKeyboard)
    1.13 +		grabkeys();
    1.14 +}
    1.15 +
    1.16 +static void
    1.17  maprequest(XEvent *e)
    1.18  {
    1.19  	static XWindowAttributes wa;
    1.20 @@ -348,6 +358,7 @@
    1.21  	[LeaveNotify] = leavenotify,
    1.22  	[Expose] = expose,
    1.23  	[KeyPress] = keypress,
    1.24 +	[MappingNotify] = mappingnotify,
    1.25  	[MapRequest] = maprequest,
    1.26  	[PropertyNotify] = propertynotify,
    1.27  	[UnmapNotify] = unmapnotify
    1.28 @@ -360,6 +371,7 @@
    1.29  	unsigned int i;
    1.30  	KeyCode code;
    1.31  
    1.32 +	XUngrabKey(dpy, AnyKey, AnyModifier, root);
    1.33  	for(i = 0; i < len; i++) {
    1.34  		code = XKeysymToKeycode(dpy, key[i].keysym);
    1.35  		XGrabKey(dpy, code, key[i].mod, root, True,