[evince/943-phantom-scroll-when-mouse-is-outside-of-window: 402/402] ignore scroll, text selection events while unfocused



commit 5e6ff7abda31f818f11bdaa35a5254ea2ddc11d6
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Wed Aug 15 16:12:59 2018 +0500

    ignore scroll, text selection events while unfocused
    
    If we are unfocused, ignore scroll, text selection
    events that we may still be receiving if user has not
    released the pressed button.
    
    Issue #943

 libview/ev-view.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 805744ef..31d7caef 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -4296,6 +4296,10 @@ ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event)
        guint state;
        gboolean fit_width, fit_height;
 
+       /* Ignore scroll if EvView is unfocused. Issue #943 */
+       if (!gtk_widget_has_focus (widget))
+               return TRUE;
+
        state = event->state & gtk_accelerator_get_default_mod_mask ();
 
        if (state == GDK_CONTROL_MASK) {
@@ -5728,6 +5732,20 @@ ev_view_motion_notify_event (GtkWidget      *widget,
                         * while clicking for launching synctex. Issue #951 */
                        return TRUE;
                } else {
+                       /* Don't keep on selecting text and updating
+                        * scrollbars if we're unfocused. Issue #943 */
+                       if (!gtk_widget_has_focus (GTK_WIDGET (view))) {
+                               if (view->selection_scroll_id) {
+                                       g_source_remove (view->selection_scroll_id);
+                                       view->selection_scroll_id = 0;
+                               }
+                               if (view->selection_update_id) {
+                                       g_source_remove (view->selection_update_id);
+                                       view->selection_update_id = 0;
+                               }
+
+                               return TRUE;
+                       }
                        /* Schedule timeout to scroll during selection and additionally
                         * scroll once to allow arbitrary speed. */
                        if (!view->selection_scroll_id)


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