示例#1
0
文件: main.c 项目: skim/lcs-desktop
static int lcs_taskbar (int *argc, char ***argv)
{
	gdk_init (argc, argv);
    lcs_clutter_enable_transparency (TRUE);
    gtk_init (argc, argv);
    if (!clutter_init (argc, argv))
    {
        fprintf (stderr, "error initializing clutter");
        exit (1);
    }
    
    ClutterActor *stage = clutter_stage_new ();
    clutter_actor_set_layout_manager (
                         stage, 
                         clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_START,
                                                 CLUTTER_BIN_ALIGNMENT_START));
    clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);
    clutter_actor_set_background_color (stage, 
                                        clutter_color_new (255, 255, 255, 96));
    ClutterActor *taskbar = lcs_taskbar_new ();    
    clutter_actor_set_margin (taskbar, 
                              lcs_clutter_margin_new_full (4, 4, 4, 4));
    
    clutter_actor_add_child (stage, taskbar);
    g_signal_connect (stage, "destroy", G_CALLBACK (on_stage_destroy), NULL);

	ClutterAction *drag = clutter_drag_action_new ();
	g_signal_connect (drag, 
	                  "drag-motion", 
	                  G_CALLBACK (on_stage_drag_motion), 
	                  NULL);
	clutter_actor_add_action_with_name (stage, "drag", drag);
	
    clutter_actor_show (stage);
    
    long stagexid = lcs_wm_get_stage_xid (CLUTTER_STAGE(stage));
	g_object_set_data (G_OBJECT (stage), "xid", GINT_TO_POINTER (stagexid));
    lcs_wm_xwindow_set_decorated (stagexid, FALSE);
    lcs_wm_xwindow_set_above (stagexid);
	lcs_wm_xwindow_set_dock (stagexid);

        
    clutter_main ();
	return (0);

}
示例#2
0
G_MODULE_EXPORT int
test_paint_wrapper_main (int argc, char *argv[])
{
    ClutterAlpha *alpha;
    ClutterActor *stage;
    ClutterColor  stage_color = { 0x61, 0x64, 0x8c, 0xff };
    SuperOH      *oh;
    gint          i;
    GError       *error;
    ClutterActor *real_hand;

    error = NULL;

#ifdef HAVE_CLUTTER_GLX
    clutter_x11_set_use_argb_visual (TRUE);
#endif

    clutter_init_with_args (&argc, &argv,
                            NULL,
                            super_oh_entries,
                            NULL,
                            &error);
    if (error)
    {
        g_warning ("Unable to initialise Clutter:\n%s",
                   error->message);
        g_error_free (error);

        return EXIT_FAILURE;
    }

    stage = clutter_stage_get_default ();
    clutter_actor_set_size (stage, 800, 600);

    if (use_alpha != 255)
    {
        clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);
        clutter_actor_set_opacity (stage, use_alpha);
    }

    clutter_stage_set_title (CLUTTER_STAGE (stage), "Paint Test");
    clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);

    oh = g_new(SuperOH, 1);
    oh->stage = stage;

    /* Create a timeline to manage animation */
    oh->timeline = clutter_timeline_new (6000);
    clutter_timeline_set_loop (oh->timeline, TRUE);

    /* fire a callback for frame change */
    g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh);

    /* Set up some behaviours to handle scaling  */
    alpha = clutter_alpha_new_with_func (oh->timeline, my_sine_wave, NULL, NULL);

    oh->scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0);
    oh->scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5);

    real_hand = clutter_texture_new_from_file (TESTS_DATADIR
                G_DIR_SEPARATOR_S
                "redhand.png",
                &error);
    if (real_hand == NULL)
    {
        g_error ("image load failed: %s", error->message);
        return EXIT_FAILURE;
    }

    /* create a new group to hold multiple actors in a group */
    oh->group = clutter_group_new();

    oh->hand = g_new (ClutterActor*, n_hands);

    oh->stage_width = clutter_actor_get_width (stage);
    oh->stage_height = clutter_actor_get_height (stage);
    oh->radius = (oh->stage_width + oh->stage_height)
                 / n_hands;

    for (i = 0; i < n_hands; i++)
    {
        gint x, y, w, h;

        if (i == 0)
            oh->hand[i] = real_hand;
        else
            oh->hand[i] = clutter_clone_new (real_hand);

        clutter_actor_set_reactive (oh->hand[i], TRUE);

        clutter_actor_set_size (oh->hand[i], 200, 213);

        /* Place around a circle */
        w = clutter_actor_get_width (oh->hand[i]);
        h = clutter_actor_get_height (oh->hand[i]);

        x = oh->stage_width / 2
            + oh->radius
            * cos (i * G_PI / (n_hands / 2))
            - w / 2;

        y = oh->stage_height / 2
            + oh->radius
            * sin (i * G_PI / (n_hands / 2))
            - h / 2;

        clutter_actor_set_position (oh->hand[i], x, y);

        clutter_actor_move_anchor_point_from_gravity (oh->hand[i],
                CLUTTER_GRAVITY_CENTER);

        g_signal_connect (oh->hand[i], "button-press-event",
                          G_CALLBACK (on_button_press_event),
                          oh);

        /* paint something before each hand */
        g_signal_connect (oh->hand[i],
                          "paint", G_CALLBACK (hand_pre_paint),
                          oh);

        /* paint something after each hand */
        g_signal_connect_after (oh->hand[i],
                                "paint", G_CALLBACK (hand_post_paint),
                                oh);

        /* Add to our group group */
        clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]);

        if (i % 2)
            clutter_behaviour_apply (oh->scaler_1, oh->hand[i]);
        else
            clutter_behaviour_apply (oh->scaler_2, oh->hand[i]);
    }

    oh->paint_guards = g_malloc0 (sizeof (gboolean) * n_hands);

    /* Add the group to the stage */
    clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                                 CLUTTER_ACTOR (oh->group));

    /* Show everying ( and map window ) */
    clutter_actor_show (stage);

    g_signal_connect (stage, "key-release-event",
                      G_CALLBACK (input_cb),
                      oh);

    /* and start it */
    clutter_timeline_start (oh->timeline);

    clutter_main ();

    g_object_unref (oh->scaler_1);
    g_object_unref (oh->scaler_2);
    g_object_unref (oh->timeline);
    g_free (oh->paint_guards);
    g_free (oh->hand);
    g_free (oh);

    return 0;
}
示例#3
0
static gboolean
clutter_stage_gdk_realize (ClutterStageWindow *stage_window)
{
  ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
  ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
  ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
  ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend);
  GdkWindowAttr attributes;
  gboolean cursor_visible;
  gboolean use_alpha;
  gfloat   width, height;

  if (stage_gdk->foreign_window)
    {
      width = gdk_window_get_width (stage_gdk->window);
      height = gdk_window_get_height (stage_gdk->window);
    }
  else
    {
      if (stage_gdk->window != NULL)
        {
          /* complete realizing the stage */
          cairo_rectangle_int_t geometry;

          clutter_stage_gdk_get_geometry (stage_window, &geometry);
          clutter_actor_set_size (CLUTTER_ACTOR (stage_cogl->wrapper),
                                  geometry.width,
                                  geometry.height);

          gdk_window_ensure_native (stage_gdk->window);
          gdk_window_set_events (stage_gdk->window, CLUTTER_STAGE_GDK_EVENT_MASK);

          return TRUE;
        }
      else
        {
          attributes.title = NULL;
          g_object_get (stage_cogl->wrapper,
                        "cursor-visible", &cursor_visible,
                        "title", &attributes.title,
                        "width", &width,
                        "height", &height,
                        "use-alpha", &use_alpha,
                        NULL);

          attributes.width = width;
          attributes.height = height;
          attributes.wclass = GDK_INPUT_OUTPUT;
          attributes.window_type = GDK_WINDOW_TOPLEVEL;
          attributes.event_mask = CLUTTER_STAGE_GDK_EVENT_MASK;

          attributes.cursor = NULL;
          if (!cursor_visible)
            {
              if (stage_gdk->blank_cursor == NULL)
                stage_gdk->blank_cursor = gdk_cursor_new_for_display (backend_gdk->display, GDK_BLANK_CURSOR);

              attributes.cursor = stage_gdk->blank_cursor;
            }

          attributes.visual = NULL;
          if (use_alpha)
            {
              attributes.visual = gdk_screen_get_rgba_visual (backend_gdk->screen);

              if (attributes.visual == NULL)
                clutter_stage_set_use_alpha (stage_cogl->wrapper, FALSE);
            }

          if (attributes.visual == NULL)
            {
             /* This could still be an RGBA visual, although normally it's not */
             attributes.visual = gdk_screen_get_system_visual (backend_gdk->screen);
            }

          stage_gdk->foreign_window = FALSE;
          stage_gdk->window = gdk_window_new (NULL, &attributes,
                                              GDK_WA_TITLE | GDK_WA_CURSOR | GDK_WA_VISUAL);

          g_free (attributes.title);
        }

      clutter_stage_gdk_set_gdk_geometry (stage_gdk);
    }

  gdk_window_ensure_native (stage_gdk->window);

  g_object_set_data (G_OBJECT (stage_gdk->window),
                     "clutter-stage-window", stage_gdk);

  stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,
					    width, height);

