[evince/esc_cancel_annotation] EvView: fix cancelling ongoing highlight text annotation




commit e6b3902ac01b66908a81b653c733d90f9d26eb3f
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Mon Jan 24 18:18:35 2022 -0400

    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 0924b0cc2..dbd0294b3 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3876,10 +3876,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 == 1) {
+               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]