Skip to content

Commit

Permalink
Implement random slideshow jump ('z')
Browse files Browse the repository at this point in the history
  • Loading branch information
decklin committed Mar 23, 2010
1 parent 5bbc639 commit 7c12650
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/feh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
5 changes: 5 additions & 0 deletions src/keyevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/slideshow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7c12650

Please sign in to comment.