#if defined(GDK_WINDOWING_X11) && defined(COGL_HAS_XLIB_SUPPORT)
  if (GDK_IS_X11_WINDOW (stage_gdk->window))
    {
      cogl_x11_onscreen_set_foreign_window_xid (stage_cogl->onscreen,
                                                GDK_WINDOW_XID (stage_gdk->window),
                                                clutter_stage_gdk_update_foreign_event_mask,
                                                stage_gdk);
    }
  else
#endif
#if defined(GDK_WINDOWING_WAYLAND) && defined(COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT)
  if (GDK_IS_WAYLAND_WINDOW (stage_gdk->window))
    {
      cogl_wayland_onscreen_set_foreign_surface (stage_cogl->onscreen,
                                                 gdk_wayland_window_get_wl_surface (stage_gdk->window));
    }
  else
#endif
#if defined(GDK_WINDOWING_WIN32) && defined(COGL_HAS_WIN32_SUPPORT)
  if (GDK_IS_WIN32_WINDOW (stage_gdk->window))
    {
      cogl_win32_onscreen_set_foreign_window (stage_cogl->onscreen,
					      gdk_win32_window_get_handle (stage_gdk->window));
    }
  else
#endif
    {
      g_warning ("Cannot find an appropriate CoglWinsys for a "
		 "GdkWindow of type %s", G_OBJECT_TYPE_NAME (stage_gdk->window));

      cogl_object_unref (stage_cogl->onscreen);
      stage_cogl->onscreen = NULL;

      if (!stage_gdk->foreign_window)
        gdk_window_destroy (stage_gdk->window);

      stage_gdk->window = NULL;

      return FALSE;
    }

  return clutter_stage_window_parent_iface->realize (stage_window);
}
示例#4
0
int
main (int argc, char *argv[])
{
  ClutterActor *video;

  /* So we can fade out at the end. */
  clutter_x11_set_use_argb_visual (TRUE);

  if (clutter_gst_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return EXIT_FAILURE;

  if (argc < 2)
    {
      g_print ("Usage: %s [OPTIONS] <video file>\n", argv[0]);
      return EXIT_FAILURE;
    }

  if (!clutter_color_from_string (&bg_color, BG_COLOR))
    {
      g_warning ("Invalid BG_COLOR");
      exit (1);
    }

  stage = clutter_stage_new ();

  /* Clutter's full-screening code does not allow us to
   * set both that and _NET_WM_STATE_ABOVE, so do the state
   * management ourselves for now. */
#if 0
  clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE);
#endif

  /* Clutter will set maximum size restrictions (meaning not
   * full screen) unless I set this. */
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);

  clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);

  clutter_actor_set_background_color (stage, &bg_color);
  clutter_actor_set_layout_manager (stage,
                                    clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FIXED,
                                                            CLUTTER_BIN_ALIGNMENT_FIXED));

  clutter_actor_realize (stage);
  set_above_and_fullscreen ();

  video = clutter_gst_video_texture_new ();
  clutter_actor_set_x_expand (video, TRUE);
  clutter_actor_set_y_expand (video, TRUE);
  clutter_actor_set_x_align (video, CLUTTER_ACTOR_ALIGN_CENTER);
  clutter_actor_set_y_align (video, CLUTTER_ACTOR_ALIGN_CENTER);
  set_idle_material (CLUTTER_GST_VIDEO_TEXTURE (video));

  g_signal_connect (video,
                    "eos",
                    G_CALLBACK (on_video_texture_eos),
                    NULL);

  g_signal_connect (stage,
                    "destroy",
                    G_CALLBACK (clutter_main_quit),
                    NULL);

  clutter_media_set_filename (CLUTTER_MEDIA (video), argv[1]);
  clutter_stage_hide_cursor (CLUTTER_STAGE (stage));

  clutter_actor_add_child (stage, video);

  g_signal_connect (stage, "key-press-event", G_CALLBACK (key_press_cb), NULL);

  clutter_media_set_playing (CLUTTER_MEDIA (video), TRUE);
  clutter_actor_show (stage);
  clutter_main ();

  return EXIT_SUCCESS;
}
示例#5
0
int
main (int argc, char *argv[])
{
	ClutterActor *stage, *box, *bg, *bg2, *inset, *labelContainer,
	             *contentContainer, *labelbg, *fixed, *upper, *lower, *lowerInner;
	ClutterLayoutManager *layout, *labelContainer_l, *layoutFixed;
	ClutterTimeline *timeline;
	ClutterContent *canvas, *canvas1;

	ClutterColor color_with_trans = {0,0,0,0};
	clutter_x11_set_use_argb_visual (TRUE);

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

	/* prepare the stage */
	stage = clutter_stage_new ();
	clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);
	clutter_stage_set_color (CLUTTER_STAGE (stage), &color_with_trans);
	clutter_stage_set_title (CLUTTER_STAGE (stage), "IPLocation Database");
	clutter_actor_set_background_color (stage, CLUTTER_COLOR_WHITE);
	clutter_actor_set_size (stage, 648, 246);
	clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
	clutter_actor_show (stage);
	g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

	layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
			CLUTTER_BIN_ALIGNMENT_CENTER);

	box = clutter_actor_new ();
	clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0));
	clutter_actor_set_background_color (box, CLUTTER_COLOR_WHITE);
	clutter_actor_set_layout_manager (box, layout);
	clutter_actor_add_constraint (box, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 1));
	clutter_actor_set_name (box, "box");
	clutter_actor_add_child (stage, box);


	bg = clutter_actor_new ();
	//clutter_actor_set_background_color (bg, clutter_color_new (50, 50, 50, 255));
	clutter_actor_set_name (bg, "background");
	clutter_actor_set_reactive (bg, TRUE);
	//clutter_actor_set_x_expand (bg, TRUE);
	//clutter_actor_set_y_expand (bg, TRUE);
	clutter_actor_set_x_align (bg, CLUTTER_ACTOR_ALIGN_END);
	clutter_actor_set_y_align (bg, CLUTTER_ACTOR_ALIGN_FILL);
	canvas1 = clutter_canvas_new ();
	clutter_canvas_set_size (CLUTTER_CANVAS (canvas1), 300, 300);
	clutter_actor_set_content (bg, canvas1);
	/*clutter_actor_set_content_scaling_filters (bg2,
		 CLUTTER_SCALING_FILTER_TRILINEAR,
		 CLUTTER_SCALING_FILTER_LINEAR);*/
	g_object_unref (canvas1);
	clutter_actor_add_child (box, bg);


	bg2 = clutter_actor_new ();
	//clutter_actor_set_background_color (bg2, clutter_color_new (0, 100, 100, 255*.5));
	clutter_actor_set_name (bg2, "background");
	clutter_actor_set_reactive (bg2, TRUE);
	clutter_actor_set_size (bg2, 0, 0);
	//clutter_actor_set_x_expand (bg2, TRUE);
	//clutter_actor_set_y_expand (bg2, TRUE);
	clutter_actor_set_x_align (bg2, CLUTTER_ACTOR_ALIGN_END);
	clutter_actor_set_y_align (bg2, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_set_clip_to_allocation(bg2, TRUE);
	clutter_actor_add_child (box, bg2);
	clutter_actor_set_layout_manager (bg2, clutter_box_layout_new ());
	canvas = clutter_canvas_new ();
	clutter_canvas_set_size (CLUTTER_CANVAS (canvas), 300, 300);
	clutter_actor_set_content (bg2, canvas);
	/*clutter_actor_set_content_scaling_filters (bg2,
		 CLUTTER_SCALING_FILTER_TRILINEAR,
		 CLUTTER_SCALING_FILTER_LINEAR);*/
	g_object_unref (canvas);


	inset = clutter_actor_new ();
	//clutter_actor_set_background_color (inset, clutter_color_new (255, 0, 0, 255));
	clutter_actor_set_name (inset, "inset");
	clutter_actor_set_reactive (inset, TRUE);


	clutter_actor_set_margin_top (inset, 18);
	clutter_actor_set_margin_right (inset, 18);
	clutter_actor_set_margin_bottom (inset, 18);
	clutter_actor_set_margin_left (inset, 48);
	//clutter_actor_set_x_expand (inset, TRUE);
	//clutter_actor_set_y_expand (inset, TRUE);
	clutter_actor_set_x_align (inset, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_set_y_align (inset, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_set_clip_to_allocation(inset, TRUE);
	clutter_actor_add_child (bg2, inset);


	layout = clutter_box_layout_new ();
	clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (layout),
	                                    TRUE);
	clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 5);
	clutter_actor_set_layout_manager (inset, layout);


	labelContainer = clutter_actor_new ();
	clutter_actor_set_size (labelContainer, 0, 35);
	//clutter_actor_set_background_color (labelContainer, clutter_color_new (34, 134, 158, 255));
	clutter_actor_set_name (labelContainer, "labelContainer");
	clutter_actor_set_reactive (labelContainer, TRUE);
	//clutter_actor_set_x_expand (labelContainer, TRUE);
	//clutter_actor_set_y_expand (labelContainer, TRUE);
	clutter_actor_add_child (inset, labelContainer);

	labelContainer_l = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
			CLUTTER_BIN_ALIGNMENT_CENTER);
	clutter_actor_set_layout_manager (labelContainer, labelContainer_l);


	labelbg = clutter_actor_new ();
	clutter_actor_set_background_color (labelbg, clutter_color_new (34, 134, 158, 255));
	clutter_actor_set_name (labelbg, "labelbg");
	//clutter_actor_set_x_expand (labelbg, TRUE);
	clutter_actor_set_size (labelbg, 0, 35);
	clutter_actor_set_x_align (labelbg, CLUTTER_ACTOR_ALIGN_START);
	clutter_actor_set_y_align (labelbg, CLUTTER_ACTOR_ALIGN_FILL);
	clutter_actor_add_child (labelContainer, labelbg);


	contentContainer = clutter_actor_new ();
	clutter_actor_set_size (contentContainer, 0, 0);

	clutter_actor_set_background_color (contentContainer, clutter_color_new (0.290196*255, 0.427451*255, 0.462745*255, 255));
	clutter_actor_set_name (contentContainer, "labelContainer");
	//clutter_actor_set_x_expand (contentContainer, TRUE);
	//clutter_actor_set_y_expand (contentContainer, TRUE);
	clutter_actor_set_layout_manager (contentContainer, clutter_fixed_layout_new ());
	clutter_actor_add_child (inset, contentContainer);

	fixed = clutter_actor_new ();
	clutter_actor_set_background_color (fixed, clutter_color_new (9, 53, 71, 255));
	clutter_actor_set_name (fixed, "fixed");
	clutter_actor_set_size (fixed, 582, 210-40);
	clutter_actor_set_position (fixed, 582, 0);
	layoutFixed = clutter_box_layout_new ();
	clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (layoutFixed),
		                                TRUE);
	clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layoutFixed), 8);
	clutter_actor_set_layout_manager (fixed, layoutFixed);
	clutter_actor_add_child (contentContainer, fixed);


	//------------------------------------------------------------------------//

	lower = clutter_actor_new ();
	clutter_actor_set_size (lower, 0, 0);
	clutter_actor_set_name (lower, "lower");
	//clutter_actor_set_x_expand (lower, TRUE);
	//clutter_actor_set_y_expand (lower, TRUE);
	clutter_actor_set_margin_right (lower, 8);
	clutter_actor_set_margin_top (lower, 8);
	clutter_actor_set_margin_left (lower, 8);
	clutter_actor_set_layout_manager (lower, clutter_fixed_layout_new ());
	clutter_actor_set_clip_to_allocation(lower, TRUE);
	clutter_actor_add_child (fixed, lower);

	lowerInner = clutter_actor_new ();
	clutter_actor_set_background_color (lowerInner, clutter_color_new (255, 255, 255, 30));
	clutter_actor_set_name (lowerInner, "fixed");
	clutter_actor_set_size (lowerInner, 566, 113);
	clutter_actor_set_position (lowerInner, 566, 0);
	clutter_actor_add_child (lower, lowerInner);


	upper = clutter_actor_new ();
	clutter_actor_set_size (upper, 0, 33);
	clutter_actor_set_name (upper, "upper");
	clutter_actor_set_x_expand (upper, TRUE);
	//clutter_actor_set_y_expand (upper, TRUE);
	clutter_actor_set_margin_bottom (upper, 8);
	clutter_actor_set_margin_right (upper, 8);
	clutter_actor_set_margin_left (upper, 8);
	//clutter_actor_set_layout_manager (upper, clutter_fixed_layout_new ());
	clutter_actor_add_child (fixed, upper);


	timeline = clutter_timeline_new (57/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "first", (40-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "second", (46-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "third", (51-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "fourth", (52-35)/24.*1000);
	clutter_timeline_add_marker_at_time(timeline, "fifth", (58-35)/24.*1000);

	g_signal_connect (timeline, "marker-reached::first", G_CALLBACK (plate1anim), bg);
	g_signal_connect (timeline, "marker-reached::second", G_CALLBACK (plate2anim), bg2);
	g_signal_connect (timeline, "marker-reached::third", G_CALLBACK (plate3anim), labelbg);
	g_signal_connect (timeline, "marker-reached::fourth", G_CALLBACK (plate4anim), fixed);
	g_signal_connect (timeline, "marker-reached::fifth", G_CALLBACK (plate5anim), lowerInner);
	g_signal_connect (canvas1, "draw", G_CALLBACK (draw_1), NULL);
	g_signal_connect (bg, "paint", G_CALLBACK (on_actor_resize), canvas);
	g_signal_connect (canvas, "draw", G_CALLBACK (draw), NULL);
	g_signal_connect (bg2, "paint", G_CALLBACK (on_actor_resize), canvas);


	clutter_content_invalidate (canvas);

	clutter_timeline_start (timeline);
	clutter_main ();

	return (EXIT_SUCCESS);
}
static void
set_up_stage (CalibArea *calib_area, ClutterActor *stage)
{
  ClutterPoint anchor;
  ClutterColor color;
  ClutterContent *success_content;
  gfloat height;
  gchar *markup;

  calib_area->stage = stage;
  calib_area->action_layer = clutter_actor_new ();
  calib_area->clock = cc_clock_actor_new ();
  calib_area->target = cc_target_actor_new ();
  calib_area->text_title_holder = clutter_actor_new ();
  calib_area->helper_text_title = clutter_text_new ();
  calib_area->text_body_holder = clutter_actor_new ();
  calib_area->helper_text_body = clutter_text_new ();
  calib_area->error_text = clutter_text_new ();
  calib_area->success_image = clutter_actor_new ();

  clutter_stage_set_use_alpha (CLUTTER_STAGE (stage), TRUE);

  clutter_actor_hide (calib_area->target);

  /* bind the action layer's geometry to the stage's */
  clutter_actor_add_constraint (calib_area->action_layer,
                                clutter_bind_constraint_new (stage,
                                                             CLUTTER_BIND_SIZE,
                                                             0));
  clutter_actor_add_child (stage, calib_area->action_layer);

  g_signal_connect (stage,
                    "allocation-changed",
                    G_CALLBACK (on_allocation_changed),
                    calib_area);

  clutter_color_from_string (&color, "#000");
  color.alpha = WINDOW_OPACITY * 255;
  clutter_actor_set_background_color (stage, &color);

  clutter_actor_add_child (calib_area->action_layer, calib_area->clock);
  clutter_actor_add_constraint (calib_area->clock,
                                clutter_align_constraint_new (stage,
                                                              CLUTTER_ALIGN_BOTH,
                                                              0.5));

  clutter_actor_add_child (calib_area->action_layer, calib_area->target);

  /* set the helper text */
  anchor.x =  0;
  g_object_set (calib_area->text_title_holder, "pivot-point", &anchor, NULL);

  clutter_actor_add_child (calib_area->action_layer,
                           calib_area->text_title_holder);
  clutter_actor_add_child (calib_area->text_title_holder,
                           calib_area->helper_text_title);
  height = clutter_actor_get_height (calib_area->clock);
  clutter_actor_add_constraint (calib_area->text_title_holder,
                                clutter_bind_constraint_new (calib_area->clock,
                                                             CLUTTER_BIND_Y,
                                                             height * 1.5));
  clutter_actor_add_constraint (calib_area->text_title_holder,
                                clutter_align_constraint_new (stage,
                                                              CLUTTER_ALIGN_X_AXIS,
                                                              .5));

  clutter_text_set_line_alignment (CLUTTER_TEXT (calib_area->helper_text_title),
                                   PANGO_ALIGN_CENTER);

  color.red = COLOR_GRAY;
  color.green = COLOR_GRAY;
  color.blue = COLOR_GRAY;
  color.alpha = 255;

  markup = g_strdup_printf ("<big><b>%s</b></big>",
                            _(HELP_TEXT_TITLE));
  clutter_text_set_markup (CLUTTER_TEXT (calib_area->helper_text_title), markup);
  clutter_text_set_color (CLUTTER_TEXT (calib_area->helper_text_title), &color);
  g_free (markup);

  g_object_set (calib_area->text_body_holder, "pivot-point", &anchor, NULL);

  clutter_actor_add_child (calib_area->action_layer,
                           calib_area->text_body_holder);
  clutter_actor_add_child (calib_area->text_body_holder,
                           calib_area->helper_text_body);
  height = clutter_actor_get_height (calib_area->helper_text_title);
  clutter_actor_add_constraint (calib_area->text_body_holder,
                                clutter_bind_constraint_new (calib_area->text_title_holder,
                                                             CLUTTER_BIND_Y,
                                                             height * 1.2));
  clutter_actor_add_constraint (calib_area->text_body_holder,
                                clutter_align_constraint_new (stage,
                                                              CLUTTER_ALIGN_X_AXIS,
                                                              .5));

  clutter_text_set_line_alignment (CLUTTER_TEXT (calib_area->helper_text_body),
                                   PANGO_ALIGN_CENTER);
  markup = g_strdup_printf ("<span foreground=\"white\"><big>%s</big></span>",
                            _(HELP_TEXT_MAIN));
  clutter_text_set_markup (CLUTTER_TEXT (calib_area->helper_text_body), markup);
  g_free (markup);

  /* set the error text */
  g_object_set (calib_area->error_text, "pivot-point", &anchor, NULL);

  clutter_actor_add_child (calib_area->action_layer, calib_area->error_text);
  height = clutter_actor_get_height (calib_area->helper_text_body);
  clutter_actor_add_constraint (calib_area->error_text,
                                clutter_bind_constraint_new (calib_area->text_title_holder,
                                                             CLUTTER_BIND_Y,
                                                             height * 3));
  clutter_actor_add_constraint (calib_area->error_text,
                                clutter_align_constraint_new (stage,
                                                              CLUTTER_ALIGN_X_AXIS,
                                                              .5));

  clutter_text_set_line_alignment (CLUTTER_TEXT (calib_area->error_text),
                                   PANGO_ALIGN_CENTER);
  markup = g_strdup_printf ("<span foreground=\"white\"><big>"
                            "<b>%s</b></big></span>",
                            ERROR_MESSAGE);
  clutter_text_set_markup (CLUTTER_TEXT (calib_area->error_text), markup);
  g_free (markup);

  clutter_actor_hide (calib_area->error_text);

  /* configure success image */
  success_content = clutter_image_new ();
  clutter_actor_set_content (calib_area->success_image,
                             success_content);
  g_object_unref (success_content);
  clutter_actor_add_child (stage, calib_area->success_image);
  clutter_actor_add_constraint (calib_area->success_image,
                                clutter_align_constraint_new (stage,
                                                              CLUTTER_ALIGN_BOTH,
                                                              .5));

  /* animate clock */
  calib_area->clock_timeline = clutter_property_transition_new ("angle");
  clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (calib_area->clock_timeline),
                                      CLUTTER_LINEAR);
  clutter_timeline_set_duration (CLUTTER_TIMELINE (calib_area->clock_timeline),
                                 MAX_TIME);
  clutter_transition_set_animatable (calib_area->clock_timeline,
                                     CLUTTER_ANIMATABLE (calib_area->clock));
  clutter_transition_set_from (calib_area->clock_timeline, G_TYPE_FLOAT, .0);
  clutter_transition_set_to (calib_area->clock_timeline, G_TYPE_FLOAT, 360.0);
  clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (calib_area->clock_timeline),
                                     -1);
  clutter_timeline_start (CLUTTER_TIMELINE (calib_area->clock_timeline));
  g_signal_connect (CLUTTER_TIMELINE (calib_area->clock_timeline),
                    "completed",
                    G_CALLBACK (on_timeout),
                    calib_area);

  g_signal_connect (stage,
                    "button-press-event",
                    G_CALLBACK (on_button_press_event),
                    calib_area);
  g_signal_connect (stage,
                    "key-release-event",
                    G_CALLBACK (on_key_release_event),
                    calib_area);
}