[clutter-gst] sink: Make non-mouse related navigation events work
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gst] sink: Make non-mouse related navigation events work
- Date: Wed, 6 Apr 2011 22:02:32 +0000 (UTC)
commit 9d60596c6c4d6cf3380085b4e4c2faacc1660976
Author: Bastien Nocera <hadess hadess net>
Date: Wed Apr 6 22:19:43 2011 +0100
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
clutter-gst/clutter-gst-video-sink.c | 32 +++++++++++++++++---------------
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]