[evince] EvView: fix cancelling ongoing highlight text annotation



commit da076895b1b01196ec3a806070a4ee7d5f9eb5c0
Author: Nelson Ben <nbenitezl gmail com>
Date:   Wed Feb 23 17:55:54 2022 +0000

    EvView: fix cancelling ongoing highlight text annotation
    
    Fix ev_view_cancel_add_annotation() to correctly cancel
    an ongoing highlight text annotation.
    
    Fixes issue #1690

 libview/ev-view.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index a95751ea0..358eb5e0c 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3877,10 +3877,23 @@ void
 ev_view_cancel_add_annotation (EvView *view)
 {
        gint x, y;
+       guint annot_page;
 
        if (!view->adding_annot_info.adding_annot)
                return;
 
+       if (view->adding_annot_info.annot && view->pressed_button == GDK_BUTTON_PRIMARY) {
+               annot_page = ev_annotation_get_page_index (view->adding_annot_info.annot);
+               ev_document_doc_mutex_lock ();
+               ev_document_annotations_remove_annotation (EV_DOCUMENT_ANNOTATIONS (view->document),
+                                                          view->adding_annot_info.annot);
+               ev_document_doc_mutex_unlock ();
+               ev_page_cache_mark_dirty (view->page_cache, annot_page, EV_PAGE_DATA_INCLUDE_ANNOTS);
+               view->adding_annot_info.annot = NULL;
+               view->pressed_button = -1;
+               ev_view_reload_page (view, annot_page, NULL);
+       }
+
        view->adding_annot_info.adding_annot = FALSE;
        g_assert(!view->adding_annot_info.annot);
        ev_document_misc_get_pointer_position (GTK_WIDGET (view), &x, &y);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]