示例#1
0
static gint
sort_z_order (gconstpointer a,
              gconstpointer b)
{
  gint depth_a, depth_b;

  depth_a = clutter_actor_get_depth ((ClutterActor *) a);
  depth_b = clutter_actor_get_depth ((ClutterActor *) b);

  return (depth_a - depth_b);
}
static gint
mx_stack_depth_sort_cb (gconstpointer a,
                        gconstpointer b)
{
  gfloat depth_a = clutter_actor_get_depth ((ClutterActor *)a);
  gfloat depth_b = clutter_actor_get_depth ((ClutterActor *)a);

  if (depth_a < depth_b)
    return -1;
  else if (depth_a > depth_b)
    return 1;
  else
    return 0;
}
示例#3
0
static gint
sort_z_order (gconstpointer a,
              gconstpointer b)
{
  float depth_a, depth_b;

  depth_a = clutter_actor_get_depth (CLUTTER_ACTOR (a));
  depth_b = clutter_actor_get_depth (CLUTTER_ACTOR (b));

  if (depth_a < depth_b)
    return -1;
  if (depth_a > depth_b)
    return 1;
  return 0;
}
示例#4
0
static gint
sort_by_depth (gconstpointer a,
               gconstpointer b)
{
  gfloat depth_a = clutter_actor_get_depth ((ClutterActor *) a);
  gfloat depth_b = clutter_actor_get_depth ((ClutterActor *) b);

  if (depth_a < depth_b)
    return -1;

  if (depth_a > depth_b)
    return 1;

  return 0;
}
static void
mnp_clock_tile_drag_begin (MxDraggable *draggable, gfloat event_x, gfloat event_y, gint event_button, ClutterModifierType  modifiers)
{
	ClutterActor *self = CLUTTER_ACTOR (draggable);
	ClutterActor *stage = clutter_actor_get_stage (self);
	gfloat orig_x, orig_y;
	MnpClockTile *tile = (MnpClockTile *)draggable;
	gfloat width, height;
	MnpClockTilePriv *priv = tile->priv;
	clutter_actor_get_size (self, &width, &height);
	
	g_object_ref (self);

	if (priv->clone)
		clutter_actor_destroy (priv->clone);
	
	priv->clone = clutter_clone_new (self);

	tile->priv->depth = clutter_actor_get_depth (self);
	clutter_actor_get_transformed_position (self, &orig_x, &orig_y);
	//clutter_actor_reparent (self, stage);
	//clutter_actor_set_size (self, width, -1);
	//clutter_actor_raise_top (self);
	//clutter_actor_set_position (self, orig_x, orig_y);
	
	clutter_container_add_actor (CLUTTER_CONTAINER (stage), priv->clone);
	clutter_actor_set_position (priv->clone, orig_x, orig_y);
	clutter_actor_set_size (priv->clone, width, height);
	
	g_object_unref (self);

	clutter_actor_animate (self, CLUTTER_EASE_OUT_CUBIC, 250,
				"opacity", 0,
				NULL);
}
示例#6
0
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));
}
示例#7
0
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));
}
示例#8
0
static gint
mex_shell_sort_depth_order_cb (gconstpointer a,
                               gconstpointer b)
{
  gfloat depth_a, depth_b;

  const MexShellChildData *data_a = a;
  const MexShellChildData *data_b = b;

  depth_a = clutter_actor_get_depth (data_a->child);
  depth_b = clutter_actor_get_depth (data_b->child);

  if (depth_a < depth_b)
    return -1;
  else if (depth_a > depth_b)
    return 1;
  else
    return 0;
}
示例#9
0
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
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
static void
clutter_box_real_add (ClutterContainer *container,
                      ClutterActor     *actor)
{
  ClutterBoxPrivate *priv = CLUTTER_BOX (container)->priv;
  GList *l, *prev = NULL;
  gfloat actor_depth;

  g_object_ref (actor);

  actor_depth = clutter_actor_get_depth (actor);

  /* Find the right place to insert the child so that it will still be
     sorted and the child will be after all of the actors at the same
     depth */
  for (l = priv->children;
       l && (clutter_actor_get_depth (l->data) <= actor_depth);
       l = l->next)
    prev = l;

  /* Insert the node before the found node */
  l = g_list_prepend (l, actor);
  /* Fixup the links */
  if (prev)
    {
      prev->next = l;
      l->prev = prev;
    }
  else
    priv->children = l;

  clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));

  clutter_actor_queue_relayout (actor);

  g_signal_emit_by_name (container, "actor-added", actor);

  g_object_unref (actor);
}
示例#12
0
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));
}
示例#13
0
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));
    }
}