Support for DELAY as a floating point number including less than 1
second while maintaining backward compatibiitiy with integer arguments.
This commit is contained in:
parent
32b29e61c1
commit
27bbaab976
4
image.c
4
image.c
|
@ -74,8 +74,8 @@ void img_init(img_t *img, win_t *win)
|
||||||
imlib_context_set_color_modifier(img->cmod);
|
imlib_context_set_color_modifier(img->cmod);
|
||||||
img->gamma = MIN(MAX(options->gamma, -GAMMA_RANGE), GAMMA_RANGE);
|
img->gamma = MIN(MAX(options->gamma, -GAMMA_RANGE), GAMMA_RANGE);
|
||||||
|
|
||||||
img->ss.on = options->slideshow > 0;
|
img->ss.on = options->slideshow > 0.0;
|
||||||
img->ss.delay = options->slideshow > 0 ? options->slideshow : SLIDESHOW_DELAY;
|
img->ss.delay = options->slideshow > 0.0 ? options->slideshow : SLIDESHOW_DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBEXIF
|
#if HAVE_LIBEXIF
|
||||||
|
|
2
image.h
2
image.h
|
@ -60,7 +60,7 @@ typedef struct {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool on;
|
bool on;
|
||||||
int delay;
|
float delay;
|
||||||
} ss;
|
} ss;
|
||||||
|
|
||||||
multi_img_t multi;
|
multi_img_t multi;
|
||||||
|
|
2
main.c
2
main.c
|
@ -372,7 +372,7 @@ void update_info(void)
|
||||||
} else {
|
} else {
|
||||||
bar_put(r, "%s", mark);
|
bar_put(r, "%s", mark);
|
||||||
if (img.ss.on)
|
if (img.ss.on)
|
||||||
bar_put(r, "%ds | ", img.ss.delay);
|
bar_put(r, "%2.1fs | ", img.ss.delay);
|
||||||
if (img.gamma != 0)
|
if (img.gamma != 0)
|
||||||
bar_put(r, "G%+d | ", img.gamma);
|
bar_put(r, "G%+d | ", img.gamma);
|
||||||
bar_put(r, "%3d%% | ", (int) (img.zoom * 100.0));
|
bar_put(r, "%3d%% | ", (int) (img.zoom * 100.0));
|
||||||
|
|
|
@ -44,6 +44,7 @@ void print_version(void)
|
||||||
void parse_options(int argc, char **argv)
|
void parse_options(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int n, opt;
|
int n, opt;
|
||||||
|
float f;
|
||||||
char *end, *s;
|
char *end, *s;
|
||||||
const char *scalemodes = "dfwh";
|
const char *scalemodes = "dfwh";
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ void parse_options(int argc, char **argv)
|
||||||
_options.zoom = 1.0;
|
_options.zoom = 1.0;
|
||||||
_options.animate = false;
|
_options.animate = false;
|
||||||
_options.gamma = 0;
|
_options.gamma = 0;
|
||||||
_options.slideshow = 0;
|
_options.slideshow = 0.0;
|
||||||
|
|
||||||
_options.fullscreen = false;
|
_options.fullscreen = false;
|
||||||
_options.embed = 0;
|
_options.embed = 0;
|
||||||
|
@ -128,10 +129,10 @@ void parse_options(int argc, char **argv)
|
||||||
_options.recursive = true;
|
_options.recursive = true;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
n = strtol(optarg, &end, 0);
|
f = (float) strtof(optarg, &end);
|
||||||
if (*end != '\0' || n <= 0)
|
if (*end != '\0' || f <= 0.0)
|
||||||
error(EXIT_FAILURE, 0, "Invalid argument for option -S: %s", optarg);
|
error(EXIT_FAILURE, 0, "Invalid argument for option -S: %s", optarg);
|
||||||
_options.slideshow = n;
|
_options.slideshow = (float) f;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
s = strchr(scalemodes, optarg[0]);
|
s = strchr(scalemodes, optarg[0]);
|
||||||
|
|
|
@ -36,7 +36,7 @@ typedef struct {
|
||||||
float zoom;
|
float zoom;
|
||||||
bool animate;
|
bool animate;
|
||||||
int gamma;
|
int gamma;
|
||||||
int slideshow;
|
float slideshow;
|
||||||
|
|
||||||
/* window: */
|
/* window: */
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
|
|
4
sxiv.1
4
sxiv.1
|
@ -81,7 +81,7 @@ Be quiet, disable warnings to standard error stream.
|
||||||
Search the given directories recursively for images to view.
|
Search the given directories recursively for images to view.
|
||||||
.TP
|
.TP
|
||||||
.BI "\-S " DELAY
|
.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 DELAY (float, e.g. 1, 3.1, 0.01) seconds.
|
||||||
.TP
|
.TP
|
||||||
.BI "\-s " MODE
|
.BI "\-s " MODE
|
||||||
Set scale mode according to MODE character. Supported modes are: [d]own,
|
Set scale mode according to MODE character. Supported modes are: [d]own,
|
||||||
|
@ -330,7 +330,7 @@ Toggle visibility of alpha-channel, i.e. image transparency.
|
||||||
.TP
|
.TP
|
||||||
.B s
|
.B s
|
||||||
Toggle slideshow mode and/or set the delay between images to
|
Toggle slideshow mode and/or set the delay between images to
|
||||||
.I count
|
.I count (integer prefix only)
|
||||||
seconds.
|
seconds.
|
||||||
.SH MOUSE COMMANDS
|
.SH MOUSE COMMANDS
|
||||||
The following mouse mappings are available in image mode:
|
The following mouse mappings are available in image mode:
|
||||||
|
|
Loading…
Reference in a new issue