[libchamplain] view: Stop emission of ClutterZoomAction::gesture-cancelled



commit 5cb2cb3c40fc3139781279cd0c94d26da3a07daf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Oct 31 16:58:35 2015 +0100

    view: Stop emission of ClutterZoomAction::gesture-cancelled
    
    We successfully override ::gesture-begin and ::zoom in order to
    replace the default "zoom the actor" behavior of ClutterZoomAction,
    however ClutterZoomAction::gesture-cancel implementation has the side
    effect of attempting to restore the actor translation and scale to the
    original position, which is undesirable here.
    
    This fixes the ChamplainView going blank, as it tries to "restore" a
    0 scale, because we didn't give it an opportunity to fetch the actor
    one on ClutterZoomAction::gesture-begin.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757149

 champlain/champlain-view.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 4e5480c..85ea530 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1252,6 +1252,18 @@ zoom_gesture_finish_cb (ClutterGestureAction *gesture,
 
 
 static void
+zoom_gesture_cancel_cb (ClutterGestureAction *gesture,
+    G_GNUC_UNUSED ClutterActor *actor,
+    gpointer user_data)
+{
+  ChamplainViewPrivate *priv = GET_PRIVATE (user_data);
+
+  priv->zoom_started = FALSE;
+  g_signal_stop_emission_by_name (gesture, "gesture-cancel");
+}
+
+
+static void
 champlain_view_init (ChamplainView *view)
 {
   DEBUG_LOG ()
@@ -1358,7 +1370,7 @@ champlain_view_init (ChamplainView *view)
   g_signal_connect (priv->zoom_gesture, "gesture-end",
                     G_CALLBACK (zoom_gesture_finish_cb), view);
   g_signal_connect (priv->zoom_gesture, "gesture-cancel",
-                    G_CALLBACK (zoom_gesture_finish_cb), view);
+                    G_CALLBACK (zoom_gesture_cancel_cb), view);
   clutter_actor_add_action (CLUTTER_ACTOR (view),
                             CLUTTER_ACTION (priv->zoom_gesture));
 


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