From 67d5a4993c6459461ab486ed394f110ede4a5cc8 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 7 Nov 2011 20:24:13 +0000 Subject: [PATCH 1/5] main: Deprecate clutter_set_default_frame_rate() Setting the default frame rate does not do anything even remotely useful, unless synchronization to the vertical refresh rate is also disabled - which can only be done through environment variable or through configuration file. Having a programmatic way to change the default frame rate is, thus, completely pointless. Changing the default frame rate through environment variable and configuration file is still allowed. --- clutter/clutter-main.c | 9 ++------- clutter/clutter-main.h | 5 ++--- clutter/deprecated/clutter-main.h | 7 +++++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index be520fd7f..c24d399e3 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -2701,19 +2701,14 @@ clutter_get_default_frame_rate (void) * is possible, this value is ignored. * * Since: 0.6 + * + * Deprecated: 1.10: This function does not do anything any more. */ void clutter_set_default_frame_rate (guint frames_per_sec) { - ClutterMainContext *context; - - context = _clutter_context_get_default (); - - if (context->frame_rate != frames_per_sec) - context->frame_rate = frames_per_sec; } - static void on_grab_actor_destroy (ClutterActor *actor, ClutterInputDevice *device) diff --git a/clutter/clutter-main.h b/clutter/clutter-main.h index 3cd784690..175356b17 100644 --- a/clutter/clutter-main.h +++ b/clutter/clutter-main.h @@ -127,9 +127,6 @@ guint clutter_threads_add_repaint_func (GSourceFunc GDestroyNotify notify); void clutter_threads_remove_repaint_func (guint handle_id); -void clutter_set_default_frame_rate (guint frames_per_sec); -guint clutter_get_default_frame_rate (void); - void clutter_grab_pointer (ClutterActor *actor); void clutter_ungrab_pointer (void); ClutterActor * clutter_get_pointer_grab (void); @@ -141,6 +138,8 @@ PangoFontMap * clutter_get_font_map (void); ClutterTextDirection clutter_get_default_text_direction (void); +guint clutter_get_default_frame_rate (void); + G_END_DECLS #endif /* _CLUTTER_MAIN_H__ */ diff --git a/clutter/deprecated/clutter-main.h b/clutter/deprecated/clutter-main.h index 342d42d55..4ec39b665 100644 --- a/clutter/deprecated/clutter-main.h +++ b/clutter/deprecated/clutter-main.h @@ -42,11 +42,14 @@ CLUTTER_DEPRECATED_FOR(clutter_device_manager_get_device) ClutterInputDevice * clutter_get_input_device_for_id (gint id_); CLUTTER_DEPRECATED_FOR(clutter_input_device_grab) -void clutter_grab_pointer_for_device (ClutterActor *actor, +void clutter_grab_pointer_for_device (ClutterActor *actor, gint id_); CLUTTER_DEPRECATED_FOR(clutter_input_device_ungrab) -void clutter_ungrab_pointer_for_device (gint id_); +void clutter_ungrab_pointer_for_device (gint id_); + +CLUTTER_DEPRECATED +void clutter_set_default_frame_rate (guint frames_per_sec); G_END_DECLS From 76e85f68eaec4307ba27cd45e99072d78ee5b8e6 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 8 Nov 2011 11:19:22 +0000 Subject: [PATCH 2/5] build: Remove mention of missing file There is no clutter-event-gdk.h in the build. --- clutter/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/clutter/Makefile.am b/clutter/Makefile.am index e18e08c63..fb41ac211 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -455,7 +455,6 @@ gdk_source_h_priv = \ $(srcdir)/gdk/clutter-backend-gdk.h \ $(srcdir)/gdk/clutter-device-manager-gdk.h \ $(srcdir)/gdk/clutter-input-device-gdk.h \ - $(srcdir)/gdk/clutter-event-gdk.h \ $(srcdir)/gdk/clutter-stage-gdk.h \ $(NULL) From 4fe7a77302ed0de7a977916e83e4b62244b99275 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 8 Nov 2011 14:20:32 +0000 Subject: [PATCH 3/5] Replace ClutterGeometry with cairo_rectangle_int_t We still use ClutterGeometry internally in a couple of places, but we should really move away from that flawed rectangle data type, and use the Cairo one. Sadly, we still have some public API that we cannot remove yet. --- clutter/win32/clutter-stage-win32.c | 2 +- clutter/x11/clutter-stage-x11.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clutter/win32/clutter-stage-win32.c b/clutter/win32/clutter-stage-win32.c index 573b0138c..ade15e880 100644 --- a/clutter/win32/clutter-stage-win32.c +++ b/clutter/win32/clutter-stage-win32.c @@ -673,7 +673,7 @@ clutter_win32_get_stage_from_window (HWND hwnd) typedef struct { ClutterStageWin32 *stage_win32; - ClutterGeometry geom; + cairo_rectangle_int_t geom; HWND hwnd; guint destroy_old_hwnd : 1; } ForeignWindowData; diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index ac8463902..dcfcaef51 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -1269,7 +1269,7 @@ clutter_x11_get_stage_visual (ClutterStage *stage) typedef struct { ClutterStageX11 *stage_x11; - ClutterGeometry geom; + cairo_rectangle_int_t geom; Window xwindow; guint destroy_old_xwindow : 1; } ForeignWindowData; From 101f39ea922687427c5cf2a69a18d171f289fe6e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 8 Nov 2011 14:46:16 +0000 Subject: [PATCH 4/5] Replace usage of [sg]et_geometry() The set_geometry() and get_geometry() methods are going to be deprecated. --- clutter/win32/clutter-stage-win32.c | 2 +- clutter/x11/clutter-stage-x11.c | 2 +- .../cally-atkcomponent-example.c | 44 +++++++------------ tests/accessibility/cally-atkevents-example.c | 22 +++++----- tests/accessibility/cally-clone-example.c | 4 +- tests/conform/test-pick.c | 9 ++-- 6 files changed, 38 insertions(+), 45 deletions(-) diff --git a/clutter/win32/clutter-stage-win32.c b/clutter/win32/clutter-stage-win32.c index ade15e880..b82c824db 100644 --- a/clutter/win32/clutter-stage-win32.c +++ b/clutter/win32/clutter-stage-win32.c @@ -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 diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index dcfcaef51..f9ae163a8 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -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); diff --git a/tests/accessibility/cally-atkcomponent-example.c b/tests/accessibility/cally-atkcomponent-example.c index bce0cd246..7d4ebcd08 100644 --- a/tests/accessibility/cally-atkcomponent-example.c +++ b/tests/accessibility/cally-atkcomponent-example.c @@ -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 (); diff --git a/tests/accessibility/cally-atkevents-example.c b/tests/accessibility/cally-atkevents-example.c index 0fb3943a8..ca0a00678 100644 --- a/tests/accessibility/cally-atkevents-example.c +++ b/tests/accessibility/cally-atkevents-example.c @@ -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; } } diff --git a/tests/accessibility/cally-clone-example.c b/tests/accessibility/cally-clone-example.c index 6b0973a04..04137c2a6 100644 --- a/tests/accessibility/cally-clone-example.c +++ b/tests/accessibility/cally-clone-example.c @@ -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); diff --git a/tests/conform/test-pick.c b/tests/conform/test-pick.c index b3cbd7400..845d39dec 100644 --- a/tests/conform/test-pick.c +++ b/tests/conform/test-pick.c @@ -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); From ba8d682c0900afd0ef14acc8fe7083d4137f4b63 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 8 Nov 2011 14:46:55 +0000 Subject: [PATCH 5/5] actor: Deprecate [sg]et_geometry() These methods are short-hands for accessing the position and size, which are already shorthands for accessing the various dimensional and positional attributes. Plus, they use ClutterGeometry, which is a fairly bad data type for a rectangle. --- clutter/clutter-actor.c | 9 ++++++++- clutter/clutter-actor.h | 4 ---- clutter/deprecated/clutter-actor.h | 11 +++++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index ce699b50f..5a66c16ae 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -6289,6 +6289,9 @@ clutter_actor_allocate (ClutterActor *self, * size, in pixels. This means the untransformed actor will have the * given geometry. This is the same as calling clutter_actor_set_position() * and clutter_actor_set_size(). + * + * Deprecated: 1.10: Use clutter_actor_set_position() and + * clutter_actor_set_size() instead. */ void clutter_actor_set_geometry (ClutterActor *self, @@ -6305,12 +6308,16 @@ clutter_actor_set_geometry (ClutterActor *self, /** * clutter_actor_get_geometry: * @self: A #ClutterActor - * @geometry: (out): A location to store actors #ClutterGeometry + * @geometry: (out caller-allocates): A location to store actors #ClutterGeometry * * Gets the size and position of an actor relative to its parent * actor. This is the same as calling clutter_actor_get_position() and * clutter_actor_get_size(). It tries to "do what you mean" and get the * requested size and position if the actor's allocation is invalid. + * + * Deprecated: 1.10: Use clutter_actor_get_position() and + * clutter_actor_get_size(), or clutter_actor_get_allocation_geometry() + * instead. */ void clutter_actor_get_geometry (ClutterActor *self, diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index 41ea9ab36..7adabf4ae 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -326,10 +326,6 @@ void clutter_actor_get_allocation_geometry (ClutterActor void clutter_actor_get_allocation_vertices (ClutterActor *self, ClutterActor *ancestor, ClutterVertex verts[]); -void clutter_actor_set_geometry (ClutterActor *self, - const ClutterGeometry *geometry); -void clutter_actor_get_geometry (ClutterActor *self, - ClutterGeometry *geometry); void clutter_actor_set_size (ClutterActor *self, gfloat width, gfloat height); diff --git a/clutter/deprecated/clutter-actor.h b/clutter/deprecated/clutter-actor.h index 9d9f001fa..c752e51bc 100644 --- a/clutter/deprecated/clutter-actor.h +++ b/clutter/deprecated/clutter-actor.h @@ -6,10 +6,17 @@ G_BEGIN_DECLS CLUTTER_DEPRECATED -guint32 clutter_actor_get_gid (ClutterActor *self); +void clutter_actor_set_geometry (ClutterActor *self, + const ClutterGeometry *geometry); + +CLUTTER_DEPRECATED_FOR(clutter_actor_get_allocation_geometry) +void clutter_actor_get_geometry (ClutterActor *self, + ClutterGeometry *geometry); +CLUTTER_DEPRECATED +guint32 clutter_actor_get_gid (ClutterActor *self); CLUTTER_DEPRECATED -ClutterActor * clutter_get_actor_by_gid (guint32 id_); +ClutterActor * clutter_get_actor_by_gid (guint32 id_); G_END_DECLS