tests: Stop using ClutterContainer

clutter_container_{add,remove}_{,actor} have been deprecated for a
decade, using them rather than ClutterActor's API in tests is a tad
silly

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3377>
This commit is contained in:
Zander Brown 2023-11-07 08:15:58 +00:00 committed by Marge Bot
parent 3184986897
commit 7ae7beaa94
36 changed files with 154 additions and 202 deletions

View File

@ -76,14 +76,14 @@ main (int argc, char *argv[])
clutter_actor_set_size (group[i], SIZE, SIZE);
if (i > 0)
clutter_container_add_actor (CLUTTER_CONTAINER (group[i]), group [i - 1]);
clutter_actor_add_child (group[i], group [i - 1]);
}
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button1);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button2);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button3);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group[3]);
clutter_container_add_actor (CLUTTER_CONTAINER (group[0]), button4);
clutter_actor_add_child (stage, button1);
clutter_actor_add_child (stage, button2);
clutter_actor_add_child (stage, button3);
clutter_actor_add_child (stage, group[3]);
clutter_actor_add_child (group[0], button4);
clutter_actor_show (stage);

View File

@ -155,8 +155,8 @@ _create_button (const gchar *text)
label = clutter_text_new_full ("Sans Bold 32px",
text,
CLUTTER_COLOR_Black);
clutter_container_add_actor (CLUTTER_CONTAINER (button), rectangle);
clutter_container_add_actor (CLUTTER_CONTAINER (button), label);
clutter_actor_add_child (button, rectangle);
clutter_actor_add_child (button, label);
clutter_actor_set_reactive (button, TRUE);
return button;
@ -175,7 +175,7 @@ make_ui (ClutterActor *stage)
text_actor = clutter_text_new_full ("Sans Bold 32px",
"Lorem ipsum dolor sit amet",
CLUTTER_COLOR_Red);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_actor);
clutter_actor_add_child (stage, text_actor);
/* text_editable */
text_editable_actor = clutter_text_new_full ("Sans Bold 32px",
@ -192,7 +192,7 @@ make_ui (ClutterActor *stage)
clutter_actor_grab_key_focus (text_editable_actor);
clutter_actor_set_reactive (text_editable_actor, TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_editable_actor);
clutter_actor_add_child (stage, text_editable_actor);
g_signal_connect (text_editable_actor, "activate",
G_CALLBACK (activate_cb), NULL);
@ -203,7 +203,7 @@ make_ui (ClutterActor *stage)
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (set_text_press_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_child (stage, button);
button = _create_button ("Delete");
clutter_actor_set_position (button, 100, 250);
@ -211,7 +211,7 @@ make_ui (ClutterActor *stage)
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (delete_text_press_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_child (stage, button);
button = _create_button ("Insert");
clutter_actor_set_position (button, 100, 300);
@ -219,7 +219,7 @@ make_ui (ClutterActor *stage)
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (insert_text_press_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_child (stage, button);
button = _create_button ("Activate/Deactivate");
clutter_actor_set_position (button, 100, 350);
@ -227,7 +227,7 @@ make_ui (ClutterActor *stage)
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (activate_deactivate_press_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_child (stage, button);
button = _create_button ("Cursor position");
clutter_actor_set_position (button, 100, 450);
@ -235,7 +235,7 @@ make_ui (ClutterActor *stage)
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (print_cursor_position_press_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_child (stage, button);
}

View File

@ -124,9 +124,9 @@ make_ui (ClutterActor *stage)
clutter_actor_set_position (rectangle, 150, editable_geom_y);
clutter_actor_set_size (rectangle, 500, 75);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), editable);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle);
clutter_actor_add_child (stage, label);
clutter_actor_add_child (stage, editable);
clutter_actor_add_child (stage, rectangle);
label_geom_y += HEIGHT_STEP;
editable_geom_y += HEIGHT_STEP;

View File

@ -187,7 +187,7 @@ make_ui (ClutterActor *stage)
&color_text);
clutter_text_set_markup (CLUTTER_TEXT(text_actor),
"<span fgcolor=\"#FFFF00\" bgcolor=\"#00FF00\"><s>Lorem ipsum dolor sit amet</s></span>");
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_actor);
clutter_actor_add_child (stage, text_actor);
dump_actor_default_atk_attributes (text_actor);
/* text_editable */
@ -204,7 +204,7 @@ make_ui (ClutterActor *stage)
clutter_actor_set_reactive (text_editable_actor, TRUE);
dump_actor_default_atk_attributes (text_editable_actor);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), text_editable_actor);
clutter_actor_add_child (stage, text_editable_actor);
/* test button */
button = clutter_actor_new ();
@ -215,14 +215,14 @@ make_ui (ClutterActor *stage)
label = clutter_text_new_full ("Sans Bold 32px",
"Test", &color_label);
clutter_actor_set_position (button, 100, 200);
clutter_container_add_actor (CLUTTER_CONTAINER (button), rectangle);
clutter_container_add_actor (CLUTTER_CONTAINER (button), label);
clutter_actor_add_child (button, rectangle);
clutter_actor_add_child (button, label);
clutter_actor_set_reactive (button, TRUE);
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (button_press_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_child (stage, button);
}
int

