diff options
author | Decklin Foster <decklin@red-bean.com> | 2010-03-23 16:19:02 -0400 |
---|---|---|
committer | Decklin Foster <decklin@red-bean.com> | 2010-03-23 16:19:02 -0400 |
commit | 7c12650b8e451fabaa79ff5c11d58753448fd638 (patch) | |
tree | 8744bf3acb34936c71c3f8d667f438e2f338ca1a /src | |
parent | 5bbc639dc8eced23dcc851a461c17273ef9d078d (diff) |
Implement random slideshow jump ('z')
Diffstat (limited to 'src')
-rw-r--r-- | src/feh.h | 2 | ||||
-rw-r--r-- | src/keyevents.c | 5 | ||||
-rw-r--r-- | src/slideshow.c | 3 |
3 files changed, 9 insertions, 1 deletions
@@ -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; |