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




commit 5ee761c237dd374b7b7ce59156f51a76f653f044
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 fb3206f36..8cdde135a 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -5315,6 +5315,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;
 
@@ -5527,6 +5528,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;
@@ -6169,7 +6171,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);
                }
 
@@ -6320,6 +6322,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]