View File

@ -72,11 +72,11 @@ make_ui (ClutterActor *stage)
full_entry = clutter_actor_new ();
clutter_actor_set_position (full_entry, 0, 50);
clutter_actor_set_size (full_entry, 100, 75);
clutter_container_add_actor (CLUTTER_CONTAINER (full_entry), label);
clutter_container_add_actor (CLUTTER_CONTAINER (full_entry), editable);
clutter_container_add_actor (CLUTTER_CONTAINER (full_entry), rectangle);
clutter_actor_add_child (full_entry, label);
clutter_actor_add_child (full_entry, editable);
clutter_actor_add_child (full_entry, rectangle);
clutter_actor_set_scale (full_entry, 2, 1);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), full_entry);
clutter_actor_add_child (stage, full_entry);
/* Cloning! */
cloned_entry = clutter_clone_new (full_entry);
@ -84,7 +84,7 @@ make_ui (ClutterActor *stage)
clutter_actor_set_scale (cloned_entry, 1, 2);
clutter_actor_set_reactive (cloned_entry, TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), cloned_entry);
clutter_actor_add_child (stage, cloned_entry);
}
int

View File

@ -3,12 +3,8 @@
#include "tests/clutter-test-utils.h"
#define TEST_TYPE_DESTROY (test_destroy_get_type ())
#define TEST_DESTROY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_DESTROY, TestDestroy))
#define TEST_IS_DESTROY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_DESTROY))
typedef struct _TestDestroy TestDestroy;
typedef struct _TestDestroyClass TestDestroyClass;
#define TEST_TYPE_DESTROY (test_destroy_get_type ())
G_DECLARE_FINAL_TYPE (TestDestroy, test_destroy, TEST, DESTROY, ClutterActor)
struct _TestDestroy
{
@ -20,64 +16,17 @@ struct _TestDestroy
GList *children;
};
struct _TestDestroyClass
{
ClutterActorClass parent_class;
};
static void clutter_container_init (ClutterContainerIface *iface);
GType test_destroy_get_type (void);
G_DEFINE_TYPE_WITH_CODE (TestDestroy, test_destroy, CLUTTER_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
clutter_container_init));
static void
test_destroy_add (ClutterContainer *container,
ClutterActor *actor)
{
TestDestroy *self = TEST_DESTROY (container);
if (!g_test_quiet ())
g_print ("Adding '%s' (type:%s)\n",
clutter_actor_get_name (actor),
G_OBJECT_TYPE_NAME (actor));
self->children = g_list_prepend (self->children, actor);
clutter_actor_add_child (CLUTTER_ACTOR (container), actor);
}
static void
test_destroy_remove (ClutterContainer *container,
ClutterActor *actor)
{
TestDestroy *self = TEST_DESTROY (container);
if (!g_test_quiet ())
g_print ("Removing '%s' (type:%s)\n",
clutter_actor_get_name (actor),
G_OBJECT_TYPE_NAME (actor));
g_assert_true (g_list_find (self->children, actor));
self->children = g_list_remove (self->children, actor);
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
}
static void
clutter_container_init (ClutterContainerIface *iface)
{
iface->add = test_destroy_add;
iface->remove = test_destroy_remove;
}
G_DEFINE_TYPE (TestDestroy, test_destroy, CLUTTER_TYPE_ACTOR)
static void
test_destroy_destroy (ClutterActor *self)
{
TestDestroy *test = TEST_DESTROY (self);
GList *children;
g_assert_cmpuint (g_list_length (test->children), ==, 3);
children = clutter_actor_get_children (self);
g_assert_cmpuint (g_list_length (children), ==, 3);
g_list_free (children);
if (test->bg != NULL)
{
@ -101,12 +50,16 @@ test_destroy_destroy (ClutterActor *self)
test->label = NULL;
}
g_assert_cmpuint (g_list_length (test->children), ==, 1);
children = clutter_actor_get_children (self);
g_assert_cmpuint (g_list_length (children), ==, 1);
g_list_free (children);
if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
g_assert_null (test->children);
children = clutter_actor_get_children (self);
g_assert_null (children);
g_list_free (children);
}
static void
@ -121,11 +74,11 @@ static void
test_destroy_init (TestDestroy *self)
{
self->bg = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (self), self->bg);
clutter_actor_add_child (CLUTTER_ACTOR (self), self->bg);
clutter_actor_set_name (self->bg, "Background");
self->label = clutter_text_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (self), self->label);
clutter_actor_add_child (CLUTTER_ACTOR (self), self->label);
clutter_actor_set_name (self->label, "Label");
}
@ -178,7 +131,7 @@ actor_destruction (void)
g_print ("Adding external child...\n");
clutter_actor_set_name (child, "Child");
clutter_container_add_actor (CLUTTER_CONTAINER (test), child);
clutter_actor_add_child (test, child);
g_signal_connect (child, "parent-set", G_CALLBACK (on_parent_set),
&parent_set_called);
g_signal_connect (child, "notify", G_CALLBACK (on_notify), &property_changed);

