[evince] ev-view-accessible: Add a method to determine if a given doc rect is showing
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] ev-view-accessible: Add a method to determine if a given doc rect is showing
- Date: Mon, 23 Jun 2014 16:40:59 +0000 (UTC)
commit 5c2ce4e9d82ebf579296ab64330d4364f5ae83de
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Jun 23 08:54:56 2014 -0400
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
libview/ev-view-accessible.c | 26 ++++++++++++++++++++++++++
libview/ev-view-accessible.h | 3 +++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index 7bb0774..1d9c320 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -540,6 +540,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,
diff --git a/libview/ev-view-accessible.h b/libview/ev-view-accessible.h
index 1ff5e20..bb10d10 100644
--- a/libview/ev-view-accessible.h
+++ b/libview/ev-view-accessible.h
@@ -62,6 +62,9 @@ void _transform_doc_rect_to_atk_rect (EvViewAccessible *accessible,
EvRectangle *doc_rect,
EvRectangle *atk_rect,
AtkCoordType coord_type);
+gboolean ev_view_accessible_is_doc_rect_showing (EvViewAccessible *accessible,
+ gint page,
+ EvRectangle *doc_rect);
#endif /* __EV_VIEW_ACCESSIBLE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]