[evince/wip/gpoo/gtk4-rebase-port: 46/65] ev-view: explictly mark the beginning of selection start




commit 475cea3c800d1fa1b58103541c3497dcf481e516
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Sun Aug 22 15:28:22 2021 +0800

    ev-view: explictly mark the beginning of selection start
    
    There is a spurious motion event when create and show a child widget on
    EvView.
    
    Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>

 libview/ev-view-private.h | 1 +
 libview/ev-view.c         | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h
index e7a054bda..89fb79b14 100644
--- a/libview/ev-view-private.h
+++ b/libview/ev-view-private.h
@@ -66,6 +66,7 @@ typedef struct {
 
 /* Information for handling selection */
 typedef struct {
+       gboolean in_select;
        gboolean in_drag;
        GdkPoint start;
        GList *selections;
diff --git a/libview/ev-view.c b/libview/ev-view.c
index f1719963c..2202ae866 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -5274,6 +5274,7 @@ start_selection_for_event (EvView *view,
 {
        clear_selection (view);
 
+       view->selection_info.in_select = TRUE;
        view->selection_info.start.x = x + view->scroll_x;
        view->selection_info.start.y = y + view->scroll_y;
 
@@ -5486,6 +5487,7 @@ ev_view_button_press_event (GtkGestureClick       *gesture,
 
        view->pressed_button = button;
        view->selection_info.in_drag = FALSE;
+       view->selection_info.in_select = FALSE;
 
        if (view->scroll_info.autoscrolling)
                return;
@@ -6081,7 +6083,7 @@ ev_view_motion_notify_event (GtkEventControllerMotion     *self,
                         * than new motion events reach us.  We always put it in the
                         * idle to make sure we catch up and don't visibly lag the
                         * mouse. */
-                       if (!view->selection_update_id)
+                       if (view->selection_info.in_select && !view->selection_update_id)
                                view->selection_update_id = g_idle_add 
((GSourceFunc)selection_update_idle_cb, view);
                }
 
@@ -6219,6 +6221,7 @@ ev_view_button_release_event(GtkGestureClick              *self,
        EvLink *link = NULL;
 
        view->image_dnd_info.in_drag = FALSE;
+       view->selection_info.in_select = FALSE;
 
        if (gtk_gesture_is_recognized (view->zoom_gesture))
                return;


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