summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2018-04-03 15:32:29 +0300
committermonsta <[email protected]>2018-04-03 15:32:29 +0300
commit3b64a164663d53e1c348eae76a1be7285c560588 (patch)
tree07e19339b54c764648689a99f1f937ec4b7b0b0f
parent21254c434261d67fe6523e1b9615ac0ba9a54607 (diff)
downloadatril-3b64a164663d53e1c348eae76a1be7285c560588.tar.bz2
atril-3b64a164663d53e1c348eae76a1be7285c560588.tar.xz
libview: Fix shift+click text selection
ported from e6672a875c89cfd81d4e54ae8b1a8a834eb6fe8b for 1.18 branch
-rw-r--r--libview/ev-view.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 4584bd46..e1b060cc 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3601,6 +3601,22 @@ start_selection_for_event (EvView *view,
&(view->selection_info.start));
}
+static void
+extend_selection (EvView *view,
+ GdkPoint *start_point,
+ GdkPoint *end_point)
+{
+ if (!view->selection_info.selections) {
+ view->selection_info.start.x = start_point->x;
+ view->selection_info.start.y = start_point->y;
+ }
+
+ compute_selections (view,
+ EV_SELECTION_STYLE_GLYPH,
+ &(view->selection_info.start),
+ end_point);
+}
+
static gboolean
ev_view_button_press_event (GtkWidget *widget,
GdkEventButton *event)
@@ -3643,6 +3659,12 @@ ev_view_button_press_event (GtkWidget *widget,
if (EV_IS_SELECTION (view->document) && view->selection_info.selections) {
if (event->type == GDK_3BUTTON_PRESS) {
start_selection_for_event (view, event);
+ } else if (event->state & GDK_SHIFT_MASK) {
+ GdkPoint end_point;
+
+ end_point.x = event->x + view->scroll_x;
+ end_point.y = event->y + view->scroll_y;
+ extend_selection (view, &view->selection_info.start, &end_point);
} else if (location_in_selected_text (view,
event->x + view->scroll_x,
event->y + view->scroll_y)) {