aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-16 17:09:46 +0100
committerBert <ber.t@gmx.com>2011-02-16 17:09:46 +0100
commit89ec18385b1d9e76463afd443b25c203a83c94cb (patch)
treeec2ae653be245469bd4dfe1f08348aa6763eff5e /main.c
parent7e2c85b04c2a061524a5f70c91aa8947eb7bd567 (diff)
downloadnsxiv-89ec18385b1d9e76463afd443b25c203a83c94cb.tar.zst
Added app-mode
Diffstat (limited to 'main.c')
-rw-r--r--main.c38
1 files 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) {