summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Crain <[email protected]>2013-06-17 23:09:43 -0500
committerraveit65 <[email protected]>2017-09-06 18:25:34 +0200
commit4f4be3b6e7bb69e2d1b15256e4bf801791c9b957 (patch)
treefa8fb3cccf095db4fa16ece6e7c04689c2ff4e1d
parent7f405ab2ff461b8053100e1027497e27095881ee (diff)
downloadatril-4f4be3b6e7bb69e2d1b15256e4bf801791c9b957.tar.bz2
atril-4f4be3b6e7bb69e2d1b15256e4bf801791c9b957.tar.xz
libview: Use EvPixbufCache to find selection region
Using view->selection_info.selections is inaccurate if the zoom changes, causing drag and drop of selected text to fail. This changes location_in_selected_text function to use the more accurate ev_pixbuf_cache_get_selection_region to find the selection region. https://bugzilla.gnome.org/show_bug.cgi?id=702406 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=abedcbd
-rw-r--r--libview/ev-view.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index e4a351f8..f91efe84 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -1449,25 +1449,21 @@ location_in_selected_text (EvView *view,
gdouble x,
gdouble y)
{
+ cairo_region_t *region;
gint page = -1;
gint x_offset = 0, y_offset = 0;
- EvViewSelection *selection;
- GList *l = NULL;
- for (l = view->selection_info.selections; l != NULL; l = l->next) {
- selection = (EvViewSelection *)l->data;
-
- find_page_at_location (view, x, y, &page, &x_offset, &y_offset);
-
- if (page != selection->page)
- continue;
-
- if (selection->covered_region &&
- cairo_region_contains_point (selection->covered_region, x_offset, y_offset))
- return TRUE;
- }
+ find_page_at_location (view, x, y, &page, &x_offset, &y_offset);
- return FALSE;
+ if (page == -1)
+ return FALSE;
+
+ region = ev_pixbuf_cache_get_selection_region (view->pixbuf_cache, page, view->scale);
+
+ if (region)
+ return cairo_region_contains_point (region, x_offset, y_offset);
+ else
+ return FALSE;
}
static gboolean