summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-08-22 16:56:34 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-08-22 16:56:34 +0200
commit1ba7dd39c4414e8a0e9004f501b86c91d96587f0 (patch)
tree3052836761479c23cd22fd3420fd049846a94576
parentcf3237f58f058d0d5ac65ff10670a10b59cd7fd6 (diff)
Panning with CTRL + arrow keys
-rw-r--r--ChangeLog1
-rw-r--r--man/feh.pre18
-rw-r--r--src/keyevents.c70
3 files changed, 55 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index b704427..7931568 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ git HEAD
* Set correct window title when starting feh in paused mode
* Add Up/Down keys for zooming
* When zooming via keyboard: Always zoom around the center of the window
+ * The image can now be panned with Ctrl + arrow keys
Fri, 25 Jun 2010 16:07:20 +0200 Daniel Friesel <derf@chaosdorf.de>
diff --git a/man/feh.pre b/man/feh.pre
index 8bfac52..37e240a 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -667,11 +667,11 @@ change slides based on
Show menu. Use the arrow keys and return to select items,
.Aq escape
to close the menu.
-.It n , Ao space Ac , Aq right arrow
+.It n , Ao Space Ac , Aq Right
Show next image
.It o
Toggle pointer visibility
-.It p , Ao backspace Ac , Aq left arrow
+.It p , Ao Backspace Ac , Aq Left
Show previous image
.It q
Quit feh
@@ -697,7 +697,7 @@ for more about lossless JPEG rotation.
.It 0 .. 9
Execute the corresponding action
.Pq 0 = Cm --action , No 1 = Cm --action1 No etc.
-.It Aq return
+.It Aq Return
Run the command defined by
.Cm --action
.It Aq home
@@ -718,19 +718,19 @@ Decrease reload delay
Remove current file from filelist
.It Aq CTRL+delete
Remove current file from filelist and delete it
-.It Aq keypad left
+.It Ao keypad left Ac , Ao Ctrl+Left Ac
Move the image to the lift
-.It Aq keypad right
+.It Ao keypad right Ac , Ao Ctrl+Right Ac
Move the image to the right
-.It Aq keypad up
+.It Ao keypad up Ac , Ao Ctrl+Up Ac
Move the image up
-.It Aq keypad down
+.It Ao keypad down Ac , Ao Ctrl+Down Ac
Move the image down
.It Aq keypad begin
Antialias the image
-.It Ao keypad + Ac , Ao up arrow Ac
+.It Ao keypad + Ac , Ao Up Ac
Zoom in
-.It Ao keypad - Ac , Ao down arrow Ac
+.It Ao keypad - Ac , Ao Down Ac
Zoom out
.It Aq keypad *
Zoom to 100%
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;