Merge djhejna/floatdelay

This commit is contained in:
Bert Münnich 2016-12-01 20:33:24 +01:00
commit ff2ce99bf7
6 changed files with 17 additions and 9 deletions

View File

@ -1,4 +1,4 @@
VERSION := git-20161129
VERSION := git-20161201
PREFIX := /usr/local
MANPREFIX := $(PREFIX)/share/man

View File

@ -429,8 +429,8 @@ bool ci_slideshow(arg_t _)
{
if (prefix > 0) {
img.ss.on = true;
img.ss.delay = prefix;
set_timeout(slideshow, img.ss.delay * 1000, true);
img.ss.delay = prefix * 10;
set_timeout(slideshow, img.ss.delay * 100, true);
} else if (img.ss.on) {
img.ss.on = false;
reset_timeout(slideshow);

View File

@ -76,7 +76,7 @@ void img_init(img_t *img, win_t *win)
img->gamma = MIN(MAX(options->gamma, -GAMMA_RANGE), GAMMA_RANGE);
img->ss.on = options->slideshow > 0;
img->ss.delay = options->slideshow > 0 ? options->slideshow : SLIDESHOW_DELAY;
img->ss.delay = options->slideshow > 0 ? options->slideshow : SLIDESHOW_DELAY * 10;
}
#if HAVE_LIBEXIF

10
main.c
View File

@ -371,8 +371,12 @@ void update_info(void)
bar_put(r, "%s%0*d/%d", mark, fw, fileidx + 1, filecnt);
} else {
bar_put(r, "%s", mark);
if (img.ss.on)
bar_put(r, "%ds | ", img.ss.delay);
if (img.ss.on) {
if (img.ss.delay % 10 != 0)
bar_put(r, "%2.1fs | ", (float)img.ss.delay / 10);
else
bar_put(r, "%ds | ", img.ss.delay / 10);
}
if (img.gamma != 0)
bar_put(r, "G%+d | ", img.gamma);
bar_put(r, "%3d%% | ", (int) (img.zoom * 100.0));
@ -403,7 +407,7 @@ void redraw(void)
if (mode == MODE_IMAGE) {
img_render(&img);
if (img.ss.on) {
t = img.ss.delay * 1000;
t = img.ss.delay * 100;
if (img.multi.cnt > 0 && img.multi.animate)
t = MAX(t, img.multi.length);
set_timeout(slideshow, t, false);

View File

@ -136,7 +136,7 @@ void parse_options(int argc, char **argv)
_options.recursive = true;
break;
case 'S':
n = strtol(optarg, &end, 0);
n = strtof(optarg, &end) * 10;
if (*end != '\0' || n <= 0)
error(EXIT_FAILURE, 0, "Invalid argument for option -S: %s", optarg);
_options.slideshow = n;

6
sxiv.1
View File

@ -87,7 +87,11 @@ Be quiet, disable warnings to standard error stream.
Search the given directories recursively for images to view.
.TP
.BI "\-S " DELAY
Start in slideshow mode. Set the delay between images to DELAY seconds.
Start in slideshow mode. Set the delay between images to
.I DELAY
seconds.
.I DELAY
may be a floating point number.
.TP
.BI "\-s " MODE
Set scale mode according to MODE character. Supported modes are: [d]own,