[gnome-shell/gnome-3-6] telepathyClient: Fix auto-scroll to bottom



commit 99b768ec545f7ac97ab5575aecf5672c433b72da
Author: Sjoerd Simons <sjoerd luon net>
Date:   Sun Oct 21 14:11:45 2012 +0200

    telepathyClient: Fix auto-scroll to bottom
    
    Instead of keeping track of the old adjustment.upper keep track of the
    old adjustment.value that corresponded to the bottom scroll position.
    
    This fixes the integrated chatview not always scrolling to the bottom
    by removing the assumption that page_size is constant between updates,
    which is not the case as the view is presented in various different ways.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686571

 js/ui/components/telepathyClient.js |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 11ca193..7aa6a84 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -780,16 +780,18 @@ const ChatNotification = new Lang.Class({
             this.emit('unfocused');
         }));
 
-        this._oldMaxScrollAdjustment = 0;
         this._createScrollArea();
         this._lastGroup = null;
         this._lastGroupActor = null;
 
+        // Keep track of the bottom position for the current adjustment and
+        // force a scroll to the bottom if things change while we were at the
+        // bottom
+        this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
         this._scrollArea.vscroll.adjustment.connect('changed', Lang.bind(this, function(adjustment) {
-            let currentValue = adjustment.value + adjustment.page_size;
-            if (currentValue == this._oldMaxScrollAdjustment)
+            if (adjustment.value == this._oldMaxScrollValue)
                 this.scrollTo(St.Side.BOTTOM);
-            this._oldMaxScrollAdjustment = adjustment.upper;
+            this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
         }));
 
         this._inputHistory = new History.HistoryManager({ entry: this._responseEntry.clutter_text });



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