diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py index 1ef1fbfa45fa60f570761ee5fefe282ca2da8599..04f2ca2079fe15bf5198815d95d73758779d4557 100644 --- a/pitivi/timeline/timeline.py +++ b/pitivi/timeline/timeline.py @@ -59,6 +59,7 @@ from pitivi.utils.ui import set_children_state_recurse from pitivi.utils.ui import SNAPBAR_COLOR from pitivi.utils.ui import SNAPBAR_WIDTH from pitivi.utils.ui import SPACING +from pitivi.utils.ui import TOUCH_INPUT_SOURCES from pitivi.utils.ui import unset_children_state_recurse from pitivi.utils.ui import URI_TARGET_ENTRY from pitivi.utils.widgets import ZoomBox @@ -591,14 +592,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable): return False event_widget = Gtk.get_event_widget(event) - if event.get_state() & Gdk.ModifierType.SHIFT_MASK: - if delta_y > 0: - # Scroll down. - self.__scroll_adjustment(self.vadj, 1) - elif delta_y < 0: - # Scroll up. - self.__scroll_adjustment(self.vadj, -1) - elif event.get_state() & (Gdk.ModifierType.CONTROL_MASK | + if event.get_state() & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK): # Zoom. x, unused_y = event_widget.translate_coordinates(self.layout.layers_vbox, event.x, event.y) @@ -616,13 +610,20 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable): # Scroll so position remains in place. x, unused_y = event_widget.translate_coordinates(self.layout, event.x, event.y) self.hadj.set_value(self.nsToPixel(position) - x) + return False + + device = event.get_source_device() or event.device + if device and device.get_source() in TOUCH_INPUT_SOURCES: + scroll_x = delta_x + scroll_y = delta_y else: - if delta_y > 0: - # Scroll right. - self.__scroll_adjustment(self.hadj, 1) - else: - # Scroll left. - self.__scroll_adjustment(self.hadj, -1) + scroll_x = delta_y + scroll_y = 0 + if event.get_state() & Gdk.ModifierType.SHIFT_MASK: + scroll_x, scroll_y = scroll_y, scroll_x + + self.__scroll_adjustment(self.hadj, scroll_x) + self.__scroll_adjustment(self.vadj, scroll_y) return False diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py index cbfa56da3a7cbed7d7560d011081bbb788775095..9d9dc015550e6ea309e656af7e01cc0360df8487 100644 --- a/pitivi/utils/ui.py +++ b/pitivi/utils/ui.py @@ -71,6 +71,8 @@ FILE_TARGET_ENTRY = Gtk.TargetEntry.new("text/plain", 0, 0) URI_TARGET_ENTRY = Gtk.TargetEntry.new("text/uri-list", 0, 0) EFFECT_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/effect", 0, 0) +TOUCH_INPUT_SOURCES = (Gdk.InputSource.TOUCHPAD, Gdk.InputSource.TRACKPOINT, Gdk.InputSource.TABLET_PAD) + def get_month_format_string(): """Returns the appropriate format string for month name in time.strftime() function."""