mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
Replace usage of [sg]et_geometry()
The set_geometry() and get_geometry() methods are going to be deprecated.
This commit is contained in:
parent
4fe7a77302
commit
101f39ea92
@ -700,7 +700,7 @@ set_foreign_window_callback (ClutterActor *actor,
|
||||
fwd->stage_win32->win_width = fwd->geom.width;
|
||||
fwd->stage_win32->win_height = fwd->geom.height;
|
||||
|
||||
clutter_actor_set_geometry (actor, &fwd->geom);
|
||||
clutter_actor_set_size (actor, fwd->geom.width, fwd->geom.height);
|
||||
|
||||
/* calling this with the stage unrealized will unset the stage
|
||||
* from the GL context; once the stage is realized the GL context
|
||||
|
@ -1298,7 +1298,7 @@ set_foreign_window_callback (ClutterActor *actor,
|
||||
fwd->stage_x11->xwin_width = fwd->geom.width;
|
||||
fwd->stage_x11->xwin_height = fwd->geom.height;
|
||||
|
||||
clutter_actor_set_geometry (actor, &fwd->geom);
|
||||
clutter_actor_set_size (actor, fwd->geom.width, fwd->geom.height);
|
||||
|
||||
if (clutter_stages_by_xid == NULL)
|
||||
clutter_stages_by_xid = g_hash_table_new (NULL, NULL);
|
||||
|
@ -29,23 +29,16 @@
|
||||
#define SIZE 50
|
||||
#define DEPTH -100
|
||||
|
||||
static const ClutterColor color1 = { 0xff, 0xff, 0x00, 0xff };
|
||||
static const ClutterColor color2 = { 0x00, 0xff, 0x00, 0xff };
|
||||
static const ClutterColor color3 = { 0x00, 0x00, 0xff, 0xff };
|
||||
static const ClutterColor color4 = { 0xff, 0x00, 0xff, 0xff };
|
||||
|
||||
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;
|
||||
int i = 0;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
@ -54,39 +47,34 @@ main (int argc, char *argv[])
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &color);
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_White);
|
||||
clutter_actor_set_size (stage, WIDTH, HEIGHT);
|
||||
|
||||
button1 = clutter_rectangle_new_with_color (&color1);
|
||||
clutter_actor_set_geometry (button1, &geom);
|
||||
button1 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Yellow);
|
||||
clutter_actor_set_size (button1, SIZE, SIZE);
|
||||
|
||||
button2 = clutter_rectangle_new_with_color (&color2);
|
||||
geom.x = 2*SIZE;
|
||||
geom.y = 0;
|
||||
clutter_actor_set_geometry (button2, &geom);
|
||||
button2 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Green);
|
||||
clutter_actor_set_position (button2, 2 * SIZE, 0);
|
||||
clutter_actor_set_size (button2, SIZE, SIZE);
|
||||
|
||||
geom.x = 0;
|
||||
geom.y = 2*SIZE;
|
||||
button3 = clutter_rectangle_new_with_color (&color3);
|
||||
clutter_actor_set_geometry (button3, &geom);
|
||||
button3 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Blue);
|
||||
clutter_actor_set_position (button3, 0, 2 * SIZE);
|
||||
clutter_actor_set_size (button3, SIZE, SIZE);
|
||||
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);
|
||||
button4 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta);
|
||||
clutter_actor_set_position (button4, SIZE / 2, SIZE / 2);
|
||||
clutter_actor_set_size (button4, SIZE, SIZE);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
group[i] = clutter_group_new ();
|
||||
clutter_actor_set_geometry (group[i], &geom);
|
||||
clutter_actor_set_position (group[i], SIZE / 2, SIZE / 2);
|
||||
clutter_actor_set_size (group[i], SIZE, SIZE);
|
||||
|
||||
if (i > 0)
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group[i]), group [i - 1]);
|
||||
|
||||
clutter_actor_show_all (group[i]);
|
||||
}
|
||||
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button1);
|
||||
@ -95,7 +83,7 @@ main (int argc, char *argv[])
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group[3]);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group[0]), button4);
|
||||
|
||||
clutter_actor_show_all (stage);
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_main ();
|
||||
|
||||
|
@ -88,31 +88,32 @@ make_ui (ClutterActor *stage)
|
||||
ClutterActor *editable = NULL;
|
||||
ClutterActor *rectangle = NULL;
|
||||
ClutterActor *label = NULL;
|
||||
ClutterColor color_stage = { 0x00, 0x00, 0x00, 0xff };
|
||||
ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff };
|
||||
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
|
||||
ClutterColor color_label = { 0x00, 0xff, 0x55, 0xff };
|
||||
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0x55 };
|
||||
ClutterGeometry label_geom = {0, 50, -1, -1};
|
||||
ClutterGeometry editable_geom = {150, 50, 500, 75};
|
||||
float label_geom_y, editable_geom_y;
|
||||
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &color_stage);
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_White);
|
||||
clutter_actor_set_size (stage, WIDTH, HEIGHT);
|
||||
|
||||
label_geom_y = 50;
|
||||
editable_geom_y = 50;
|
||||
|
||||
for (i = 0; i < NUM_ENTRIES; i++)
|
||||
{
|
||||
/* label */
|
||||
label = clutter_text_new_full ("Sans Bold 32px",
|
||||
"Entry",
|
||||
&color_label);
|
||||
clutter_actor_set_geometry (label, &label_geom);
|
||||
clutter_actor_set_position (label, 0, label_geom_y);
|
||||
|
||||
/* editable */
|
||||
editable = clutter_text_new_full ("Sans Bold 32px",
|
||||
"ddd",
|
||||
&color_text);
|
||||
clutter_actor_set_geometry (editable, &editable_geom);
|
||||
clutter_actor_set_position (editable, 150, editable_geom_y);
|
||||
clutter_actor_set_size (editable, 500, 75);
|
||||
clutter_text_set_editable (CLUTTER_TEXT (editable), TRUE);
|
||||
clutter_text_set_selectable (CLUTTER_TEXT (editable), TRUE);
|
||||
clutter_text_set_selection_color (CLUTTER_TEXT (editable),
|
||||
@ -122,14 +123,15 @@ make_ui (ClutterActor *stage)
|
||||
|
||||
/* rectangle: to create a entry "feeling" */
|
||||
rectangle = clutter_rectangle_new_with_color (&color_rect);
|
||||
clutter_actor_set_geometry (rectangle, &editable_geom);
|
||||
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);
|
||||
|
||||
label_geom.y += HEIGHT_STEP;
|
||||
editable_geom.y += HEIGHT_STEP;
|
||||
label_geom_y += HEIGHT_STEP;
|
||||
editable_geom_y += HEIGHT_STEP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ make_ui (ClutterActor *stage)
|
||||
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
|
||||
ClutterColor color_label = { 0x00, 0xff, 0x55, 0xff };
|
||||
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0x55 };
|
||||
ClutterGeometry editable_geom = {150, 50, 100, 75};
|
||||
ClutterActor *full_entry = NULL;
|
||||
ClutterActor *cloned_entry = NULL;
|
||||
|
||||
@ -68,7 +67,8 @@ make_ui (ClutterActor *stage)
|
||||
|
||||
/* rectangle: to create a entry "feeling" */
|
||||
rectangle = clutter_rectangle_new_with_color (&color_rect);
|
||||
clutter_actor_set_geometry (rectangle, &editable_geom);
|
||||
clutter_actor_set_position (rectangle, 150, 50);
|
||||
clutter_actor_add_constraint (rectangle, clutter_bind_constraint_new (editable, CLUTTER_BIND_SIZE, 0));
|
||||
|
||||
full_entry = clutter_group_new ();
|
||||
clutter_actor_set_position (full_entry, 0, 50);
|
||||
|
@ -251,11 +251,14 @@ actor_picking (void)
|
||||
ClutterColor color = { x * 255 / (ACTORS_X - 1),
|
||||
y * 255 / (ACTORS_Y - 1),
|
||||
128, 255 };
|
||||
ClutterGeometry geom = { x * state.actor_width, y * state.actor_height,
|
||||
state.actor_width, state.actor_height };
|
||||
ClutterActor *rect = clutter_rectangle_new_with_color (&color);
|
||||
|
||||
clutter_actor_set_geometry (rect, &geom);
|
||||
clutter_actor_set_position (rect,
|
||||
x * state.actor_width,
|
||||
y * state.actor_height);
|
||||
clutter_actor_set_size (rect,
|
||||
state.actor_width,
|
||||
state.actor_height);
|
||||
|
||||
clutter_container_add (CLUTTER_CONTAINER (state.stage), rect, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user