コード例 #1
0
static void
tile_drag_run (MnpClockTile *tile, int ypos, MnpClockArea *area)
{
  /*ClutterActor *self = CLUTTER_ACTOR (area);
  ClutterActor *child = CLUTTER_ACTOR (tile); */
  GPtrArray *tiles = area->priv->clock_tiles;
  int i, pos;
  int diff = tiles->len == 4 ? 80 : 110;
  g_object_ref (tile);

  pos = (ypos-diff) / 80;
  if (pos >= tiles->len)
	  pos = tiles->len -1;
 
  g_ptr_array_remove (tiles, (gpointer) tile);
  insert_in_ptr_array (tiles, tile, pos);

  clutter_actor_set_depth ((ClutterActor *)tile, ((pos+1) * 0.05) - 0.01);
 
 
  for (i=tiles->len-1; i >= 0; i--) {
	  clutter_actor_set_depth (tiles->pdata[i], (i + 1) * 0.05);
  }
 
  g_object_unref (tile);		
}
コード例 #2
0
static void
mnp_clock_area_drop (MxDroppable *droppable, MxDraggable *draggable, gfloat event_x, gfloat event_y, gint button, ClutterModifierType modifiers)
{
  ClutterActor *self = CLUTTER_ACTOR (droppable);
  ClutterActor *child = CLUTTER_ACTOR (draggable);
  MnpClockTile *tile = (MnpClockTile *)draggable;
  MnpClockArea *area = (MnpClockArea *)droppable;
  GPtrArray *tiles = area->priv->clock_tiles;
  int i, pos;

  g_object_ref (draggable);

  pos = (event_y) / 80;
  if (pos >= tiles->len)
	  pos = tiles->len -1;
 
  clutter_actor_reparent (child, self);

  g_ptr_array_remove (tiles, (gpointer) draggable);
  insert_in_ptr_array (tiles, draggable, pos);

  clutter_actor_set_depth ((ClutterActor *)draggable, ((pos+1) * 0.05) - 0.01);
 
 
  for (i=tiles->len-1; i >= 0; i--) {
	  clutter_actor_set_depth (tiles->pdata[i], (i + 1) * 0.05);
  }
 
  area->priv->zone_reorder_func(mnp_clock_tile_get_location(tile), pos, area->priv->zone_reorder_data);

  g_object_unref (draggable);	
}
コード例 #3
0
ファイル: opt-transition.c プロジェクト: UIKit0/toys
static void
zoom_transition_frame_cb (OptTransition   *trans,
			  gint             frame_num,
			  gpointer         data)
{
  OptSlide             *from, *to;
  OptTransitionPrivate *priv;
  ClutterActor         *stage;
  gint                  n_frames = 0; 

  priv = trans->priv;

  from  = opt_transition_get_from (trans);
  to    = opt_transition_get_to (trans);
  stage = clutter_stage_get_default();

  n_frames = clutter_timeline_get_n_frames (CLUTTER_TIMELINE(trans));

  if (frame_num > n_frames/2)
    {
      clutter_actor_hide (CLUTTER_ACTOR(from));
      clutter_actor_show_all (CLUTTER_ACTOR(to));
      clutter_actor_set_depth (CLUTTER_ACTOR(to), 
			       -1 * ((n_frames * 2000) - (frame_num * 2000)));

      clutter_actor_set_rotation (CLUTTER_ACTOR(to),
            CLUTTER_Z_AXIS,
            frame_num * ((360*2)/n_frames),
            CLUTTER_STAGE_WIDTH()/2,
            CLUTTER_STAGE_HEIGHT()/2,
            0);
    }
  else
    {
      clutter_actor_hide (CLUTTER_ACTOR(to));
      clutter_actor_set_depth (CLUTTER_ACTOR(from), -2000 * frame_num);

      clutter_actor_set_rotation (CLUTTER_ACTOR(from),
            CLUTTER_Z_AXIS,
            frame_num * ((360*2)/n_frames),
            CLUTTER_STAGE_WIDTH()/2,
            CLUTTER_STAGE_HEIGHT()/2,
            0);
    }
}
コード例 #4
0
static void
actor_apply_knot_foreach (ClutterBehaviour *behave,
                          ClutterActor     *actor,
                          gpointer          data)
{
    ClutterBehaviourEllipsePrivate *priv;
    knot3d *knot = data;

    priv = ((ClutterBehaviourEllipse *) behave)->priv;

    clutter_actor_set_position (actor, knot->x, knot->y);

    if (priv->angle_tilt_x != 0 || priv->angle_tilt_y != 0)
        clutter_actor_set_depth (actor, knot->z);
}
コード例 #5
0
ファイル: st-container.c プロジェクト: hosttor/Cinnamon
static void
st_container_raise (ClutterContainer *container,
                    ClutterActor     *actor,
                    ClutterActor     *sibling)
{
  StContainerPrivate *priv = ST_CONTAINER (container)->priv;

  priv->children = g_list_remove (priv->children, actor);

  /* Raise at the top */
  if (!sibling)
    {
      GList *last_item;

      last_item = g_list_last (priv->children);

      if (last_item)
        sibling = last_item->data;

      priv->children = g_list_append (priv->children, actor);
    }
  else
    {
      gint pos;

      pos = g_list_index (priv->children, sibling) + 1;

      priv->children = g_list_insert (priv->children, actor, pos);
    }

  /* set Z ordering a value below, this will then call sort
   * as values are equal ordering shouldn't change but Z
   * values will be correct.
   *
   * FIXME: optimise
   */
  if (sibling &&
      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
    {
      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
    }

  st_container_update_pseudo_classes (ST_CONTAINER (container));

  if (CLUTTER_ACTOR_IS_VISIBLE (container))
    clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
コード例 #6
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *r1, *r2, *r3;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 300, 300);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  r1 = clutter_rectangle_new_with_color (&red);
  clutter_actor_set_size (r1, 150, 150);
  clutter_actor_add_constraint (r1, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.25));
  clutter_actor_add_constraint (r1, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.25));
  clutter_actor_set_reactive (r1, TRUE);
  clutter_actor_set_name (r1, "red");

  r2 = clutter_rectangle_new_with_color (&green);
  clutter_actor_set_size (r2, 150, 150);
  clutter_actor_add_constraint (r2, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
  clutter_actor_add_constraint (r2, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
  clutter_actor_set_reactive (r2, TRUE);
  clutter_actor_set_depth (r2, -100);
  clutter_actor_set_name (r2, "green");

  r3 = clutter_rectangle_new_with_color (&blue);
  clutter_actor_set_size (r3, 150, 150);
  clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.75));
  clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.75));
  clutter_actor_set_opacity (r3, 125);
  clutter_actor_set_name (r3, "blue");

  clutter_container_add (CLUTTER_CONTAINER (stage), r1, r2, r3, NULL);

  g_signal_connect (r1, "motion-event", G_CALLBACK (_pointer_motion_cb), NULL);
  g_signal_connect (r2, "motion-event", G_CALLBACK (_pointer_motion_cb), NULL);

  clutter_actor_show (stage);

  clutter_main ();

  return 0;
}
コード例 #7
0
static void
clutter_behaviour_ellipse_applied (ClutterBehaviour *behave,
                                   ClutterActor     *actor)
{
    ClutterBehaviourEllipse *e = CLUTTER_BEHAVIOUR_ELLIPSE (behave);
    ClutterBehaviourEllipsePrivate *priv = e->priv;
    knot3d knot = { 0, };

    clutter_behaviour_ellipse_advance (e, priv->angle_start, &knot);

    clutter_actor_set_position (actor, knot.x, knot.y);

    /* the depth should be changed only if there is a tilt on
     * any of the X or the Y axis
     */
    if (priv->angle_tilt_x != 0 || priv->angle_tilt_y != 0)
        clutter_actor_set_depth (actor, knot.z);
}
コード例 #8
0
ファイル: clutter-group.c プロジェクト: collinss/muffin
static void
clutter_group_real_raise (ClutterContainer *container,
                          ClutterActor     *actor,
                          ClutterActor     *sibling)
{
  ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;

  priv->children = g_list_remove (priv->children, actor);

  /* Raise at the top */
  if (!sibling)
    {
      GList *last_item;

      last_item = g_list_last (priv->children);

      if (last_item)
	sibling = last_item->data;

      priv->children = g_list_append (priv->children, actor);
    }
  else
    {
      gint index_ = g_list_index (priv->children, sibling) + 1;

      priv->children = g_list_insert (priv->children, actor, index_);
    }

  /* set Z ordering a value below, this will then call sort
   * as values are equal ordering shouldn't change but Z
   * values will be correct.
   *
   * FIXME: get rid of this crap; this is so utterly broken and wrong on
   * so many levels it's not even funny. sadly, we get to keep this until
   * we can break API and remove Group for good.
   */
  if (sibling &&
      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
    {
      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
    }

  clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
コード例 #9
0
ファイル: st-container.c プロジェクト: hosttor/Cinnamon
static void
st_container_lower (ClutterContainer *container,
                    ClutterActor     *actor,
                    ClutterActor     *sibling)
{
  StContainerPrivate *priv = ST_CONTAINER (container)->priv;

  priv->children = g_list_remove (priv->children, actor);

  /* Push to bottom */
  if (!sibling)
    {
      GList *last_item;

      last_item = g_list_first (priv->children);

      if (last_item)
        sibling = last_item->data;

      priv->children = g_list_prepend (priv->children, actor);
    }
  else
    {
      gint pos;

      pos = g_list_index (priv->children, sibling);

      priv->children = g_list_insert (priv->children, actor, pos);
    }

  /* See comment in st_container_raise() for this */
  if (sibling &&
      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
    {
      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
    }

  st_container_update_pseudo_classes (ST_CONTAINER (container));

  if (CLUTTER_ACTOR_IS_VISIBLE (container))
    clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
コード例 #10
0
ファイル: clutter-group.c プロジェクト: spatulasnout/clutter
static void
clutter_group_real_raise (ClutterContainer *container,
                          ClutterActor     *actor,
                          ClutterActor     *sibling)
{
  ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;

  priv->children = g_list_remove (priv->children, actor);

  /* Raise at the top */
  if (!sibling)
    {
      GList *last_item;

      last_item = g_list_last (priv->children);

      if (last_item)
	sibling = last_item->data;

      priv->children = g_list_append (priv->children, actor);
    }
  else
    {
      gint index_ = g_list_index (priv->children, sibling) + 1;

      priv->children = g_list_insert (priv->children, actor, index_);
    }

  /* set Z ordering a value below, this will then call sort
   * as values are equal ordering shouldn't change but Z
   * values will be correct.
   *
   * FIXME: optimise
   */
  if (sibling &&
      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
    {
      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
    }

  clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
コード例 #11
0
ファイル: clutter-group.c プロジェクト: spatulasnout/clutter
static void
clutter_group_real_lower (ClutterContainer *container,
                          ClutterActor     *actor,
                          ClutterActor     *sibling)
{
  ClutterGroup *self = CLUTTER_GROUP (container);
  ClutterGroupPrivate *priv = self->priv;

  priv->children = g_list_remove (priv->children, actor);

  /* Push to bottom */
  if (!sibling)
    {
      GList *last_item;

      last_item = g_list_first (priv->children);

      if (last_item)
	sibling = last_item->data;

      priv->children = g_list_prepend (priv->children, actor);
    }
  else
    {
      gint index_ = g_list_index (priv->children, sibling);

      priv->children = g_list_insert (priv->children, actor, index_);
    }

  /* See comment in group_raise for this */
  if (sibling &&
      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
    {
      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
    }

  clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
コード例 #12
0
ファイル: tweet-overlay.c プロジェクト: ak2consulting/tweet
static void
tweet_overlay_lower (ClutterContainer *container,
                     ClutterActor     *actor,
                     ClutterActor     *sibling)
{
  TweetOverlayPrivate *priv = TWEET_OVERLAY (container)->priv;

  priv->children = g_list_remove (priv->children, actor);

  /* Push to bottom */
  if (!sibling)
    {
      GList *last_item;

      last_item = g_list_first (priv->children);

      if (last_item)
        sibling = last_item->data;

      priv->children = g_list_prepend (priv->children, actor);
    }
  else
    {
      gint pos;

      pos = g_list_index (priv->children, sibling);

      priv->children = g_list_insert (priv->children, actor, pos);
    }

  if (sibling &&
      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
    {
      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
    }
}
コード例 #13
0
void
mnp_clock_area_add_tile (MnpClockArea *area, MnpClockTile *tile)
{

	clutter_actor_set_reactive ((ClutterActor *)tile, TRUE);
	clutter_actor_set_name ((ClutterActor *)tile, "ClockTile");
	clutter_container_add_actor ((ClutterContainer *)clutter_stage_get_default(), (ClutterActor *)tile);
	mx_draggable_set_axis (MX_DRAGGABLE (tile), MX_DRAG_AXIS_Y);
	mx_draggable_enable ((MxDraggable *)tile);
	clutter_actor_set_size ((ClutterActor *)tile, 230, 75);
	clutter_actor_set_depth ((ClutterActor *)tile, area->priv->position);
	area->priv->position += 0.05;
	clutter_actor_reparent ((ClutterActor *)tile, (ClutterActor *)area);
  	clutter_container_child_set (CLUTTER_CONTAINER (area),
                               (ClutterActor *)tile,
                               "expand", FALSE,
			       "y-fill", FALSE,
			       "x-fill", TRUE,
                               NULL);	
	g_ptr_array_add (area->priv->clock_tiles, tile);
	mnp_clock_tile_set_remove_cb (tile, (TileRemoveFunc)mnp_clock_tile_removed, (gpointer)area);

	g_signal_connect (tile, "drag-y-pos", G_CALLBACK(tile_drag_run), area);
}
コード例 #14
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage = NULL;
  ClutterColor  color = { 0x00, 0x00, 0x00, 0xff };
  ClutterActor *button1 = NULL;
  ClutterActor *button2 = NULL;
  ClutterActor *button3 = NULL;
  ClutterActor *button4 = NULL;
  ClutterActor *group[4];
  ClutterGeometry geom = {0, 0, SIZE, SIZE};
  gint i = 0;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  cally_util_a11y_init (&argc, &argv);

  stage = clutter_stage_get_default ();

  clutter_stage_set_color (CLUTTER_STAGE (stage), &color);
  clutter_actor_set_size (stage, WIDTH, HEIGHT);

  button1 = clutter_rectangle_new_with_color (&color1);
  clutter_actor_set_geometry (button1, &geom);

  button2 = clutter_rectangle_new_with_color (&color2);
  geom.x = 2*SIZE;
  geom.y = 0;
  clutter_actor_set_geometry (button2, &geom);

  geom.x = 0;
  geom.y = 2*SIZE;
  button3 = clutter_rectangle_new_with_color (&color3);
  clutter_actor_set_geometry (button3, &geom);
  clutter_actor_set_depth( button3, DEPTH);

  /* a nested hierarchy, to check that the relative positions are
     computed properly */
  geom.x = SIZE/2;
  geom.y = SIZE/2;
  button4 = clutter_rectangle_new_with_color (&color4);
  clutter_actor_set_geometry (button4, &geom);
  clutter_actor_show (button4);

  for (i = 0; i < 4; i++) {
    group[i] = clutter_group_new ();
    clutter_actor_set_geometry (group[i], &geom);

    if (i > 0)
      clutter_group_add (CLUTTER_GROUP (group[i]), group [i - 1]);

    clutter_actor_show_all (group[i]);
  }

  clutter_group_add (CLUTTER_GROUP (stage), button1);
  clutter_group_add (CLUTTER_GROUP (stage), button2);
  clutter_group_add (CLUTTER_GROUP (stage), button3);
  clutter_group_add (CLUTTER_GROUP (stage), group[3]);
  clutter_group_add (CLUTTER_GROUP (group[0]), button4);

  clutter_actor_show_all (stage);

  clutter_main ();

  return 0;
}
コード例 #15
0
void
scene_prismatic_joint (Scene *scene)
{
  ClutterActor     *ground;
  ClutterActor     *group;
  ClutterActor     *prev_hand  = NULL;
  ClutterActor     *first_hand = NULL;
  ClutterActor     *stage;

  stage = clutter_stage_get_default ();

  first_hand = ground = clutter_rectangle_new ();
  clutter_actor_set_size (ground, 500, 120);



  group = clutter_box2d_new ();
  clutter_group_add (CLUTTER_GROUP (stage), group);

  clutter_group_add (CLUTTER_GROUP (group), ground);
  clutter_actor_set_position (ground, clutter_actor_get_width (
                                ground) * -0.3, 568);                             /*
                                                                                    this
                                                                                    is
                                                                                    wrong
                                                                                    */

  add_cage (group, TRUE);

  ground = clutter_rectangle_new ();
  clutter_actor_set_size (ground, 256, 3);
  clutter_actor_set_position (ground, -100, 310);
  clutter_actor_set_rotation (ground, CLUTTER_Z_AXIS, 30, 128, 16, 0);
  clutter_group_add (CLUTTER_GROUP (group), ground);

  clutter_container_child_set (CLUTTER_CONTAINER (group), ground,
                               "mode", CLUTTER_BOX2D_STATIC, NULL);

  ground = clutter_rectangle_new ();
  clutter_actor_set_size (ground, 256, 3);
  clutter_actor_set_position (ground, 200, 200);
  clutter_actor_set_rotation (ground, CLUTTER_Z_AXIS, -30, 0, 0, 0);
  clutter_group_add (CLUTTER_GROUP (group), ground);
  clutter_container_child_set (CLUTTER_CONTAINER (group), ground,
                               "mode", CLUTTER_BOX2D_STATIC, NULL);

  /*add_hand (group, 100, 100);*/
  prev_hand = add_hand (group, 200, 100);

  if(0){
    ClutterVertex anchor1 = {  (0),
                               (0) };
    ClutterVertex anchor2 = {  (0),
                               (0) };
    ClutterVertex axis = {  (100.0),
                            (20.0) };
    clutter_box2d_add_prismatic_joint (CLUTTER_BOX2D (group),
                                       first_hand, prev_hand,
                                       &anchor1, &anchor2,
                                       200.0, 220.0, &axis);
  }

  clutter_actor_set_depth (group, -600);
  clutter_actor_set_position (group, 0, -100);

  clutter_actor_set_reactive (group, TRUE);

  clutter_box2d_set_simulating (CLUTTER_BOX2D (group), simulating);

  scene->group = group;
}