From 6bd6294ab25f6941a4fa9619a102896e76fb218e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <forenjunkie@chello.at>
Date: Sun, 25 Mar 2018 01:16:20 +0100
Subject: [PATCH] Disable autoscroll when moving the slider

---
 gajim/chat_control_base.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py
index ad236fed6b..777049b822 100644
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -308,6 +308,12 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
         id_ = widget.connect('changed',
             self.on_conversation_vadjustment_changed)
         self.handlers[id_] = widget
+
+        vscrollbar = self.conv_scrolledwindow.get_vscrollbar()
+        id_ = vscrollbar.connect('button-release-event',
+                                 self._on_scrollbar_button_release)
+        self.handlers[id_] = vscrollbar
+
         self.correcting = False
         self.last_sent_msg = None
 
@@ -1256,6 +1262,14 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
                 # There were events to remove
                 self.redraw_after_event_removed(jid)
 
+    def _on_scrollbar_button_release(self, scrollbar, event):
+        if event.get_button()[1] != 1:
+            # We want only to catch the left mouse button
+            return
+        if not gtkgui_helpers.at_the_end(scrollbar.get_parent()):
+            app.log('autoscroll').info('Autoscroll disabled')
+            self.conv_textview.autoscroll = False
+
     def _on_scroll(self, widget, event):
         if not self.conv_textview.autoscroll:
             # autoscroll is already disabled
-- 
GitLab