summaryrefslogtreecommitdiff
path: root/libview/ev-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <[email protected]>2013-06-21 15:02:59 +0200
committerraveit65 <[email protected]>2017-09-06 18:25:34 +0200
commit97ed8ba00627102528987887f689ffffcf269fd0 (patch)
treef101bfb87dc47184bf6ecf7cccdc9c6fa7f7082e /libview/ev-view.c
parentfcc0e07d7522279dd81c3c306d25e31cc9a16d55 (diff)
downloadatril-97ed8ba00627102528987887f689ffffcf269fd0.tar.bz2
atril-97ed8ba00627102528987887f689ffffcf269fd0.tar.xz
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
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r--libview/ev-view.c10
1 files changed, 8 insertions, 2 deletions
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);
}