[pitivi: 4/11] ruler.py, timeline.py: elminate flicker during zooming



commit a8d15fec9662cee541b5dc5483182d848d05b548
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Fri Sep 11 20:19:40 2009 -0700

    ruler.py, timeline.py: elminate flicker during zooming
    
    When the scroll adjustment changes, the canvas immediately scrolls its
    internal gdk window, which is the source of the flicker while zooming.
    Temporarily setting redraw_when_scrolling to true both suppresses this
    behavior and triggers a complete redraw of the canvas, eliminating flicker.

 pitivi/ui/timeline.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 037a43f..63c3254 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -158,6 +158,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
         self.ruler.set_size_request(0, 25)
         self.ruler.set_border_width(2)
         self.ruler.connect("key-press-event", self._keyPressEventCb)
+        self.ruler.connect("size-allocate", self._rulerSizeAllocateCb)
         self.attach(self.ruler, 1, 2, 0, 1, yoptions=0)
 
         # proportional timeline
@@ -361,9 +362,9 @@ class Timeline(gtk.Table, Loggable, Zoomable):
 ## Zooming and Scrolling
 
     def zoomChanged(self):
-        # this has to be in a timeout, because the resize hasn't actually
-        # completed yet, and so the canvas can't actually complete the scroll
-        gobject.idle_add(self.scrollToPlayhead)
+        self._canvas.props.redraw_when_scrolled = True
+        self.ruler.queue_resize()
+        self.ruler.queue_draw()
 
     def timelinePositionChanged(self, position):
         self._position = position
@@ -395,6 +396,9 @@ class Timeline(gtk.Table, Loggable, Zoomable):
         self.hadj.set_value(position)
         return False
 
+    def _rulerSizeAllocateCb(self, ruler, allocation):
+        self._canvas.props.redraw_when_scrolled = False
+
 ## Project callbacks
 
     def _setProject(self):



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