summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2011-04-06 22:19:43 +0100
committerBastien Nocera <hadess@hadess.net>2011-04-06 23:02:05 +0100
commit9d60596c6c4d6cf3380085b4e4c2faacc1660976 (patch)
treeca92e2a5b1af775c8f342bf500ecd3b2135d2447
parent537db1942e3f7c7e9523a5b0c9955e011e09368a (diff)
downloadclutter-gst-9d60596c6c4d6cf3380085b4e4c2faacc1660976.tar.gz
sink: Make non-mouse related navigation events work
Even if the event structure we were given doesn't contain a "pointer" related element, we still need to send it downstream. This fixes keyboard navigation in menus, as well as switching angles, and other DVD related commands in Totem's menus. http://bugzilla.clutter-project.org/show_bug.cgi?id=2628
-rw-r--r--clutter-gst/clutter-gst-video-sink.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
index 4e58079..f5389e0 100644
--- a/clutter-gst/clutter-gst-video-sink.c
+++ b/clutter-gst/clutter-gst-video-sink.c
@@ -1318,23 +1318,25 @@ clutter_gst_navigation_send_event (GstNavigation *navigation,
gdouble x, y;
gfloat x_out, y_out;
- /* Converting pointer coordinates to the non scaled geometry */
- if (!gst_structure_get_double (structure, "pointer_x", &x))
- return;
-
- if (!gst_structure_get_double (structure, "pointer_y", &y))
- return;
-
- if (clutter_actor_transform_stage_point (CLUTTER_ACTOR (priv->texture), x, y, &x_out, &y_out) == FALSE)
- return;
+ /* Converting pointer coordinates to the non scaled geometry
+ * if the structure contains pointer coordinates */
+ if (gst_structure_get_double (structure, "pointer_x", &x) &&
+ gst_structure_get_double (structure, "pointer_y", &y))
+ {
+ if (clutter_actor_transform_stage_point (CLUTTER_ACTOR (priv->texture), x, y, &x_out, &y_out) == FALSE)
+ {
+ g_warning ("Failed to convert non-scaled coordinates for video-sink");
+ return;
+ }
- x = x_out * priv->width / clutter_actor_get_width (CLUTTER_ACTOR (priv->texture));
- y = y_out * priv->height / clutter_actor_get_height (CLUTTER_ACTOR (priv->texture));
+ x = x_out * priv->width / clutter_actor_get_width (CLUTTER_ACTOR (priv->texture));
+ y = y_out * priv->height / clutter_actor_get_height (CLUTTER_ACTOR (priv->texture));
- gst_structure_set (structure,
- "pointer_x", G_TYPE_DOUBLE, (gdouble) x,
- "pointer_y", G_TYPE_DOUBLE, (gdouble) y,
- NULL);
+ gst_structure_set (structure,
+ "pointer_x", G_TYPE_DOUBLE, (gdouble) x,
+ "pointer_y", G_TYPE_DOUBLE, (gdouble) y,
+ NULL);
+ }
event = gst_event_new_navigation (structure);