Disable autoscroll when moving the slider

This commit is contained in:
Philipp Hörist 2018-03-25 01:16:20 +01:00
parent 040521397e
commit 6bd6294ab2
1 changed files with 14 additions and 0 deletions

View File

@ -308,6 +308,12 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
id_ = widget.connect('changed', id_ = widget.connect('changed',
self.on_conversation_vadjustment_changed) self.on_conversation_vadjustment_changed)
self.handlers[id_] = widget 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.correcting = False
self.last_sent_msg = None self.last_sent_msg = None
@ -1256,6 +1262,14 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
# There were events to remove # There were events to remove
self.redraw_after_event_removed(jid) 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): def _on_scroll(self, widget, event):
if not self.conv_textview.autoscroll: if not self.conv_textview.autoscroll:
# autoscroll is already disabled # autoscroll is already disabled