View File

@ -91,7 +91,7 @@ opacity_paint (void)
group1 = clutter_actor_new ();
clutter_actor_set_opacity (group1, 128);
clutter_container_add (CLUTTER_CONTAINER (stage), group1, NULL);
clutter_actor_add_child (stage, group1);
clutter_actor_set_position (group1, 10, 30);
clutter_actor_show (group1);
@ -103,7 +103,7 @@ opacity_paint (void)
clutter_text_get_color (CLUTTER_TEXT (label), &color_check);
g_assert (color_check.alpha == label_color.alpha);
clutter_container_add (CLUTTER_CONTAINER (group1), label, NULL);
clutter_actor_add_child (group1, label);
if (!g_test_quiet ())
g_print ("label 50%% + group 50%%.get_color()/2\n");
@ -117,7 +117,7 @@ opacity_paint (void)
clutter_actor_destroy (label);
group2 = clutter_actor_new ();
clutter_container_add (CLUTTER_CONTAINER (group1), group2, NULL);
clutter_actor_add_child (group1, group2);
clutter_actor_set_position (group2, 10, 60);
rect = clutter_actor_new ();
@ -129,7 +129,7 @@ opacity_paint (void)
clutter_actor_get_background_color (rect, &color_check);
g_assert (color_check.alpha == rect_color.alpha);
clutter_container_add (CLUTTER_CONTAINER (group2), rect, NULL);
clutter_actor_add_child (group2, rect);
if (!g_test_quiet ())
g_print ("rect 100%% + group 100%% + group 50%%.get_color()/2\n");

View File

@ -263,22 +263,22 @@ actor_shader_effect (void)
stage = clutter_test_get_stage ();
rect = make_actor (foo_old_shader_effect_get_type ());
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
actors = g_list_prepend (actors, rect);
rect = make_actor (foo_new_shader_effect_get_type ());
clutter_actor_set_x (rect, 100);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
actors = g_list_prepend (actors, rect);
rect = make_actor (foo_another_new_shader_effect_get_type ());
clutter_actor_set_x (rect, 200);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
actors = g_list_prepend (actors, rect);
rect = make_actor (foo_new_shader_effect_get_type ());
clutter_actor_set_x (rect, 300);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
actors = g_list_prepend (actors, rect);
clutter_actor_show (stage);

View File

