aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-26 17:48:11 +0100
committerBert <ber.t@gmx.com>2011-01-26 17:48:11 +0100
commit0497a7f69d356f9008e0c89f390e6c72a9dbfbcc (patch)
treed7c11a3be026ed19a7092b8f41d58f9b1f99542a /main.c
parenta43d51d2bcd3e8964bf6ab51264b2a7f15ccb609 (diff)
parent9a35f40224a08bfcc27b4ba79301e22a58cf4495 (diff)
downloadnsxiv-0497a7f69d356f9008e0c89f390e6c72a9dbfbcc.tar.zst
Merge remote branch 'falconindy/mouse'
Diffstat (limited to 'main.c')
-rw-r--r--main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/main.c b/main.c
index 53f206b..ad2d4a4 100644
--- a/main.c
+++ b/main.c
@@ -31,10 +31,12 @@
void on_keypress(XEvent*);
void on_configurenotify(XEvent*);
+void on_buttonpress(XEvent*);
void update_title();
static void (*handler[LASTEvent])(XEvent*) = {
+ [ButtonPress] = on_buttonpress,
[KeyPress] = on_keypress,
[ConfigureNotify] = on_configurenotify
};
@@ -126,6 +128,31 @@ void cleanup() {
}
}
+void on_buttonpress(XEvent *ev) {
+ int changed;
+ XButtonEvent *buttonevent;
+
+ changed = 0;
+ buttonevent = &ev->xbutton;
+
+ switch (buttonevent->button) {
+ case Button4:
+ changed = img_zoom_in(&img);
+ break;
+ case Button5:
+ changed = img_zoom_out(&img);
+ break;
+ default:
+ return;
+ }
+
+ if (changed) {
+ img_render(&img, &win);
+ update_title();
+ timeout = 0;
+ }
+}
+
void on_keypress(XEvent *ev) {
char key;
KeySym keysym;