Krolyxon
Commit 89ec183

Branches

Refs →

nsxiv89ec183

Added app-mode

Author
Bert
Date
2011-02-16 17:09 +0100
Parent
7e2c85b
Commit
89ec18385b1d9e76463afd443b25c203a83c94cb

+24 −14

1 file changed

  1. M main.c +24 −14
M main.c View
@@ -32,11 +32,17 @@
3232 #include "util.h"
3333 #include "window.h"
3434
35+typedef enum appmode_e {
36+ MODE_NORMAL = 0,
37+ MODE_THUMBS
38+} appmode_t;
39+
3540 void update_title();
3641 int check_append(const char*);
3742 void read_dir_rec(const char*);
3843 void run();
3944
45+appmode_t mode;
4046 img_t img;
4147 win_t win;
4248
@@ -129,12 +135,16 @@ int main(int argc, char **argv) {
129135 }
130136 }
131137
132− load_image();
133− img_render(&img, &win);
134− update_title();
138+ if (options->thumbnails == 2) {
139+ mode = MODE_THUMBS;
140+ } else {
141+ mode = MODE_NORMAL;
142+ load_image();
143+ img_render(&img, &win);
144+ }
135145
146+ update_title();
136147 run();
137−
138148 cleanup();
139149
140150 return 0;
@@ -243,6 +253,12 @@ void read_dir_rec(const char *dirname) {
243253 unsigned char timeout;
244254 int mox, moy;
245255
256+void redraw() {
257+ img_render(&img, &win);
258+ update_title();
259+ timeout = 0;
260+}
261+
246262 void on_keypress(XKeyEvent *kev) {
247263 int x, y;
248264 unsigned int w, h;
@@ -374,11 +390,8 @@ void on_keypress(XKeyEvent *kev) {
374390 break;
375391 }
376392
377− if (changed) {
378− img_render(&img, &win);
379− update_title();
380− timeout = 0;
381− }
393+ if (changed)
394+ redraw();
382395 }
383396
384397 void on_buttonpress(XButtonEvent *bev) {
@@ -433,11 +446,8 @@ void on_buttonpress(XButtonEvent *bev) {
433446 break;
434447 }
435448
436− if (changed) {
437− img_render(&img, &win);
438− update_title();
439− timeout = 0;
440− }
449+ if (changed)
450+ redraw();
441451 }
442452
443453 void on_motionnotify(XMotionEvent *mev) {