summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/help.raw3
-rw-r--r--src/options.c16
-rw-r--r--src/options.h8
-rw-r--r--src/slideshow.c15
4 files changed, 35 insertions, 7 deletions
diff --git a/src/help.raw b/src/help.raw
index 86bb617..ebffae3 100644
--- a/src/help.raw
+++ b/src/help.raw
@@ -38,7 +38,8 @@ OPTIONS
--auto-rotate Rotate images according to Exif info (if compiled with exif=1)
-^, --title TITLE Set window title (see FORMAT SPECIFIERS)
-D, --slideshow-delay NUM Set delay between automatically changing slides
- --cycle-once Exit after one loop through the slideshow
+ --on-last-slide quit Exit after one loop through the slide show
+ --on-last-slide hold Stop at both ends of the filelist
-R, --reload NUM Reload images after NUM seconds
-k, --keep-http Keep local copies when viewing HTTP/FTP files
--insecure Disable peer/host verification when using HTTPS.
diff --git a/src/options.c b/src/options.c
index af0f07d..38d2568 100644
--- a/src/options.c
+++ b/src/options.c
@@ -415,6 +415,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
{"insecure" , 0, 0, 240},
{"no-recursive" , 0, 0, 241},
{"cache-size" , 1, 0, 243},
+ {"on-last-slide" , 1, 0, 244},
{"conversion-timeout" , 1, 0, 245},
{"version-sort" , 0, 0, 246},
{"offset" , 1, 0, 247},
@@ -742,7 +743,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
break;
#endif
case 224:
- opt.cycle_once = 1;
+ weprintf("--cycle-once is deprecated, please use --on-last-slide=quit instead");
+ opt.on_last_slide = ON_LAST_SLIDE_QUIT;
break;
case 225:
opt.xinerama = 0;
@@ -785,6 +787,18 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
if (opt.cache_size > 2048)
opt.cache_size = 2048;
break;
+ case 244:
+ if (!strcmp(optarg, "quit")) {
+ opt.on_last_slide = ON_LAST_SLIDE_QUIT;
+ } else if (!strcmp(optarg, "hold")) {
+ opt.on_last_slide = ON_LAST_SLIDE_HOLD;
+ } else if (!strcmp(optarg, "resume")) {
+ opt.on_last_slide = ON_LAST_SLIDE_RESUME;
+ } else {
+ weprintf("Unrecognized on-last-slide action \"%s\"."
+ "Supported actions: hold, resume, quit\n", optarg);
+ }
+ break;
case 245:
opt.conversion_timeout = atoi(optarg);
break;
diff --git a/src/options.h b/src/options.h
index 936b4bd..606b8e6 100644
--- a/src/options.h
+++ b/src/options.h
@@ -27,6 +27,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef OPTIONS_H
#define OPTIONS_H
+enum on_last_slide_action {
+ ON_LAST_SLIDE_RESUME = 0,
+ ON_LAST_SLIDE_QUIT,
+ ON_LAST_SLIDE_HOLD
+};
+
struct __fehoptions {
unsigned char multiwindow;
unsigned char montage;
@@ -68,7 +74,7 @@ struct __fehoptions {
unsigned char draw_actions;
unsigned char draw_info;
unsigned char cache_thumbnails;
- unsigned char cycle_once;
+ unsigned char on_last_slide;
unsigned char hold_actions[10];
unsigned char text_bg;
unsigned char no_fehbg;
diff --git a/src/slideshow.c b/src/slideshow.c
index e87d1b9..6a4f4d1 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -215,6 +215,7 @@ void feh_reload_image(winwidget w, int resize, int force_new)
void slideshow_change_image(winwidget winwid, int change, int render)
{
gib_list *last = NULL;
+ gib_list *previous_file = current_file;
int i = 0;
int jmp = 1;
/* We can't use filelist_len in the for loop, since that changes when we
@@ -227,7 +228,7 @@ void slideshow_change_image(winwidget winwid, int change, int render)
/* Without this, clicking a one-image slideshow reloads it. Not very *
intelligent behaviour :-) */
- if (filelist_len < 2 && opt.cycle_once == 0)
+ if (filelist_len < 2 && opt.on_last_slide != ON_LAST_SLIDE_QUIT)
return;
/* Ok. I do this in such an odd way to ensure that if the last or first *
@@ -335,6 +336,12 @@ void slideshow_change_image(winwidget winwid, int change, int render)
last = NULL;
}
+ if (opt.on_last_slide == ON_LAST_SLIDE_HOLD &&
+ ((current_file == filelist && change == SLIDE_NEXT) ||
+ (previous_file == filelist && change == SLIDE_PREV))) {
+ current_file = previous_file;
+ }
+
if (winwidget_loadimage(winwid, FEH_FILE(current_file->data))) {
int w = gib_imlib_image_get_width(winwid->im);
int h = gib_imlib_image_get_height(winwid->im);
@@ -568,10 +575,10 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete)
doomed = current_file;
/*
- * work around feh_list_jump exiting if cycle_once is enabled
+ * work around feh_list_jump exiting if ON_LAST_SLIDE_QUIT is set
* and no further files are left (we need to delete first)
*/
- if (opt.cycle_once && ! doomed->next && do_delete) {
+ if (opt.on_last_slide == ON_LAST_SLIDE_QUIT && ! doomed->next && do_delete) {
feh_file_rm_and_free(filelist, doomed);
exit(0);
}
@@ -647,7 +654,7 @@ gib_list *feh_list_jump(gib_list * root, gib_list * l, int direction, int num)
if (ret->next) {
ret = ret->next;
} else {
- if (opt.cycle_once) {
+ if (opt.on_last_slide == ON_LAST_SLIDE_QUIT) {
exit(0);
}
if (opt.randomize) {