about summary refs log tree commit diff stats
path: root/key.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-11 12:52:57 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-11 12:52:57 +0200
commit16c67f32d62849792c8e6d4fdec22a1896f9c279 (patch)
treecb18262f3e207d8229bf0f8833f602a7b7903b03 /key.c
parent366d81e313e6dd4e9e6c61ed8dfca4b4b40ccde6 (diff)
downloaddwm-16c67f32d62849792c8e6d4fdec22a1896f9c279.tar.gz
fixed several stuff (gridwm gets better and better)
Diffstat (limited to 'key.c')
-rw-r--r--key.c17
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;
+		}
+}