@ -286,7 +286,7 @@ cally_text (void)
data.label = clutter_text_new_with_text (TEST_FONT, "Lorem ipsum dolor sit amet");
clutter_container_add (CLUTTER_CONTAINER (data.stage), data.label, NULL);
clutter_actor_add_child (data.stage, data.label);
data.offset = 6;
data.extents_x = 64;
data.extents_y = 99;
@ -304,7 +304,7 @@ cally_text (void)
data1.label = clutter_text_new_with_text (TEST_FONT, "");
clutter_text_set_markup (CLUTTER_TEXT(data1.label), "<span fgcolor=\"#FFFF00\" bgcolor=\"#00FF00\"><s>Lorem ipsum dolor sit amet</s></span>");
clutter_container_add (CLUTTER_CONTAINER (data1.stage), data1.label, NULL);
clutter_actor_add_child (data1.stage, data1.label);
data1.offset = 10;
data1.extents_x = 90;
data1.extents_y = 199;

View File

@ -273,7 +273,7 @@ text_cache (void)
g_signal_connect (data.stage, "paint", G_CALLBACK (on_paint), &data);
clutter_container_add (CLUTTER_CONTAINER (data.stage), data.label, NULL);
clutter_actor_add_child (data.stage, data.label);
clutter_actor_show (data.stage);

View File

@ -46,7 +46,7 @@ create_source (void)
clutter_actor_set_position (rect,
DIVISION_WIDTH * x,
DIVISION_HEIGHT * y);
clutter_container_add (CLUTTER_CONTAINER (group), rect, NULL);
clutter_actor_add_child (group, rect);
}
return group;
@ -173,11 +173,11 @@ texture_fbo (TestConformSimpleFixture *fixture,
/* Onscreen source with clone next to it */
actor = create_source ();
clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
clutter_actor_add_child (state.stage, actor);
clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE);
actor = clutter_texture_new_from_actor (actor);
clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
clutter_actor_add_child (state.stage, actor);
ypos++;
/* Offscreen source with clone */
@ -185,24 +185,24 @@ texture_fbo (TestConformSimpleFixture *fixture,
actor = create_source ();
actor = clutter_texture_new_from_actor (actor);
clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
clutter_actor_add_child (state.stage, actor);
#endif
ypos++;
/* Source clipped to the top left division */
actor = create_source ();
clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
clutter_actor_add_child (state.stage, actor);
clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE);
clutter_actor_set_clip (actor, 0, 0, DIVISION_WIDTH, DIVISION_HEIGHT);
actor = clutter_texture_new_from_actor (actor);
clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
clutter_actor_add_child (state.stage, actor);
ypos++;
/* Source clipped to everything but top left division using a
path */
actor = create_source ();
clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
clutter_actor_add_child (state.stage, actor);
clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE);
g_signal_connect (actor, "paint",
G_CALLBACK (pre_paint_clip_cb), NULL);
@ -210,7 +210,7 @@ texture_fbo (TestConformSimpleFixture *fixture,
G_CALLBACK (post_paint_clip_cb), NULL);
actor = clutter_texture_new_from_actor (actor);
clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
clutter_actor_add_child (state.stage, actor);
ypos++;
clutter_actor_show (state.stage);

View File

@ -227,7 +227,7 @@ test_actors_main (int argc, char *argv[])
clutter_actor_set_translation (oh->hand[i], -100.f, -106.5, 0);
/* Add to our group group */
clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]);
clutter_actor_add_child (oh->group, oh->hand[i]);
g_signal_connect (oh->hand[i], "button-press-event",
G_CALLBACK (on_button_press_event),
@ -239,7 +239,7 @@ test_actors_main (int argc, char *argv[])
}
/* Add the group to the stage */
clutter_container_add_actor (CLUTTER_CONTAINER (oh->stage), oh->group);
clutter_actor_add_child (oh->stage, oh->group);
/* Show everying */
clutter_actor_show (oh->stage);

View File

