summaryrefslogtreecommitdiff
path: root/libview/ev-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <[email protected]>2013-07-12 11:22:49 +0200
committerraveit65 <[email protected]>2017-09-06 18:25:34 +0200
commit5bf4d1e5294e2911884a5b5e030852b9d7298d49 (patch)
tree9cead7bd19c1ec9c3c7fd016be7b7f04aa70297e /libview/ev-view.c
parent6fb70d30efe8d93c3473b235c3ae7d7e433caaf3 (diff)
downloadatril-5bf4d1e5294e2911884a5b5e030852b9d7298d49.tar.bz2
atril-5bf4d1e5294e2911884a5b5e030852b9d7298d49.tar.xz
libview: Use merge_selection_region passing NULL to clear the selections
This way only the regions affected by the selection are redrawn and we don't need to schedule a full redraw every time clear_selection is called. origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=4b4ea6c
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r--libview/ev-view.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index e2ab37df..60afb088 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -4418,8 +4418,6 @@ ev_view_button_press_event (GtkWidget *widget,
ev_view_pend_cursor_blink (view);
}
}
-
- gtk_widget_queue_draw (widget);
} else if ((annot = ev_view_get_annotation_at_location (view, event->x, event->y))) {
ev_view_handle_annotation (view, annot, event->x, event->y, event->time);
} else if ((field = ev_view_get_form_field_at_location (view, event->x, event->y))) {
@@ -4921,11 +4919,8 @@ ev_view_button_release_event (GtkWidget *widget,
position_caret_cursor_for_event (view, event);
- if (view->selection_info.in_drag) {
+ if (view->selection_info.in_drag)
clear_selection (view);
- gtk_widget_queue_draw (widget);
- }
-
view->selection_info.in_drag = FALSE;
} else if (link) {
if (event->button == 2) {
@@ -5858,7 +5853,10 @@ ev_view_finalize (GObject *object)
{
EvView *view = EV_VIEW (object);
- clear_selection (view);
+ if (view->selection_info.selections) {
+ g_list_free_full (view->selection_info.selections, (GDestroyNotify)selection_free);
+ view->selection_info.selections = NULL;
+ }
clear_link_selected (view);
if (view->synctex_result) {
@@ -7777,15 +7775,7 @@ selection_free (EvViewSelection *selection)
static void
clear_selection (EvView *view)
{
- if (view->selection_info.selections) {
- g_list_free_full (view->selection_info.selections, (GDestroyNotify)selection_free);
- view->selection_info.selections = NULL;
-
- g_signal_emit (view, signals[SIGNAL_SELECTION_CHANGED], 0, NULL);
- }
-
- if (view->pixbuf_cache)
- ev_pixbuf_cache_set_selection_list (view->pixbuf_cache, NULL);
+ merge_selection_region (view, NULL);
}
void
@@ -7798,8 +7788,6 @@ ev_view_select_all (EvView *view)
if (view->rotation != 0)
return;
- clear_selection (view);
-
n_pages = ev_document_get_n_pages (view->document);
for (i = 0; i < n_pages; i++) {
gdouble width, height;