diff options
Diffstat (limited to 'libview/ev-view.c')
-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); |