summaryrefslogtreecommitdiff
path: root/libview/ev-view-accessible.c
diff options
context:
space:
mode:
authorJoanmarie Diggs <[email protected]>2014-06-23 08:54:56 -0400
committerraveit65 <[email protected]>2017-11-27 10:13:51 +0100
commit787304da54342736718af61b4441c27615324adf (patch)
tree2a61a8aea30c7d96cb86ac96c4622b02405e4f4c /libview/ev-view-accessible.c
parent3eb5aac5d3313fee4f4f60ef323b2fa35f03b847 (diff)
downloadatril-787304da54342736718af61b4441c27615324adf.tar.bz2
atril-787304da54342736718af61b4441c27615324adf.tar.xz
ev-view-accessible: Add a method to determine if a given doc rect is showing
The Accessibility code needs to know this to set and update ATK_STATE_SHOWING. https://bugzilla.gnome.org/show_bug.cgi?id=728475 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-14&id=5c2ce4e
Diffstat (limited to 'libview/ev-view-accessible.c')
-rw-r--r--libview/ev-view-accessible.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index bcff9100..d48c97c7 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -532,6 +532,32 @@ _transform_doc_rect_to_atk_rect (EvViewAccessible *accessible,
atk_rect->y2 = view_rect.y + view_rect.height;
}
+gboolean
+ev_view_accessible_is_doc_rect_showing (EvViewAccessible *accessible,
+ gint page,
+ EvRectangle *doc_rect)
+{
+ EvView *view;
+ GdkRectangle view_rect;
+ GtkAllocation allocation;
+ gint x, y;
+ gboolean hidden;
+
+ view = EV_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)));
+ if (page < view->start_page || page > view->end_page)
+ return FALSE;
+
+ gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
+ x = gtk_adjustment_get_value (view->hadjustment);
+ y = gtk_adjustment_get_value (view->vadjustment);
+
+ _ev_view_transform_doc_rect_to_view_rect (view, page, doc_rect, &view_rect);
+ hidden = view_rect.x + view_rect.width < x || view_rect.x > x + allocation.width ||
+ view_rect.y + view_rect.height < y || view_rect.y > y + allocation.height;
+
+ return !hidden;
+}
+
void
ev_view_accessible_set_page_range (EvViewAccessible *accessible,
gint start,