[PATCH 1/6] clients/view: Do not browse outside document range

Tim Wiederhake twied at gmx.net
Tue Jan 25 13:21:55 PST 2011


---
 clients/view.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/clients/view.c b/clients/view.c
index 88c59ad..9e19a5a 100644
--- a/clients/view.c
+++ b/clients/view.c
@@ -127,14 +127,20 @@ key_handler(struct window *window, struct input *input, uint32_t time,
 	case KEY_PAGEDOWN:
 		if (!state)
 			break;
-		view->page++;
+
+		if (view->page + 1 < poppler_document_get_n_pages(view->document))
+                        view->page++;
+
 		window_schedule_redraw(view->window);
 		break;
 	case KEY_BACKSPACE:
 	case KEY_PAGEUP:
 		if (!state)
 			break;
-		view->page--;
+
+		if(view->page > 0)
+                        view->page--;
+
 		window_schedule_redraw(view->window);
 		break;
 	default:
-- 
1.7.2.3



More information about the wayland-devel mailing list