summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-03-13 14:22:27 +0100
committerDaniel Friesel <derf@finalrewind.org>2012-03-13 14:22:27 +0100
commit57e2af2763ee87bafb368390fd18382c957fd27e (patch)
tree55b9a236b7cd89ca771e2409efb8d73db2d2130b
parent8f5bf736a9d3f8084c644dbf6ceefc4142715c4e (diff)
slideshow_change_image: do not jump to current image on random jump (closes #85)
-rw-r--r--src/slideshow.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/slideshow.c b/src/slideshow.c
index 0f67917..337e202 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -264,8 +264,11 @@ void slideshow_change_image(winwidget winwid, int change, int render)
current_file = feh_list_jump(filelist, current_file, BACK, 1);
break;
case SLIDE_RAND:
- current_file = feh_list_jump(filelist, current_file, FORWARD, rand() % filelist_len);
- change = SLIDE_NEXT;
+ if (filelist_len > 1) {
+ current_file = feh_list_jump(filelist, current_file, FORWARD,
+ (rand() % (filelist_len - 1)) + 1);
+ change = SLIDE_NEXT;
+ }
break;
case SLIDE_JUMP_FWD:
if (filelist_len < 5)