#include <stdlib.h>
#include <clutter/clutter.h>

static ClutterActor *raise[2];
static gboolean raise_no = 0;

static gboolean
raise_top (gpointer ignored)
{
g_print("appchange raise_no=%d\n",raise_no);
  g_print("raise[0]=%d raise[1]=%d",raise[0], raise[1]);
  clutter_actor_raise_top (raise[raise_no]);
  raise_no = !raise_no;
  return TRUE;
}


gint
main (int argc, char *argv[])
{
  ClutterActor     *stage;
  ClutterActor      *hand, *rect;
  ClutterColor      stage_color = { 0xff, 0x00, 0x00, 0xff };
  ClutterColor      rect_color  = { 0, 0, 0xff,0xff };
  GError           *error;

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
//  clutter_stage_set_use_fog (CLUTTER_STAGE (stage), TRUE);
//  clutter_stage_set_fog (CLUTTER_STAGE (stage), 1.0, 10, -50);
//  clutter_actor_set_size(stage,600,600);

  error = NULL;
  hand = clutter_texture_new_from_file ("redhand.png", &error);
  if (error)
    g_error ("Unable to load redhand.png: %s", error->message);
  clutter_actor_set_position (hand, 20, 20);
  clutter_actor_set_size (hand, 100,140);
  clutter_actor_show (hand);

  rect = clutter_rectangle_new_with_color (&rect_color);
  clutter_actor_set_position (rect, 80,100);
  clutter_actor_set_size (rect,100 ,140);
  clutter_actor_show (rect);

  clutter_container_add (CLUTTER_CONTAINER (stage), hand, rect, NULL);
  clutter_actor_show (stage);
  raise[1] = rect;
  raise[0] = hand;
  g_print("rect=%d hand=%d",rect, hand);
  g_timeout_add (3000, raise_top, NULL);

  clutter_main ();

  //g_object_unref (d_behave);
  //g_object_unref (timeline);

  return EXIT_SUCCESS;
}
