aewl

diff key.c @ 8:7066ff2fe8bc

added key handling
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 11:50:18 +0200
parents
children d567f430a81d
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/key.c	Tue Jul 11 11:50:18 2006 +0200
     1.3 @@ -0,0 +1,26 @@
     1.4 +/*
     1.5 + * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
     1.6 + * See LICENSE file for license details.
     1.7 + */
     1.8 +
     1.9 +#include "wm.h"
    1.10 +
    1.11 +#include <X11/keysym.h>
    1.12 +
    1.13 +static Key key[] = {
    1.14 +	KEYS
    1.15 +};
    1.16 +
    1.17 +void
    1.18 +update_keys()
    1.19 +{
    1.20 +	unsigned int i, len;
    1.21 +	KeyCode code;
    1.22 +
    1.23 +	len = sizeof(key) / sizeof(key[0]);
    1.24 +	for(i = 0; i < len; i++) {
    1.25 +		code = XKeysymToKeycode(dpy, key[i].keysym);
    1.26 +		XUngrabKey(dpy, code, key[i].mod, root);
    1.27 +		XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync);
    1.28 +	}
    1.29 +}