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




commit 6d2a9e92ff440c67ac7a91e07266268400a2c0f0
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 a95751ea0..e03f634fc 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 == 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]