From 97ed8ba00627102528987887f689ffffcf269fd0 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Fri, 21 Jun 2013 15:02:59 +0200 Subject: libview: Take page border into account when computing selections origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=b9c32bc libview: Fix a crash when selecting more than one page https://bugzilla.gnome.org/show_bug.cgi?id=702874 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=e6fd3ff Make sure we never use negative coordinates in selection rectangle https://bugzilla.gnome.org/show_bug.cgi?id=702874 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=4a88904 --- libview/ev-view.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libview') diff --git a/libview/ev-view.c b/libview/ev-view.c index f0b5d69e..64674fdf 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -7391,10 +7391,13 @@ compute_new_selection_text (EvView *view, else point = stop; - if (i == first) + if (i == first) { _ev_view_transform_view_point_to_doc_point (view, point, &page_area, &selection->rect.x1, &selection->rect.y1); + selection->rect.x1 = MAX (selection->rect.x1 - border.left, 0); + selection->rect.y1 = MAX (selection->rect.y1 - border.top, 0); + } /* If the selection is contained within just one page, * make sure we don't write 'start' into both points @@ -7402,10 +7405,13 @@ compute_new_selection_text (EvView *view, if (first == last) point = stop; - if (i == last) + if (i == last) { _ev_view_transform_view_point_to_doc_point (view, point, &page_area, &selection->rect.x2, &selection->rect.y2); + selection->rect.x2 = MAX (selection->rect.x2 - border.right, 0); + selection->rect.y2 = MAX (selection->rect.y2 - border.bottom, 0); + } list = g_list_append (list, selection); } -- cgit v1.2.1