[evince] libview: Take caret navigation into account when getting AtkHyperlink indices



commit 5e4d9f872cb94ead13df1861ed812007c75eff42
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Mar 14 05:00:37 2014 -0400

    libview: Take caret navigation into account when getting AtkHyperlink indices
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726310

 libview/ev-link-accessible.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-link-accessible.c b/libview/ev-link-accessible.c
index 2a2bb05..afc9342 100644
--- a/libview/ev-link-accessible.c
+++ b/libview/ev-link-accessible.c
@@ -90,6 +90,12 @@ ev_hyperlink_get_object (AtkHyperlink *atk_hyperlink,
 }
 
 static gint
+get_relevant_page (EvView *view)
+{
+       return ev_view_is_caret_navigation_enabled (view) ? view->cursor_page : view->current_page;
+}
+
+static gint
 ev_hyperlink_get_start_index (AtkHyperlink *atk_hyperlink)
 {
         EvHyperlink             *hyperlink = EV_HYPERLINK (atk_hyperlink);
@@ -113,7 +119,7 @@ ev_hyperlink_get_start_index (AtkHyperlink *atk_hyperlink)
         if (!view->page_cache)
                 return -1;
 
-        ev_page_cache_get_text_layout (view->page_cache, view->current_page, &areas, &n_areas);
+        ev_page_cache_get_text_layout (view->page_cache, get_relevant_page (view), &areas, &n_areas);
         if (!areas)
                 return -1;
 
@@ -155,7 +161,7 @@ ev_hyperlink_get_end_index (AtkHyperlink *atk_hyperlink)
         if (!view->page_cache)
                 return -1;
 
-        ev_page_cache_get_text_layout (view->page_cache, view->current_page, &areas, &n_areas);
+        ev_page_cache_get_text_layout (view->page_cache, get_relevant_page (view), &areas, &n_areas);
         if (!areas)
                 return -1;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]