From 89ec18385b1d9e76463afd443b25c203a83c94cb Mon Sep 17 00:00:00 2001 From: Bert Date: Wed, 16 Feb 2011 17:09:46 +0100 Subject: Added app-mode --- main.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index e892fa8..602cc60 100644 --- a/main.c +++ b/main.c @@ -32,11 +32,17 @@ #include "util.h" #include "window.h" +typedef enum appmode_e { + MODE_NORMAL = 0, + MODE_THUMBS +} appmode_t; + void update_title(); int check_append(const char*); void read_dir_rec(const char*); void run(); +appmode_t mode; img_t img; win_t win; @@ -129,12 +135,16 @@ int main(int argc, char **argv) { } } - load_image(); - img_render(&img, &win); - update_title(); + if (options->thumbnails == 2) { + mode = MODE_THUMBS; + } else { + mode = MODE_NORMAL; + load_image(); + img_render(&img, &win); + } + update_title(); run(); - cleanup(); return 0; @@ -243,6 +253,12 @@ void read_dir_rec(const char *dirname) { unsigned char timeout; int mox, moy; +void redraw() { + img_render(&img, &win); + update_title(); + timeout = 0; +} + void on_keypress(XKeyEvent *kev) { int x, y; unsigned int w, h; @@ -374,11 +390,8 @@ void on_keypress(XKeyEvent *kev) { break; } - if (changed) { - img_render(&img, &win); - update_title(); - timeout = 0; - } + if (changed) + redraw(); } void on_buttonpress(XButtonEvent *bev) { @@ -433,11 +446,8 @@ void on_buttonpress(XButtonEvent *bev) { break; } - if (changed) { - img_render(&img, &win); - update_title(); - timeout = 0; - } + if (changed) + redraw(); } void on_motionnotify(XMotionEvent *mev) { -- cgit v1.2.3