[libchamplain] ChamplainView: Move the key-press event to view



commit 1fd0ba0f0b87b64ead0a7f0c8c83c9761bf05f79
Author: Jonas Danielsson <jonas danielsson threetimestwo org>
Date:   Mon Oct 20 05:14:19 2014 -0400

    ChamplainView: Move the key-press event to view
    
    Bind the key-press event to the view actor instead
    of the kinetic_scroll actor. This will allow users
    of GtkChamplainEmbed to use the pan and zoom bindings
    from their application.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738849

 champlain/champlain-view.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index d9128a1..5431a11 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -242,9 +242,8 @@ static gboolean view_set_zoom_level_at (ChamplainView *view,
 static void tile_state_notify (ChamplainTile *tile,
     G_GNUC_UNUSED GParamSpec *pspec,
     ChamplainView *view);
-static gboolean kinetic_scroll_key_press_cb (ClutterActor *actor,
-    ClutterKeyEvent *event,
-    ChamplainView *view);
+static gboolean kinetic_scroll_key_press_cb (ChamplainView *view,
+    ClutterKeyEvent *event);
 static void champlain_view_go_to_with_duration (ChamplainView *view,
     gdouble latitude,
     gdouble longitude,
@@ -1179,13 +1178,13 @@ champlain_view_init (ChamplainView *view)
       G_CALLBACK (panning_completed), view);
   g_signal_connect (priv->kinetic_scroll, "button-press-event",
       G_CALLBACK (kinetic_scroll_button_press_cb), view);
-  g_signal_connect (priv->kinetic_scroll, "key-press-event",
-      G_CALLBACK (kinetic_scroll_key_press_cb), view);
 
   /* Setup stage */
   clutter_actor_add_child (CLUTTER_ACTOR (view), priv->kinetic_scroll);
   priv->zoom_overlay_actor = clutter_actor_new ();
   clutter_actor_add_child (CLUTTER_ACTOR (view), priv->zoom_overlay_actor);
+  g_signal_connect (view, "key-press-event",
+                    G_CALLBACK (kinetic_scroll_key_press_cb), NULL);
 
   /* Setup license */
   priv->license_actor = champlain_license_new ();
@@ -1288,9 +1287,8 @@ champlain_view_scroll (ChamplainView *view,
 
 
 static gboolean
-kinetic_scroll_key_press_cb (G_GNUC_UNUSED ClutterActor *actor,
-    ClutterKeyEvent *event,
-    ChamplainView *view)
+kinetic_scroll_key_press_cb (ChamplainView *view,
+    ClutterKeyEvent *event)
 {
   DEBUG_LOG ()
 


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