summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Danielsson <jonas.danielsson@threetimestwo.org>2014-10-20 05:14:19 -0400
committerJiří Techet <techet@gmail.com>2014-10-20 19:51:46 +0200
commit1fd0ba0f0b87b64ead0a7f0c8c83c9761bf05f79 (patch)
tree59354d9cf80f3007ac6b94b026e5e5a5763ad6fe
parentb470dc9d12f6fe301d21f4d9504d27ca1301b246 (diff)
downloadlibchamplain-1fd0ba0f0b87b64ead0a7f0c8c83c9761bf05f79.tar.gz
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
-rw-r--r--champlain/champlain-view.c14
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 ()