@ -269,32 +269,33 @@ test_binding_pool_main (int argc, char *argv[])
clutter_actor_add_child (stage, key_group);
/* add three rectangles to the key group */
clutter_container_add (CLUTTER_CONTAINER (key_group),
g_object_new (CLUTTER_TYPE_ACTOR,
"background-color", CLUTTER_COLOR_Red,
"name", "Red Rectangle",
"width", 100.0,
"height", 100.0,
"x", 0.0,
"y", 0.0,
NULL),
g_object_new (CLUTTER_TYPE_ACTOR,
"background-color", CLUTTER_COLOR_Green,
"name", "Green Rectangle",
"width", 100.0,
"height", 100.0,
"x", 125.0,
"y", 0.0,
NULL),
g_object_new (CLUTTER_TYPE_ACTOR,
"background-color", CLUTTER_COLOR_Blue,
"name", "Blue Rectangle",
"width", 100.0,
"height", 100.0,
"x", 250.0,
"y", 0.0,
NULL),
NULL);
clutter_actor_add_child (key_group,
g_object_new (CLUTTER_TYPE_ACTOR,
"background-color", CLUTTER_COLOR_Red,
"name", "Red Rectangle",
"width", 100.0,
"height", 100.0,
"x", 0.0,
"y", 0.0,
NULL));
clutter_actor_add_child (key_group,
g_object_new (CLUTTER_TYPE_ACTOR,
"background-color", CLUTTER_COLOR_Green,
"name", "Green Rectangle",
"width", 100.0,
"height", 100.0,
"x", 125.0,
"y", 0.0,
NULL));
clutter_actor_add_child (key_group,
g_object_new (CLUTTER_TYPE_ACTOR,
"background-color", CLUTTER_COLOR_Blue,
"name", "Blue Rectangle",
"width", 100.0,
"height", 100.0,
"x", 250.0,
"y", 0.0,
NULL));
g_signal_connect (key_group,
"activate", G_CALLBACK (on_key_group_activate),

View File

@ -231,8 +231,7 @@ test_cairo_flowers_main (int argc, char **argv)
flowers[i]->rv = rand() % 5 + 1;
flowers[i]->v = rand() % 10 + 2;
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
flowers[i]->ctex);
clutter_actor_add_child (stage, flowers[i]->ctex);
clutter_actor_set_position (flowers[i]->ctex,
flowers[i]->x,
flowers[i]->y);

View File

@ -201,7 +201,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
&GRAPHENE_POINT3D_INIT (0.5, 0.5, 0));
clutter_actor_set_translation (data->parent_container, -86.f, -125.f, 0.f);
clutter_container_add_actor (CLUTTER_CONTAINER(stage), state->group);
clutter_actor_add_child (stage, state->group);
state->timeline = clutter_timeline_new_for_actor (stage, 2812);

View File

@ -280,7 +280,7 @@ test_cogl_offscreen_main (int argc, char *argv[])
/* Cogl Box */
coglbox = test_coglbox_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
clutter_actor_add_child (stage, coglbox);
clutter_actor_show (stage);

View File

@ -322,7 +322,8 @@ make_toggle (const char *label_text, gboolean *toggle_val)
update_toggle_text (CLUTTER_TEXT (button), *toggle_val);
clutter_actor_set_position (button, clutter_actor_get_width (label) + 10, 0);
clutter_container_add (CLUTTER_CONTAINER (group), label, button, NULL);
clutter_actor_add_child (group, label);
clutter_actor_add_child (group, button);
g_signal_connect (button, "button-press-event", G_CALLBACK (on_toggle_click),
toggle_val);
@ -352,8 +353,7 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
/* Cogl Box */
coglbox = TEST_COGLBOX (test_coglbox_new ());
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
CLUTTER_ACTOR (coglbox));
clutter_actor_add_child (stage, CLUTTER_ACTOR (coglbox));
/* Timeline for animation */
timeline = clutter_timeline_new_for_actor (stage, 6000);
@ -378,11 +378,9 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
+ clutter_actor_get_y (filtering_toggle)) / 2
- clutter_actor_get_height (note) / 2);
clutter_container_add (CLUTTER_CONTAINER (stage),
slicing_toggle,
filtering_toggle,
note,
NULL);
clutter_actor_add_child (stage, slicing_toggle);
clutter_actor_add_child (stage, filtering_toggle);
clutter_actor_add_child (stage, note);
clutter_actor_show (stage);

View File

@ -157,7 +157,7 @@ test_cogl_tex_tile_main (int argc, char *argv[])
/* Cogl Box */
coglbox = test_coglbox_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
clutter_actor_add_child (stage, coglbox);
/* Timeline for animation */
timeline = clutter_timeline_new_for_actor (stage, 6000); /* 6 second duration */

View File

