[evince] libview: Use EvPixbufCache to find selection region
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] libview: Use EvPixbufCache to find selection region
- Date: Tue, 18 Jun 2013 08:35:17 +0000 (UTC)
commit abedcbdf9fe1a8477ea571974a537deb1fb4a941
Author: Jason Crain <jason aquaticape us>
Date: Mon Jun 17 23:09:43 2013 -0500
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
libview/ev-view.c | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index d0928b4..984ef61 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -1467,25 +1467,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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]