summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDecklin Foster <decklin@red-bean.com>2010-03-23 16:19:02 -0400
committerDecklin Foster <decklin@red-bean.com>2010-03-23 16:19:02 -0400
commit7c12650b8e451fabaa79ff5c11d58753448fd638 (patch)
tree8744bf3acb34936c71c3f8d667f438e2f338ca1a
parent5bbc639dc8eced23dcc851a461c17273ef9d078d (diff)
Implement random slideshow jump ('z')
-rw-r--r--src/feh.h2
-rw-r--r--src/keyevents.c5
-rw-r--r--src/slideshow.c3
3 files changed, 9 insertions, 1 deletions
diff --git a/src/feh.h b/src/feh.h
index 25b7398..f81a3c0 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -93,7 +93,7 @@ enum bgmode_type { BG_MODE_NONE = 0, BG_MODE_TILE, BG_MODE_CENTER,
BG_MODE_SEAMLESS, BG_MODE_SCALE, BG_MODE_FILL
};
-enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_FIRST, SLIDE_LAST,
+enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_RAND, SLIDE_FIRST, SLIDE_LAST,
SLIDE_JUMP_FWD,
SLIDE_JUMP_BACK
};
diff --git a/src/keyevents.c b/src/keyevents.c
index 0350c8a..3f3cdcc 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -328,6 +328,11 @@ void feh_event_handle_keypress(XEvent * ev)
if (opt.slideshow)
slideshow_change_image(winwid, SLIDE_PREV);
break;
+ case 'z':
+ case 'Z':
+ if (opt.slideshow)
+ slideshow_change_image(winwid, SLIDE_RAND);
+ break;
case 'q':
case 'Q':
winwidget_destroy_all();
diff --git a/src/slideshow.c b/src/slideshow.c
index 0a70347..4835360 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -205,6 +205,9 @@ void slideshow_change_image(winwidget winwid, int change)
case SLIDE_PREV:
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);
+ break;
case SLIDE_JUMP_FWD:
if (filelist_len < 5)
jmp = 1;