summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro PiƱeiro <[email protected]>2014-02-25 12:18:38 +0100
committerraveit65 <[email protected]>2017-11-27 10:13:51 +0100
commita8550dae6aa72a2d7dc6cc83a71317d4c1f09929 (patch)
treeecf376f51807c834db22a15ccd6ec736f1ff5c73
parent137dab44c694cb52000708501e7118b30f2bfa1b (diff)
downloadatril-a8550dae6aa72a2d7dc6cc83a71317d4c1f09929.tar.bz2
atril-a8550dae6aa72a2d7dc6cc83a71317d4c1f09929.tar.xz
a11y: cleaning implementation for atk_text_get_caret_offset
If caret access is not enabled (or in any other error) caret_offset should be -1, and not one based on the gtktextbuffer. Based on a previous patch by Joanmarie Diggs https://bugzilla.gnome.org/show_bug.cgi?id=701746 https://git.gnome.org/browse/evince/commit/?h=gnome-3-12&id=3b63aa8
-rw-r--r--libview/ev-view-accessible.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index 5f68973d..27f087b6 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -297,30 +297,17 @@ ev_view_accessible_get_caret_offset (AtkText *text)
{
GtkWidget *widget;
EvView *view;
- GtkTextBuffer *buffer;
- GtkTextMark *cursor_mark;
- GtkTextIter cursor_itr;
- gint retval;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
if (widget == NULL)
/* State is defunct */
- return 0;
+ return -1;
view = EV_VIEW (widget);
-
if (view->caret_enabled)
return view->cursor_offset;
- buffer = ev_view_accessible_get_text_buffer (EV_VIEW_ACCESSIBLE (text), EV_VIEW (widget));
- if (!buffer)
- return 0;
-
- cursor_mark = gtk_text_buffer_get_insert (buffer);
- gtk_text_buffer_get_iter_at_mark (buffer, &cursor_itr, cursor_mark);
- retval = gtk_text_iter_get_offset (&cursor_itr);
-
- return retval;
+ return -1;
}
static gboolean