static gboolean button_release_event_cb (ClutterActor *actor, ClutterButtonEvent *event, gpointer user_data) { MexMediaControls *self = MEX_MEDIA_CONTROLS (user_data); MexContent *content = mex_content_view_get_content (MEX_CONTENT_VIEW (actor)); mex_media_controls_replace_content (self, content); return TRUE; }
static gboolean key_press_event_cb (ClutterActor *actor, ClutterKeyEvent *event, gpointer user_data) { MexMediaControls *self = MEX_MEDIA_CONTROLS (user_data); if (MEX_KEY_OK (event->keyval)) { MexContent *content = mex_content_view_get_content (MEX_CONTENT_VIEW (actor)); mex_media_controls_replace_content (self, content); return TRUE; } return FALSE; }
void mex_media_controls_focus_content (MexMediaControls *self, MexContent *content) { MexMediaControlsPrivate *priv = self->priv; ClutterContainer *container; GList *children, *l; container = CLUTTER_CONTAINER (clutter_script_get_object (priv->script, "related-box")); children = clutter_container_get_children (container); for (l = children; l; l = g_list_next (l)) { if (mex_content_view_get_content (l->data) == content) { mex_push_focus (l->data); return; } } return; }
static gboolean mex_player_key_press_event (ClutterActor *actor, ClutterKeyEvent *event) { MexPlayerPrivate *priv = MEX_PLAYER (actor)->priv; ClutterStage *stage; MxFocusManager *fmanager; stage = (ClutterStage*) clutter_actor_get_stage (actor); fmanager = mx_focus_manager_get_for_stage (stage); switch (event->keyval) { case CLUTTER_KEY_Down: { if (!priv->controls_visible && !priv->info_visible) return mex_player_set_controls_visible (MEX_PLAYER (actor), TRUE); break; } case MEX_KEY_INFO: { MexContent *content; content = priv->content; if (priv->info_visible) { /* hide the info panel */ clutter_actor_animate (priv->info_panel, CLUTTER_EASE_IN_SINE, 250, "opacity", 0x00, NULL); mx_widget_set_disabled (MX_WIDGET (priv->info_panel), TRUE); mx_widget_set_disabled (MX_WIDGET (priv->controls), FALSE); priv->info_visible = FALSE; if (priv->controls_prev_visible) mex_player_set_controls_visible (MEX_PLAYER (actor), TRUE); } else { /* if you're pressing info button while the media controls are up set them as previously visible */ if (priv->controls_visible) priv->controls_prev_visible = TRUE; MxFocusable *focusable; focusable = mx_focus_manager_get_focused (fmanager); if (MEX_IS_CONTENT_TILE (focusable) && priv->controls_prev_visible == TRUE) { content = mex_content_view_get_content (MEX_CONTENT_VIEW (focusable)); /* to avoid any accidental leak */ if (priv->related_tile) { g_object_unref (priv->related_tile); priv->related_tile = NULL; } priv->related_tile = g_object_ref (focusable); } mex_content_view_set_content (MEX_CONTENT_VIEW (priv->info_panel), content); /* show the info panel */ clutter_actor_animate (priv->info_panel, CLUTTER_EASE_IN_SINE, 250, "opacity", 0xff, NULL); mx_widget_set_disabled (MX_WIDGET (priv->info_panel), FALSE); mx_widget_set_disabled (MX_WIDGET (priv->controls), TRUE); priv->info_visible = TRUE; mex_player_set_controls_visible (MEX_PLAYER (actor), FALSE); mex_push_focus (MX_FOCUSABLE (priv->info_panel)); } return TRUE; } } return FALSE; }