summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Münnich <ber.t@gmx.com>2011-10-16 17:58:53 +0200
committerBert Münnich <ber.t@gmx.com>2011-10-16 17:58:53 +0200
commit4f5ce2e8282d3f317449dc8854397c042644e134 (patch)
tree4917bbda5feeb9a99aec57ff382e6663d1fc078f
parent867940ea85495ac4e8e23efbb574fd9d86bccf42 (diff)
downloadnsxiv-4f5ce2e8282d3f317449dc8854397c042644e134.tar.zst
Added i_set_zoom command: set zoom to number prefix
-rw-r--r--commands.c9
-rw-r--r--commands.h1
-rw-r--r--config.def.h2
3 files changed, 10 insertions, 2 deletions
diff --git a/commands.c b/commands.c
index db0a808..ea0a425 100644
--- a/commands.c
+++ b/commands.c
@@ -273,7 +273,14 @@ bool i_zoom(arg_t a) {
else if (scale < 0)
return img_zoom_out(&img);
else
- return img_zoom(&img, 1.0);
+ return false;
+}
+
+bool i_set_zoom(arg_t a) {
+ if (mode == MODE_IMAGE)
+ return img_zoom(&img, (prefix ? prefix : (long) a) / 100.0);
+ else
+ return false;
}
bool i_fit_to_win(arg_t a) {
diff --git a/commands.h b/commands.h
index 8785822..ab44c5e 100644
--- a/commands.h
+++ b/commands.h
@@ -56,6 +56,7 @@ bool i_pan_screen(arg_t);
bool i_pan_edge(arg_t);
bool i_drag(arg_t);
bool i_zoom(arg_t);
+bool i_set_zoom(arg_t);
bool i_fit_to_win(arg_t);
bool i_fit_to_img(arg_t);
bool i_rotate(arg_t);
diff --git a/config.def.h b/config.def.h
index 8454a82..2e54b99 100644
--- a/config.def.h
+++ b/config.def.h
@@ -112,7 +112,7 @@ static const keymap_t keys[] = {
{ false, XK_KP_Add, i_zoom, (arg_t) +1 },
{ false, XK_minus, i_zoom, (arg_t) -1 },
{ false, XK_KP_Subtract, i_zoom, (arg_t) -1 },
- { false, XK_equal, i_zoom, (arg_t) None },
+ { false, XK_equal, i_set_zoom, (arg_t) 100 },
{ false, XK_w, i_fit_to_win, (arg_t) None },
{ false, XK_W, i_fit_to_img, (arg_t) None },