@ -127,7 +127,7 @@ seat_device_added_cb (ClutterSeat *seat,
NULL);
g_hash_table_insert (app->devices, device, hand);
clutter_container_add_actor (CLUTTER_CONTAINER (app->stage), hand);
clutter_actor_add_child (app->stage, hand);
}
}
@ -150,7 +150,7 @@ seat_device_removed_cb (ClutterSeat *seat,
{
hand = g_hash_table_lookup (app->devices, device);
if (hand != NULL)
clutter_container_add_actor (CLUTTER_CONTAINER (app->stage), hand);
clutter_actor_add_child (app->stage, hand);
g_hash_table_remove (app->devices, device);
}
@ -175,7 +175,7 @@ test_devices_main (int argc, char **argv)
g_signal_connect (stage,
"destroy", G_CALLBACK (clutter_test_quit),
NULL);
g_signal_connect (stage,
g_signal_connect (stage,
"motion-event", G_CALLBACK (stage_motion_event_cb),
app);
g_signal_connect (stage,
@ -222,7 +222,7 @@ test_devices_main (int argc, char **argv)
NULL);
g_hash_table_insert (app->devices, device, hand);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand);
clutter_actor_add_child (stage, hand);
}
}
@ -231,4 +231,4 @@ test_devices_main (int argc, char **argv)
clutter_test_main ();
return EXIT_SUCCESS;
}
}

View File

@ -219,7 +219,7 @@ test_easing_main (int argc, char *argv[])
/* create the actor that we want to tween */
rect = make_bouncer (50, 50);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
clutter_actor_set_position (rect, stage_width / 2, stage_height / 2);
text = g_strdup_printf (HELP_TEXT,
@ -228,7 +228,7 @@ test_easing_main (int argc, char *argv[])
n_easing_modes);
label = clutter_text_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
clutter_actor_add_child (stage, label);
clutter_text_set_text (CLUTTER_TEXT (label), text);
clutter_actor_add_constraint (label, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.95));
clutter_actor_add_constraint (label, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.95));

View File

@ -120,7 +120,7 @@ static void
key_focus_in_cb (ClutterActor *actor,
gpointer data)
{
ClutterActor *focus_box = CLUTTER_ACTOR (data);
ClutterActor *focus_box = CLUTTER_ACTOR (data);
if (CLUTTER_IS_STAGE (actor))
clutter_actor_hide (focus_box);
@ -369,7 +369,7 @@ input_cb (ClutterActor *actor,
if (source_actor == actor)
g_print (" *source*");
g_print ("\n");
return FALSE;
@ -391,7 +391,7 @@ test_events_main (int argc, char *argv[])
focus_box = clutter_actor_new ();
clutter_actor_set_background_color (focus_box, CLUTTER_COLOR_Black);
clutter_actor_set_name (focus_box, "Focus Box");
clutter_container_add (CLUTTER_CONTAINER(stage), focus_box, NULL);
clutter_actor_add_child (stage, focus_box);
actor = clutter_actor_new ();
clutter_actor_set_background_color (actor, CLUTTER_COLOR_Green);
@ -399,7 +399,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 250, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
clutter_actor_add_child (stage, actor);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "green box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
@ -413,7 +413,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_name (actor, "Black Box");
clutter_actor_set_size (actor, 400, 50);
clutter_actor_set_position (actor, 100, 250);
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
clutter_actor_add_child (stage, actor);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
@ -431,8 +431,8 @@ test_events_main (int argc, char *argv[])
/* note group not reactive */
group = clutter_actor_new ();
clutter_container_add (CLUTTER_CONTAINER (group), actor, NULL);
clutter_container_add (CLUTTER_CONTAINER (stage), group, NULL);
clutter_actor_add_child (group, actor);
clutter_actor_add_child (stage, group);
clutter_actor_set_position (group, 100, 350);
/* border actor */
@ -444,7 +444,7 @@ test_events_main (int argc, char *argv[])
(clutter_actor_get_width (stage) - 100) / 2,
clutter_actor_get_height (stage) - 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
clutter_actor_add_child (stage, actor);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), NULL);
clutter_actor_show (CLUTTER_ACTOR (stage));

View File

