summaryrefslogtreecommitdiffstats
path: root/commands.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2014-01-04 18:38:40 +0100
committerBert Münnich <ber.t@posteo.de>2014-01-04 19:07:15 +0100
commit6a0fa2507cc933cfb54fdf4d80c094bfcdf782cf (patch)
treeab682c40f0a648b60db9a7a41753923279579cd9 /commands.c
parent0e818020cc3459dda528993e27202c8ef5dfa90f (diff)
downloadnsxiv-6a0fa2507cc933cfb54fdf4d80c094bfcdf782cf.tar.zst
Slideshow mode is back, in a simplified version
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/commands.c b/commands.c
index 9c3d7bf..211d80b 100644
--- a/commands.c
+++ b/commands.c
@@ -38,6 +38,7 @@ void open_info(void);
void redraw(void);
void reset_cursor(void);
void animate(void);
+void slideshow(void);
void set_timeout(timeout_f, int, bool);
void reset_timeout(timeout_f);
@@ -79,6 +80,10 @@ bool it_switch_mode(arg_t a)
}
img_close(&img, false);
reset_timeout(reset_cursor);
+ if (img.ss.on) {
+ img.ss.on = false;
+ reset_timeout(slideshow);
+ }
tns.sel = fileidx;
tns.dirty = true;
mode = MODE_THUMB;
@@ -475,20 +480,30 @@ bool i_flip(arg_t a)
}
}
-bool i_toggle_antialias(arg_t a)
+bool i_slideshow(arg_t a)
{
if (mode == MODE_IMAGE) {
- img_toggle_antialias(&img);
+ if (prefix > 0) {
+ img.ss.on = true;
+ img.ss.delay = prefix;
+ set_timeout(slideshow, img.ss.delay * 1000, true);
+ } else if (img.ss.on) {
+ img.ss.on = false;
+ reset_timeout(slideshow);
+ } else {
+ img.ss.on = true;
+ }
return true;
} else {
return false;
}
}
-bool i_change_gamma(arg_t a)
+bool i_toggle_antialias(arg_t a)
{
if (mode == MODE_IMAGE) {
- return img_change_gamma(&img, (long) a);
+ img_toggle_antialias(&img);
+ return true;
} else {
return false;
}
@@ -504,3 +519,12 @@ bool it_toggle_alpha(arg_t a)
return true;
}
+bool i_change_gamma(arg_t a)
+{
+ if (mode == MODE_IMAGE) {
+ return img_change_gamma(&img, (long) a);
+ } else {
+ return false;
+ }
+}
+