diff options
author | Bert <ber.t@gmx.com> | 2011-01-17 18:32:28 +0100 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-01-17 18:32:28 +0100 |
commit | 15603c25cf00a11dbdf238203858d9eab313120c (patch) | |
tree | c8221de381839b2100550b15128fd2d1293ad999 | |
parent | 6e0db8c88def1ba5758c385b7586585bcd251c5f (diff) |
Added event loop
-rw-r--r-- | app.c | 1 | ||||
-rw-r--r-- | events.c | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -37,6 +37,7 @@ void app_init(app_t *app) { } void app_run(app_t *app) { + event_loop(app); } void app_quit(app_t *app) { @@ -22,6 +22,7 @@ #include <X11/keysym.h> #include "events.h" +#include "window.h" extern Display *dpy; @@ -55,4 +56,10 @@ static void (*handler[LASTEvent])(app_t*, XEvent*) = { }; void event_loop(app_t *app) { + XEvent ev; + + while (!XNextEvent(dpy, &ev)) { + if (handler[ev.type]) + handler[ev.type](app, &ev); + } } |