From 544fd8371854dcfd51c92f5ae1da7a8c3085156f Mon Sep 17 00:00:00 2001 From: Bert Date: Tue, 18 Jan 2011 15:33:25 +0100 Subject: Reordered function definitions --- events.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'events.c') diff --git a/events.c b/events.c index 867b147..8e7b9e2 100644 --- a/events.c +++ b/events.c @@ -24,16 +24,25 @@ #include "events.h" #include "window.h" +void on_keypress(app_t*, XEvent*); +void on_configurenotify(app_t*, XEvent*); +void on_expose(app_t*, XEvent*); + extern Display *dpy; -void on_expose(app_t *app, XEvent *ev) { -} +static void (*handler[LASTEvent])(app_t*, XEvent*) = { + [Expose] = on_expose, + [ConfigureNotify] = on_configurenotify, + [KeyPress] = on_keypress +}; -void on_configurenotify(app_t *app, XEvent *ev) { - if (!app || !ev) - return; - - win_configure(&app->win, &ev->xconfigure); +void event_loop(app_t *app) { + XEvent ev; + + while (!XNextEvent(dpy, &ev)) { + if (handler[ev.type]) + handler[ev.type](app, &ev); + } } void on_keypress(app_t *app, XEvent *ev) { @@ -56,17 +65,12 @@ void on_keypress(app_t *app, XEvent *ev) { } } -static void (*handler[LASTEvent])(app_t*, XEvent*) = { - [Expose] = on_expose, - [ConfigureNotify] = on_configurenotify, - [KeyPress] = on_keypress -}; - -void event_loop(app_t *app) { - XEvent ev; +void on_configurenotify(app_t *app, XEvent *ev) { + if (!app || !ev) + return; + + win_configure(&app->win, &ev->xconfigure); +} - while (!XNextEvent(dpy, &ev)) { - if (handler[ev.type]) - handler[ev.type](app, &ev); - } +void on_expose(app_t *app, XEvent *ev) { } -- cgit v1.2.3