summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoanmarie Diggs <[email protected]>2014-04-14 11:12:14 -0400
committerraveit65 <[email protected]>2017-11-27 10:13:51 +0100
commite6672a875c89cfd81d4e54ae8b1a8a834eb6fe8b (patch)
treef94cf7e9abf583560c77d567f71d67141a86ed32
parent806e8143f1f4e46a2e46c1ebe8dd337740505685 (diff)
downloadatril-e6672a875c89cfd81d4e54ae8b1a8a834eb6fe8b.tar.bz2
atril-e6672a875c89cfd81d4e54ae8b1a8a834eb6fe8b.tar.xz
libview: Fix shift+click text selection
https://bugzilla.gnome.org/show_bug.cgi?id=728189 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-14&id=7cf4c80
-rw-r--r--libview/ev-view.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index bb7d0d1b..9884280b 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -271,6 +271,9 @@ static void compute_selections (EvView
EvSelectionStyle style,
GdkPoint *start,
GdkPoint *stop);
+static void extend_selection (EvView *view,
+ GdkPoint *start,
+ GdkPoint *stop);
static void clear_selection (EvView *view);
static void clear_link_selected (EvView *view);
static void selection_free (EvViewSelection *selection);
@@ -4490,6 +4493,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)) {
@@ -5349,9 +5358,9 @@ cursor_forward_line (EvView *view)
}
static void
-extend_selection_from_cursor (EvView *view,
- GdkPoint *start_point,
- GdkPoint *end_point)
+extend_selection (EvView *view,
+ GdkPoint *start_point,
+ GdkPoint *end_point)
{
if (!view->selection_info.selections) {
view->selection_info.start.x = start_point->x;
@@ -5401,7 +5410,7 @@ static gboolean
ev_view_move_cursor (EvView *view,
GtkMovementStep step,
gint count,
- gboolean extend_selection)
+ gboolean extend_selections)
{
GdkRectangle rect;
GdkRectangle prev_rect;
@@ -5419,7 +5428,7 @@ ev_view_move_cursor (EvView *view,
prev_offset = view->cursor_offset;
prev_page = view->cursor_page;
- clear_selections = !extend_selection && view->selection_info.selections != NULL;
+ clear_selections = !extend_selections && view->selection_info.selections != NULL;
switch (step) {
case GTK_MOVEMENT_VISUAL_POSITIONS:
@@ -5510,7 +5519,7 @@ ev_view_move_cursor (EvView *view,
cairo_region_destroy (damage_region);
/* Select text */
- if (extend_selection && EV_IS_SELECTION (view->document)) {
+ if (extend_selections && EV_IS_SELECTION (view->document)) {
GdkPoint start_point, end_point;
start_point.x = prev_rect.x + view->scroll_x;
@@ -5519,7 +5528,7 @@ ev_view_move_cursor (EvView *view,
end_point.x = rect.x;
end_point.y = rect.y + rect.height / 2;
- extend_selection_from_cursor (view, &start_point, &end_point);
+ extend_selection (view, &start_point, &end_point);
} else if (clear_selections)
clear_selection (view);