[pitivi/gtktimeline] timeline: Handle scrolling on selected clips



commit a6bfaf7985301224c08a2e004851f449ca5468be
Author: Thibault Saunier <tsaunier gnome org>
Date:   Tue May 19 12:52:10 2015 +0200

    timeline: Handle scrolling on selected clips
    
    When a clip is selected the scroll events we receive have an actual
    direction (as opposed to GDK_SCROLL_SMOOTH) so we have to guess the
    delta_y from the direction.

 pitivi/timeline/timeline.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f5d7acf..d5b173f 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -486,7 +486,19 @@ class Timeline(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
     def __scrollEventCb(self, unused_widget, event):
         res, delta_x, delta_y = event.get_scroll_deltas()
         if not res:
-            return False
+            res, direction = event.get_scroll_direction()
+            if not res:
+                self.error("Could not get scroll delta")
+                return False
+
+            if direction == Gdk.ScrollDirection.UP:
+                delta_y = -1.0
+            elif direction == Gdk.ScrollDirection.DOWN:
+                delta_y = 1.0
+            else:
+                self.error("Could not handle %s scroll event"
+                           % direction)
+                return False
 
         event_widget = self.get_event_widget(event)
         x, y = event_widget.translate_coordinates(self, event.x, event.y)


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