[evince] ev-view-accessibl: Fix get_caret_offset when the caret navigation is enabled



commit 32a67a6448fc86a9c2e29e04a3ac61e2e83127bf
Author: Antia Puentes <apuentes igalia com>
Date:   Wed Jul 17 15:42:31 2013 +0200

    ev-view-accessibl: Fix get_caret_offset when the caret navigation is enabled
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704399

 libview/ev-view-accessible.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index 4c3af0b..e31d70d 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -306,6 +306,7 @@ static gint
 ev_view_accessible_get_caret_offset (AtkText *text)
 {
        GtkWidget *widget;
+       EvView *view;
        GtkTextBuffer *buffer;
        GtkTextMark *cursor_mark;
        GtkTextIter cursor_itr;
@@ -316,6 +317,15 @@ ev_view_accessible_get_caret_offset (AtkText *text)
                /* State is defunct */
                return 0;
 
+       view = EV_VIEW (widget);
+
+       if (view->caret_enabled) {
+               if (view->cursor_page == view->current_page)
+                       return view->cursor_offset;
+               else
+                       return -1;
+       }
+
        buffer = ev_view_accessible_get_text_buffer (EV_VIEW_ACCESSIBLE (text), EV_VIEW (widget));
        if (!buffer)
                return 0;


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