diff options
author | Carlos Garcia Campos <[email protected]> | 2013-06-26 19:45:21 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-09-06 18:25:34 +0200 |
commit | 37fec5daa5de7dfc9d7e37bb54dfa880478fdbd2 (patch) | |
tree | c0069b749e51ad0eb8381800e8facacf94dadde6 | |
parent | 9d7a5b80e72bfca2dfb40f7c0bac56ad35fbe533 (diff) | |
download | atril-37fec5daa5de7dfc9d7e37bb54dfa880478fdbd2.tar.bz2 atril-37fec5daa5de7dfc9d7e37bb54dfa880478fdbd2.tar.xz |
libview: Move the caret cursor when clicking outside a selection
origin commit:
https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=9a5e9df
-rw-r--r-- | libview/ev-view.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c index 0f102b42..12b5a548 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -4303,6 +4303,23 @@ position_caret_cursor_at_location (EvView *view, } static gboolean +position_caret_cursor_for_event (EvView *view, + GdkEventButton *event) +{ + GdkRectangle area; + + if (!position_caret_cursor_at_location (view, event->x, event->y)) + return FALSE; + + if (!get_caret_cursor_area (view, view->cursor_page, view->cursor_offset, &area)) + return FALSE; + + view->cursor_line_offset = area.x; + + return TRUE; +} + +static gboolean ev_view_button_press_event (GtkWidget *widget, GdkEventButton *event) { @@ -4355,6 +4372,10 @@ ev_view_button_press_event (GtkWidget *widget, view->selection_info.in_drag = TRUE; } else { start_selection_for_event (view, event); + if (position_caret_cursor_for_event (view, event)) { + view->cursor_blink_time = 0; + ev_view_pend_cursor_blink (view); + } } gtk_widget_queue_draw (widget); @@ -4387,12 +4408,7 @@ ev_view_button_press_event (GtkWidget *widget, if (EV_IS_SELECTION (view->document)) start_selection_for_event (view, event); - if (position_caret_cursor_at_location (view, event->x, event->y)) { - GdkRectangle area; - - if (get_caret_cursor_area (view, view->cursor_page, view->cursor_offset, &area)) - view->cursor_line_offset = area.x; - + if (position_caret_cursor_for_event (view, event)) { view->cursor_blink_time = 0; ev_view_pend_cursor_blink (view); @@ -4862,12 +4878,7 @@ ev_view_button_release_event (GtkWidget *widget, clear_link_selected (view); ev_view_update_primary_selection (view); - if (position_caret_cursor_at_location (view, event->x, event->y)) { - GdkRectangle area; - - if (get_caret_cursor_area (view, view->cursor_page, view->cursor_offset, &area)) - view->cursor_line_offset = area.x; - } + position_caret_cursor_for_event (view, event); if (view->selection_info.in_drag) { clear_selection (view); |