summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-18 15:33:25 +0100
committerBert <ber.t@gmx.com>2011-01-18 15:33:25 +0100
commit544fd8371854dcfd51c92f5ae1da7a8c3085156f (patch)
tree61a23e9042195b4a3a53dcf09c0edccf3fb3e17c
parent2f4399d53017d76f233967c320362b0f5aa5a758 (diff)
downloadnsxiv-544fd8371854dcfd51c92f5ae1da7a8c3085156f.tar.zst
Reordered function definitions
-rw-r--r--events.c42
-rw-r--r--main.c14
2 files changed, 30 insertions, 26 deletions
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) {
}
diff --git a/main.c b/main.c
index a4f9add..9959657 100644
--- a/main.c
+++ b/main.c
@@ -23,13 +23,6 @@
app_t app;
-void cleanup() {
- static int in = 0;
-
- if (!in++)
- app_quit(&app);
-}
-
int main(int argc, char **argv) {
// TODO: parse cmd line arguments properly
@@ -42,3 +35,10 @@ int main(int argc, char **argv) {
return 0;
}
+
+void cleanup() {
+ static int in = 0;
+
+ if (!in++)
+ app_quit(&app);
+}