diff options
author | Yu-Jie Lin <livibetter@gmail.com> | 2011-07-31 21:34:35 +0800 |
---|---|---|
committer | Yu-Jie Lin <livibetter@gmail.com> | 2011-07-31 21:34:35 +0800 |
commit | 94c0b6e4b62107ac59121a6a04e893923837408b (patch) | |
tree | daee19c54ad3ed9d24937fd65832ac882cb32806 /src | |
parent | 0379af967bddd6e90e4c7dadee6d96be1cb82f1d (diff) |
add scroll by a page actions
A page is the window width or height.
Signed-off-by: Yu-Jie Lin <livibetter@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/keyevents.c | 28 | ||||
-rw-r--r-- | src/options.h | 4 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/keyevents.c b/src/keyevents.c index ddfe782..7c5e313 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -97,6 +97,10 @@ void init_keyevents(void) { feh_set_kb(&keys.scroll_right,0,XK_KP_Right , 4, XK_Right , 0, 0); feh_set_kb(&keys.scroll_down,0, XK_KP_Down , 4, XK_Down , 0, 0); feh_set_kb(&keys.scroll_up , 0, XK_KP_Up , 4, XK_Up , 0, 0); + feh_set_kb(&keys.scroll_left_page , 8, XK_Left , 0, 0 , 0, 0); + feh_set_kb(&keys.scroll_right_page, 8, XK_Right, 0, 0 , 0, 0); + feh_set_kb(&keys.scroll_down_page , 8, XK_Down , 0, 0 , 0, 0); + feh_set_kb(&keys.scroll_up_page , 8, XK_Up , 0, 0 , 0, 0); feh_set_kb(&keys.prev_img , 0, XK_Left , 0, XK_p , 0, XK_BackSpace); feh_set_kb(&keys.next_img , 0, XK_Right , 0, XK_n , 0, XK_space); feh_set_kb(&keys.jump_back , 0, XK_Page_Up , 0, XK_KP_Page_Up, 0, 0); @@ -191,6 +195,14 @@ void init_keyevents(void) { cur_kb = &keys.scroll_up; else if (!strcmp(action, "scroll_down")) cur_kb = &keys.scroll_down; + else if (!strcmp(action, "scroll_right_page")) + cur_kb = &keys.scroll_right_page; + else if (!strcmp(action, "scroll_left_page")) + cur_kb = &keys.scroll_left_page; + else if (!strcmp(action, "scroll_up_page")) + cur_kb = &keys.scroll_up_page; + else if (!strcmp(action, "scroll_down_page")) + cur_kb = &keys.scroll_down_page; else if (!strcmp(action, "prev_img")) cur_kb = &keys.prev_img; else if (!strcmp(action, "next_img")) @@ -449,6 +461,22 @@ void feh_event_handle_keypress(XEvent * ev) winwid->im_y += 20; winwidget_render_image(winwid, 0, 1); } + else if (feh_is_kp(&keys.scroll_right_page, keysym, state)) { + winwid->im_x -= winwid->w; + winwidget_render_image(winwid, 0, 1); + } + else if (feh_is_kp(&keys.scroll_left_page, keysym, state)) { + winwid->im_x += winwid->w; + winwidget_render_image(winwid, 0, 1); + } + else if (feh_is_kp(&keys.scroll_down_page, keysym, state)) { + winwid->im_y -= winwid->h; + winwidget_render_image(winwid, 0, 1); + } + else if (feh_is_kp(&keys.scroll_up_page, keysym, state)) { + winwid->im_y += winwid->h; + winwidget_render_image(winwid, 0, 1); + } else if (feh_is_kp(&keys.jump_back, keysym, state)) { if (opt.slideshow) slideshow_change_image(winwid, SLIDE_JUMP_BACK); diff --git a/src/options.h b/src/options.h index f0015c9..3c62441 100644 --- a/src/options.h +++ b/src/options.h @@ -152,6 +152,10 @@ struct __fehkb { struct __fehkey next_img; struct __fehkey scroll_up; struct __fehkey scroll_down; + struct __fehkey scroll_right_page; + struct __fehkey scroll_left_page; + struct __fehkey scroll_up_page; + struct __fehkey scroll_down_page; struct __fehkey jump_back; struct __fehkey quit; struct __fehkey jump_fwd; |