[totem] backend: Request next track when swiping with 2 fingers



commit 99dcbf8e9a97c261aa9620e038e5958dc1a9e975
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Nov 25 17:49:50 2014 +0100

    backend: Request next track when swiping with 2 fingers
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697896

 src/backend/bacon-video-widget.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 948eb91..e86161f 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -919,12 +919,23 @@ bacon_video_widget_swipe (ClutterSwipeAction    *action,
       return CLUTTER_EVENT_PROPAGATE;
   }
 
-  if (direction & CLUTTER_SWIPE_DIRECTION_LEFT)
-    g_signal_emit (G_OBJECT (bvw), bvw_signals[SIGNAL_SEEK_REQUESTED], 0,
-                  gtk_widget_get_direction (GTK_WIDGET (bvw)) == GTK_TEXT_DIR_RTL);
-  if (direction & CLUTTER_SWIPE_DIRECTION_RIGHT)
-    g_signal_emit (G_OBJECT (bvw), bvw_signals[SIGNAL_SEEK_REQUESTED], 0,
-                  gtk_widget_get_direction (GTK_WIDGET (bvw)) == GTK_TEXT_DIR_LTR);
+  if (direction & CLUTTER_SWIPE_DIRECTION_LEFT) {
+    if (clutter_gesture_action_get_n_touch_points (CLUTTER_GESTURE_ACTION (action)) == 1)
+      g_signal_emit (G_OBJECT (bvw), bvw_signals[SIGNAL_SEEK_REQUESTED], 0,
+                    gtk_widget_get_direction (GTK_WIDGET (bvw)) == GTK_TEXT_DIR_RTL);
+    else
+      g_signal_emit (G_OBJECT (bvw), bvw_signals[SIGNAL_TRACK_SKIP_REQUESTED], 0,
+                    gtk_widget_get_direction (GTK_WIDGET (bvw)) == GTK_TEXT_DIR_RTL);
+  }
+
+  if (direction & CLUTTER_SWIPE_DIRECTION_RIGHT) {
+    if (clutter_gesture_action_get_n_touch_points (CLUTTER_GESTURE_ACTION (action)) == 1)
+      g_signal_emit (G_OBJECT (bvw), bvw_signals[SIGNAL_SEEK_REQUESTED], 0,
+                    gtk_widget_get_direction (GTK_WIDGET (bvw)) == GTK_TEXT_DIR_LTR);
+    else
+      g_signal_emit (G_OBJECT (bvw), bvw_signals[SIGNAL_TRACK_SKIP_REQUESTED], 0,
+                    gtk_widget_get_direction (GTK_WIDGET (bvw)) == GTK_TEXT_DIR_LTR);
+  }
 
   return CLUTTER_EVENT_STOP;
 }
@@ -6008,6 +6019,13 @@ bacon_video_widget_initable_init (GInitable     *initable,
   g_signal_connect (action, "swipe",
                    G_CALLBACK (bacon_video_widget_swipe), bvw);
 
+  action = clutter_swipe_action_new ();
+  clutter_gesture_action_set_threshold_trigger_distance (CLUTTER_GESTURE_ACTION (action), 80.0, 80.0);
+  clutter_gesture_action_set_n_touch_points (CLUTTER_GESTURE_ACTION (action), 2);
+  clutter_actor_add_action (bvw->priv->texture, action);
+  g_signal_connect (action, "swipe",
+                   G_CALLBACK (bacon_video_widget_swipe), bvw);
+
   /* The spinner */
   bvw->priv->spinner = bacon_video_spinner_actor_new ();
   clutter_actor_set_name (bvw->priv->spinner, "spinner");


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