Blame SOURCES/evince-3.14.2-prevent-view-from-jumping.patch

d6c6b3
From 0d5846e1e2e5c0373c171ac23838cd54b0750326 Mon Sep 17 00:00:00 2001
d6c6b3
From: Carlos Garcia Campos <carlosgc@gnome.org>
d6c6b3
Date: Thu, 4 Jun 2015 12:04:01 +0200
d6c6b3
Subject: [PATCH] libview: Only try to move the focus to different page when
d6c6b3
 the  current page has a focused element
d6c6b3
d6c6b3
This prevents the view from jumping to the first/last page when there
d6c6b3
are not focusable elements.
d6c6b3
d6c6b3
https://bugzilla.gnome.org/show_bug.cgi?id=741979
d6c6b3
---
d6c6b3
 libview/ev-view.c | 10 ++++++++++
d6c6b3
 1 file changed, 10 insertions(+)
d6c6b3
d6c6b3
diff --git a/libview/ev-view.c b/libview/ev-view.c
d6c6b3
index a9159cd..6098fc0 100644
d6c6b3
--- a/libview/ev-view.c
d6c6b3
+++ b/libview/ev-view.c
d6c6b3
@@ -6814,6 +6814,7 @@ ev_view_focus_next (EvView           *view,
d6c6b3
 {
d6c6b3
 	EvMapping *focus_element;
d6c6b3
 	GList     *elements;
d6c6b3
+	gboolean   had_focused_element;
d6c6b3
 
d6c6b3
 	if (view->focused_element) {
d6c6b3
 		GList *l;
d6c6b3
@@ -6822,9 +6823,11 @@ ev_view_focus_next (EvView           *view,
d6c6b3
 		l = g_list_find (elements, view->focused_element);
d6c6b3
 		l = g_list_next (l);
d6c6b3
 		focus_element = l ? l->data : NULL;
d6c6b3
+		had_focused_element = TRUE;
d6c6b3
 	} else {
d6c6b3
 		elements = ev_view_get_sorted_mapping_list (view, direction, view->current_page);
d6c6b3
 		focus_element = elements ? elements->data : NULL;
d6c6b3
+		had_focused_element = FALSE;
d6c6b3
 	}
d6c6b3
 
d6c6b3
 	g_list_free (elements);
d6c6b3
@@ -6839,6 +6842,13 @@ ev_view_focus_next (EvView           *view,
d6c6b3
 	ev_view_remove_all (view);
d6c6b3
 	_ev_view_set_focused_element (view, NULL, -1);
d6c6b3
 
d6c6b3
+	/* Only try to move the focus to next/previous pages when the current page had
d6c6b3
+	 * a focused element. This prevents the view from jumping to the first/last page
d6c6b3
+	 * when there are not focusable elements.
d6c6b3
+	*/
d6c6b3
+	if (!had_focused_element)
d6c6b3
+		return FALSE;
d6c6b3
+
d6c6b3
 	/* FIXME: this doesn't work if the next/previous page doesn't have form fields */
d6c6b3
 	if (direction == GTK_DIR_TAB_FORWARD) {
d6c6b3
 		if (ev_view_next_page (view)) {
d6c6b3
-- 
d6c6b3
2.5.0
d6c6b3