@ -200,7 +200,7 @@ G_MODULE_EXPORT int
test_grab_main (int argc, char *argv[])
{
ClutterActor *stage, *actor;
ClutterColor rcol = { 0xff, 0, 0, 0xff},
ClutterColor rcol = { 0xff, 0, 0, 0xff},
bcol = { 0, 0, 0xff, 0xff },
ccol = { 0, 0xff, 0xff, 0xff },
ycol = { 0xff, 0xff, 0, 0xff };
@ -224,7 +224,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
clutter_actor_add_child (stage, actor);
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "red box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (grab_pointer_cb), NULL);
@ -236,7 +236,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 300);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
clutter_actor_add_child (stage, actor);
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "yellow box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (toggle_grab_pointer_cb), NULL);
@ -246,7 +246,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 300, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
clutter_actor_add_child (stage, actor);
g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), (char *) "blue box");
g_signal_connect (actor, "button-press-event",
@ -259,7 +259,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 500, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
clutter_actor_add_child (stage, actor);
g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), (char *) "cyan box");
g_signal_connect (actor, "button-press-event",

View File

@ -122,7 +122,7 @@ test_path_constraint_main (int argc,
clutter_actor_set_size (rect, 128, 128);
clutter_actor_set_reactive (rect, TRUE);
clutter_actor_add_constraint_with_name (rect, "path", clutter_path_constraint_new (path, 0.0));
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
g_signal_connect (rect, "button-press-event", G_CALLBACK (on_button_press), NULL);
g_signal_connect (clutter_actor_get_constraint (rect, "path"),

View File

@ -73,8 +73,10 @@ test_shader_effects_main (int argc, char *argv[])
"fixed::anchor-y", 125.0,
NULL);
clutter_container_add (CLUTTER_CONTAINER (stage), rect, hand, label, NULL);
clutter_actor_add_child (stage, rect);
clutter_actor_add_child (stage, hand);
clutter_actor_add_child (stage, label);
/* start the timeline and thus the animations */
clutter_timeline_start (timeline);

View File

@ -33,7 +33,7 @@ test_state_script_main (int argc, char *argv[])
clutter_actor_show (stage);
button = CLUTTER_ACTOR (clutter_script_get_object (script, "button"));
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
clutter_actor_add_child (stage, button);
clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
clutter_script_connect_signals (script, NULL);

View File

@ -130,7 +130,7 @@ test_swipe_action_main (int argc, char *argv[])
clutter_actor_set_size (rect, 150, 150);
clutter_actor_set_position (rect, 10, 100);
clutter_actor_set_reactive (rect, TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
attach_action (rect, VERTICAL);
rect = clutter_actor_new ();
@ -139,7 +139,7 @@ test_swipe_action_main (int argc, char *argv[])
clutter_actor_set_size (rect, 150, 150);
clutter_actor_set_position (rect, 170, 100);
clutter_actor_set_reactive (rect, TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
attach_action (rect, HORIZONTAL);
rect = clutter_actor_new ();
@ -148,7 +148,7 @@ test_swipe_action_main (int argc, char *argv[])
clutter_actor_set_size (rect, 150, 150);
clutter_actor_set_position (rect, 330, 100);
clutter_actor_set_reactive (rect, TRUE);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
attach_action (rect, BOTH);
{
@ -176,7 +176,7 @@ test_swipe_action_main (int argc, char *argv[])
- clutter_actor_get_height (box)
- 12.0;
clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
clutter_actor_add_child (stage, box);
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage,
CLUTTER_BIND_X,
12.0));

View File

@ -42,7 +42,7 @@ test_text_main (gint argc,
clutter_text_set_font_name (CLUTTER_TEXT (text), FONT);
clutter_text_set_color (CLUTTER_TEXT (text), &text_color);
clutter_container_add (CLUTTER_CONTAINER (stage), text, NULL);
clutter_actor_add_child (stage, text);
clutter_actor_set_position (text, 40, 30);
clutter_actor_set_width (text, 1024);
clutter_text_set_line_wrap (CLUTTER_TEXT (text), TRUE);
@ -57,7 +57,7 @@ test_text_main (gint argc,
text2 = clutter_text_new_with_buffer (buffer);
clutter_text_set_color (CLUTTER_TEXT (text2), &text_color);
clutter_container_add (CLUTTER_CONTAINER (stage), text2, NULL);
clutter_actor_add_child (stage, text2);
clutter_actor_set_position (text2, 40, 300);
clutter_actor_set_width (text2, 1024);
clutter_text_set_line_wrap (CLUTTER_TEXT (text2), TRUE);

View File

@ -145,7 +145,7 @@ test_touch_events_main (int argc, char *argv[])
canvas_actor = g_object_new (CLUTTER_TYPE_ACTOR,
"content", canvas,
NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), canvas_actor);
clutter_actor_add_child (stage, canvas_actor);
g_signal_connect (stage, "event", G_CALLBACK (event_cb), canvas_actor);
@ -159,8 +159,8 @@ test_touch_events_main (int argc, char *argv[])
/* Test that event delivery to actors work */
g_signal_connect (rectangle, "event", G_CALLBACK (rect_event_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle);
clutter_actor_add_child (stage, rectangle);
clutter_actor_set_size (rectangle, size, size);
clutter_actor_set_position (rectangle, 0, i * size);
clutter_actor_set_reactive (rectangle, TRUE);

View File

@ -101,7 +101,7 @@ main (int argc, char **argv)
g_signal_connect (rect, "motion-event",
G_CALLBACK (motion_event_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
}
clutter_actor_show (stage);

View File

@ -31,8 +31,7 @@ on_idle (gpointer data)
/* Remove all of the children of the stage */
children = clutter_actor_get_children (stage);
for (node = children; node; node = node->next)
clutter_container_remove_actor (CLUTTER_CONTAINER (stage),
CLUTTER_ACTOR (node->data));
clutter_actor_remove_child (stage, CLUTTER_ACTOR (node->data));
g_list_free (children);
/* Fill the stage with new random labels */
@ -63,7 +62,7 @@ on_idle (gpointer data)
clutter_actor_set_position (label, xpos, ypos);
clutter_container_add (CLUTTER_CONTAINER (stage), label, NULL);
clutter_actor_add_child (stage, label);
xpos += clutter_actor_get_width (label);
}

View File

@ -175,10 +175,10 @@ main (int argc, char *argv[])
for (row=0; row<rows; row++)
for (col=0; col<cols; col++)
{
label = create_label();
label = create_label();
clutter_actor_set_scale (label, scale, scale);
clutter_actor_set_position (label, w * col * scale, h * row * scale);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
clutter_actor_set_position (label, w * col * scale, h * row * scale);
clutter_actor_add_child (stage, label);
}
clutter_actor_show (stage);

View File

@ -19,20 +19,20 @@ on_after_paint (ClutterActor *actor,
{
static GTimer *timer = NULL;
static int fps = 0;
if (!timer)
{
timer = g_timer_new ();
g_timer_start (timer);
}
if (g_timer_elapsed (timer, NULL) >= 1)
{
printf ("fps: %d\n", fps);
g_timer_start (timer);
fps = 0;
}
++fps;
}
@ -62,7 +62,7 @@ main (int argc, char *argv[])
group = clutter_actor_new ();
clutter_actor_set_size (group, STAGE_WIDTH, STAGE_WIDTH);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
clutter_actor_add_child (stage, group);
clutter_threads_add_idle (queue_redraw, stage);
@ -108,7 +108,7 @@ main (int argc, char *argv[])
(1.0*STAGE_HEIGHT/ROWS));*/
clutter_actor_set_scale (label, scale, scale);
clutter_text_set_line_wrap (CLUTTER_TEXT (label), FALSE);
clutter_container_add_actor (CLUTTER_CONTAINER (group), label);
clutter_actor_add_child (group, label);
}
}
clutter_actor_show (stage);

View File

@ -93,7 +93,7 @@ main (int argc, char **argv)
g_signal_connect (rect, "motion-event",
G_CALLBACK (motion_event_cb), NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
}
clutter_actor_show (stage);

View File

@ -149,10 +149,10 @@ main (int argc, char *argv[])
for (row=0; row<rows; row++)
for (col=0; col<cols; col++)
{
label = create_label();
label = create_label();
clutter_actor_set_scale (label, scale, scale);
clutter_actor_set_position (label, w * col * scale, h * row * scale);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
clutter_actor_set_position (label, w * col * scale, h * row * scale);
clutter_actor_add_child (stage, label);
}
clutter_actor_show (stage);

View File

@ -188,7 +188,7 @@ test_multitexture (TestUtilsGTestFixture *fixture,
clutter_actor_set_background_color (CLUTTER_ACTOR (stage), &stage_color);
group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
clutter_actor_add_child (stage, group);
/* We force continuous redrawing in case someone comments out the
* clutter_test_quit and wants visual feedback for the test since we

View File

@ -118,7 +118,7 @@ test_texture_mipmaps (TestUtilsGTestFixture *fixture,
clutter_actor_set_background_color (CLUTTER_ACTOR (stage), &stage_color);
group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
clutter_actor_add_child (stage, group);
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we won't be doing anything else that