From e46367c073062ab7977eff0f549849c9f7e20a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Tue, 6 Sep 2011 22:27:33 +0200 Subject: [PATCH] timeline: fix possible lag when dragging on timeline I need to idle-aggregate scroll updates, since gtk performs heavy operations in a synchronous fashion here (ironically, they do that to make scrolling smooth). --- .../GstDebugViewer/Plugins/Timeline.py | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/debug-viewer/GstDebugViewer/Plugins/Timeline.py b/debug-viewer/GstDebugViewer/Plugins/Timeline.py index f95a8d9f81..91a119317e 100644 --- a/debug-viewer/GstDebugViewer/Plugins/Timeline.py +++ b/debug-viewer/GstDebugViewer/Plugins/Timeline.py @@ -746,6 +746,9 @@ class AttachedWindow (object): handler = self.handle_log_view_notify_model self.notify_model_id = window.log_view.connect ("notify::model", handler) + self.idle_scroll_path = None + self.idle_scroll_id = None + def detach (self, feature): self.window.log_view.disconnect (self.notify_model_id) @@ -759,6 +762,11 @@ class AttachedWindow (object): self.timeline.destroy () self.timeline = None + self.idle_scroll_path = None + if self.idle_scroll_id is not None: + gobject.source_remove (self.idle_scroll_id) + self.idle_scroll_id = None + def handle_detach_log_file (self, log_file): self.timeline.clear () @@ -870,10 +878,25 @@ class AttachedWindow (object): count = sum (data[:pos + 1]) - view = self.window.log_view - model = view.props.model - row = model[count] path = (count,) + self.idle_scroll_path = path + + if self.idle_scroll_id is None: + self.idle_scroll_id = gobject.idle_add (self.idle_scroll) + + return False + + def idle_scroll (self): + + self.idle_scroll_id = None + + if self.idle_scroll_path is None: + return False + + path = self.idle_scroll_path + self.idle_scroll_path = None + + view = self.window.log_view view.scroll_to_cell (path, use_align = True, row_align = .5) sel = view.get_selection () sel.select_path (path)