summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-03-15 17:40:42 +0100
committerDaniel Friesel <derf@finalrewind.org>2012-03-15 17:40:42 +0100
commit489b73d5f479dce3c70bab50b8663bdf1527b2cf (patch)
treef69cc1988024f32eb64240c51b6a0bb3e65a14c1
parent8899df700027280ad34c7ee64f2aadfc3ae8e6c8 (diff)
scroll keys: Sanitise offsets before rendering
-rw-r--r--ChangeLog1
-rw-r--r--src/keyevents.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d21cd7..4bf4a4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ git HEAD
* Add --magick-timeout option to set imagemagick conversion timeout or
disable it altogether
* Clean up temporary / to-delete files when receiveng SIG{INT,TERM,QUIT}
+ * Do not scroll past image borders when using key bindings
Tue, 06 Mar 2012 13:13:35 +0100 Daniel Friesel <derf@finalrewind.org>
diff --git a/src/keyevents.c b/src/keyevents.c
index 6327320..343b5d1 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -479,34 +479,42 @@ void feh_event_handle_keypress(XEvent * ev)
}
else if (feh_is_kp(&keys.scroll_right, keysym, state)) {
winwid->im_x -= 20;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.scroll_left, keysym, state)) {
winwid->im_x += 20;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.scroll_down, keysym, state)) {
winwid->im_y -= 20;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.scroll_up, keysym, state)) {
winwid->im_y += 20;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.scroll_right_page, keysym, state)) {
winwid->im_x -= winwid->w;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.scroll_left_page, keysym, state)) {
winwid->im_x += winwid->w;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.scroll_down_page, keysym, state)) {
winwid->im_y -= winwid->h;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.scroll_up_page, keysym, state)) {
winwid->im_y += winwid->h;
+ winwidget_sanitise_offsets(winwid);
winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.jump_back, keysym, state)) {