summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorCarlos Garcia Campos <[email protected]>2013-07-03 18:03:00 +0200
committerraveit65 <[email protected]>2017-09-06 18:25:34 +0200
commit4eb7cc70ec92ea11d7facd0e7f8c4556fd9f1746 (patch)
tree20dad09084a6e2426bf9ef314d0151477cce5010 /libview
parent35fd9251663154a90da965598b6d63fe641f64df (diff)
downloadatril-4eb7cc70ec92ea11d7facd0e7f8c4556fd9f1746.tar.bz2
atril-4eb7cc70ec92ea11d7facd0e7f8c4556fd9f1746.tar.xz
libview: Don't draw the caret cursor when the view is not focused
origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=1691b14
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 0c5f6973..f0f24377 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3950,6 +3950,16 @@ draw_caret_cursor (EvView *view,
cairo_restore (cr);
}
+static gboolean
+should_draw_caret_cursor (EvView *view,
+ gint page)
+{
+ return (view->caret_enabled &&
+ view->cursor_page == page &&
+ view->cursor_visible &&
+ gtk_widget_has_focus (GTK_WIDGET (view)));
+}
+
static void
draw_focus (EvView *view,
cairo_t *cr,
@@ -4017,7 +4027,7 @@ ev_view_draw (GtkWidget *widget,
draw_one_page (view, i, cr, &page_area, &border, area, &page_ready);
- if (page_ready && view->caret_enabled && view->cursor_page == i && view->cursor_visible)
+ if (page_ready && should_draw_caret_cursor (view, i))
draw_caret_cursor (view, cr);
if (page_ready && view->find_pages && view->highlight_find_results)
highlight_find_results (view, cr, i);