From 751532c4bea353d48dbbfd5c536cfc47f7f2cbfc Mon Sep 17 00:00:00 2001
From: Carlos Garcia Campos <carlosgc@gnome.org>
Date: Sat, 27 Jul 2013 10:43:07 +0200
Subject: libview: Stop caret cursor blinking when cursor is not in a visible
 page

origin commit:
https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=570927e
---
 libview/ev-view.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'libview')

diff --git a/libview/ev-view.c b/libview/ev-view.c
index 50e0af2a..bb70a9cc 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -283,6 +283,9 @@ static void       ev_view_primary_clear_cb                   (GtkClipboard
 							      gpointer            data);
 static void       ev_view_update_primary_selection           (EvView             *ev_view);
 
+/*** Caret navigation ***/
+static void       ev_view_check_cursor_blink                 (EvView             *ev_view);
+
 G_DEFINE_TYPE_WITH_CODE (EvView, ev_view, GTK_TYPE_CONTAINER,
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
 
@@ -792,6 +795,8 @@ view_update_range_and_current_page (EvView *view)
 		for (i = end; i > view->end_page && end != -1; i--) {
 			hide_annotation_windows (view, i);
 		}
+
+		ev_view_check_cursor_blink (view);
 	}
 
 	#define PAGE_CACHE_NUMBER  10
@@ -3239,11 +3244,20 @@ ev_view_synctex_backward_search (EvView *view,
 #define CURSOR_PEND_MULTIPLIER 3
 #define CURSOR_DIVIDER 3
 
+static inline gboolean
+cursor_is_in_visible_page (EvView *view)
+{
+	return (view->cursor_page == view->current_page ||
+		(view->cursor_page >= view->start_page &&
+		 view->cursor_page <= view->end_page));
+}
+
 static gboolean
 cursor_should_blink (EvView *view)
 {
 	if (view->caret_enabled &&
 	    view->rotation == 0 &&
+	    cursor_is_in_visible_page (view) &&
 	    gtk_widget_has_focus (GTK_WIDGET (view)) &&
 	    view->pixbuf_cache &&
 	    !ev_pixbuf_cache_get_selection_region (view->pixbuf_cache, view->cursor_page, view->scale)) {
-- 
cgit v1.2.1