diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-08-22 16:56:34 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-08-22 16:56:34 +0200 |
commit | 1ba7dd39c4414e8a0e9004f501b86c91d96587f0 (patch) | |
tree | 3052836761479c23cd22fd3420fd049846a94576 /src | |
parent | cf3237f58f058d0d5ac65ff10670a10b59cd7fd6 (diff) |
Panning with CTRL + arrow keys
Diffstat (limited to 'src')
-rw-r--r-- | src/keyevents.c | 70 |
1 files changed, 45 insertions, 25 deletions
diff --git a/src/keyevents.c b/src/keyevents.c index 5ca57bd..08d444a 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -156,11 +156,19 @@ void feh_event_handle_keypress(XEvent * ev) switch (keysym) { case XK_Left: - if (opt.slideshow) + if (kev->state & ControlMask) { + winwid->im_x -= 10; + winwidget_render_image(winwid, 0, 0); + } + else if (opt.slideshow) slideshow_change_image(winwid, SLIDE_PREV); break; case XK_Right: - if (opt.slideshow) + if (kev->state & ControlMask) { + winwid->im_x += 10; + winwidget_render_image(winwid, 0, 0); + } + else if (opt.slideshow) slideshow_change_image(winwid, SLIDE_NEXT); break; case XK_Page_Up: @@ -242,45 +250,57 @@ void feh_event_handle_keypress(XEvent * ev) feh_event_invoke_action(winwid, opt.actions[9]); break; case XK_KP_Left: - winwid->im_x = winwid->im_x - 10; + winwid->im_x -= 10; winwidget_render_image(winwid, 0, 0); break; case XK_KP_Right: - winwid->im_x = winwid->im_x + 10; + winwid->im_x += 10; winwidget_render_image(winwid, 0, 0); break; case XK_KP_Up: - winwid->im_y = winwid->im_y - 10; + winwid->im_y -= 10; winwidget_render_image(winwid, 0, 0); break; case XK_KP_Down: - winwid->im_y = winwid->im_y + 10; + winwid->im_y += 10; winwidget_render_image(winwid, 0, 0); break; case XK_KP_Add: case XK_Up: - /* erroneously recognized as '+' in the *kbuf switch. Work around this. */ - len = 0; - winwid->old_zoom = winwid->zoom; - winwid->zoom = winwid->zoom * 1.25; - winwid->im_x = (winwid->w / 2) - (((winwid->w / 2) - winwid->im_x) / - winwid->old_zoom * winwid->zoom); - winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) / - winwid->old_zoom * winwid->zoom); - winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 1); + if (kev->state & ControlMask) { + winwid->im_y -= 10; + winwidget_render_image(winwid, 0, 0); + } + else { + /* erroneously recognized as '+' in the *kbuf switch. Work around this. */ + len = 0; + winwid->old_zoom = winwid->zoom; + winwid->zoom = winwid->zoom * 1.25; + winwid->im_x = (winwid->w / 2) - (((winwid->w / 2) - winwid->im_x) / + winwid->old_zoom * winwid->zoom); + winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) / + winwid->old_zoom * winwid->zoom); + winwidget_sanitise_offsets(winwid); + winwidget_render_image(winwid, 0, 1); + } break; case XK_KP_Subtract: case XK_Down: - len = 0; - winwid->old_zoom = winwid->zoom; - winwid->zoom = winwid->zoom * 0.75; - winwid->im_x = (winwid->w / 2) - (((winwid->w / 2) - winwid->im_x) / - winwid->old_zoom * winwid->zoom); - winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) / - winwid->old_zoom * winwid->zoom); - winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 1); + if (kev->state & ControlMask) { + winwid->im_y += 10; + winwidget_render_image(winwid, 0, 0); + } + else { + len = 0; + winwid->old_zoom = winwid->zoom; + winwid->zoom = winwid->zoom * 0.75; + winwid->im_x = (winwid->w / 2) - (((winwid->w / 2) - winwid->im_x) / + winwid->old_zoom * winwid->zoom); + winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) / + winwid->old_zoom * winwid->zoom); + winwidget_sanitise_offsets(winwid); + winwidget_render_image(winwid, 0, 1); + } break; case XK_KP_Multiply: len = 0; |