diff options
Diffstat (limited to 'key.c')
-rw-r--r-- | key.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/key.c b/key.c index a8742da..b5d46c6 100644 --- a/key.c +++ b/key.c @@ -24,3 +24,20 @@ update_keys() XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync); } } + +void +keypress(XEvent *e) +{ + XKeyEvent *ev = &e->xkey; + unsigned int i, len; + KeySym keysym; + + keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); + len = sizeof(key) / sizeof(key[0]); + for(i = 0; i < len; i++) + if((keysym == key[i].keysym) && (key[i].mod == ev->state)) { + if(key[i].func) + key[i].func(key[i].arg); + return; + } +} |