[polari] chatView: Fix handling of smooth scroll events



commit b6181d50931b8e47e1a2f2a2655d847412afe4c7
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Nov 28 18:50:12 2014 +0000

    chatView: Fix handling of smooth scroll events
    
    Gdk.Event.get_scroll_direction() helpfully does not return a scroll
    direction of SMOOTH for smooth scroll events, but UP, which messes
    with our filtering out all non-UP scroll events.
    Make the filtering more explicit to take this case into account.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740132

 src/chatView.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 291a704..90db494 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -358,11 +358,16 @@ const ChatView = new Lang.Class({
     },
 
     _onScroll: function(w, event) {
-        let [, dir] = event.get_scroll_direction();
+        let [hasDir, dir] = event.get_scroll_direction();
+        if (hasDir && dir != Gtk.ScrollDirection.UP)
+            return Gdk.EVENT_PROPAGATE;
+
+        let [hasDeltas, dx, dy] = event.get_scroll_deltas();
+        if (hasDeltas && dy >= 0)
+            return Gdk.EVENT_PROPAGATE;
 
         if (this._fetchingBacklog ||
             this.widget.vadjustment.value != 0 ||
-            dir != Gdk.ScrollDirection.UP ||
             this._logWalker.is_end())
             return Gdk.EVENT_PROPAGATE;
 


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