From 8aff2c0adc6627950e4a19f4d56e3337697ff77e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 4 Dec 2007 10:32:15 +0000 Subject: [PATCH] 2007-12-04 Emmanuele Bassi Update after the API changes in Clutter core * clutter-gtk/clutter-gtk.c: (gtk_clutter_destroy): Do not call clutter_actor_destroy() on the stage. (gtk_clutter_map): Use the new X11 API for retrieving the XID of the stage window. (gtk_clutter_init): Set the widget as paintable and the stage as resizable. * examples/gtk-clutter-events.c: (on_x_changed), (on_y_changed), (on_z_changed): Use the new clutter_actor_set_rotation() API. * examples/gtk-clutter-test.c (frame_cb): Ditto as above. --- ChangeLog | 20 ++++++++++++++++++++ clutter-gtk/clutter-gtk.c | 15 +++++++++------ examples/gtk-clutter-events.c | 27 +++++++++++++++------------ examples/gtk-clutter-test.c | 27 ++++++++++++++------------- 4 files changed, 58 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa0cb93..873ef53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2007-12-04 Emmanuele Bassi + + Update after the API changes in Clutter core + + * clutter-gtk/clutter-gtk.c: + (gtk_clutter_destroy): Do not call clutter_actor_destroy() + on the stage. + + (gtk_clutter_map): Use the new X11 API for retrieving the + XID of the stage window. + + (gtk_clutter_init): Set the widget as paintable and the stage + as resizable. + + * examples/gtk-clutter-events.c: + (on_x_changed), (on_y_changed), (on_z_changed): Use the new + clutter_actor_set_rotation() API. + + * examples/gtk-clutter-test.c (frame_cb): Ditto as above. + 2007-08-20 Emmanuele Bassi * doc/reference/clutter-gtk-sections.txt: diff --git a/clutter-gtk/clutter-gtk.c b/clutter-gtk/clutter-gtk.c index 83f3904..d8cf5a9 100644 --- a/clutter-gtk/clutter-gtk.c +++ b/clutter-gtk/clutter-gtk.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include "clutter-gtk.h" @@ -72,11 +72,11 @@ gtk_clutter_destroy (GtkObject *object) priv = GTK_CLUTTER (object)->priv; + /* XXX - there's no clutter main loop running, so we cannot + * release the resources we create when we initialise clutter. + */ if (priv->stage) - { - clutter_actor_destroy (priv->stage); - priv->stage = NULL; - } + priv->stage = NULL; GTK_OBJECT_CLASS (gtk_clutter_parent_class)->destroy (object); } @@ -121,7 +121,7 @@ gtk_clutter_map (GtkWidget *widget) { g_object_ref (widget); - gtk_socket_add_id (socket, clutter_glx_get_stage_window (stage)); + gtk_socket_add_id (socket, clutter_x11_get_stage_window (stage)); priv->is_embedded = TRUE; g_object_notify (G_OBJECT (widget), "embedded"); @@ -184,8 +184,11 @@ gtk_clutter_init (GtkClutter *clutter) clutter->priv = priv = GTK_CLUTTER_GET_PRIVATE (clutter); gtk_widget_set_double_buffered (GTK_WIDGET (clutter), FALSE); + gtk_widget_set_app_paintable (GTK_WIDGET (clutter), TRUE); priv->stage = clutter_stage_get_default (); + clutter_stage_set_user_resizable (CLUTTER_STAGE (priv->stage), TRUE); + priv->is_embedded = FALSE; } diff --git a/examples/gtk-clutter-events.c b/examples/gtk-clutter-events.c index c3635ea..c6ad51f 100644 --- a/examples/gtk-clutter-events.c +++ b/examples/gtk-clutter-events.c @@ -26,28 +26,31 @@ on_gtk_entry_changed (GtkEditable *editable, EventApp *app) static void on_x_changed (GtkSpinButton *button, EventApp *app) { - clutter_actor_rotate_x (app->hand, - gtk_spin_button_get_value (button), - clutter_actor_get_height (app->hand), - 0); + clutter_actor_set_rotation (app->hand, CLUTTER_X_AXIS, + gtk_spin_button_get_value (button), + 0, + clutter_actor_get_height (app->hand) / 2, + 0); } static void on_y_changed (GtkSpinButton *button, EventApp *app) { - clutter_actor_rotate_y (app->hand, - gtk_spin_button_get_value (button), - clutter_actor_get_width (app->hand) /2, - 0); + clutter_actor_set_rotation (app->hand, CLUTTER_Y_AXIS, + gtk_spin_button_get_value (button), + clutter_actor_get_width (app->hand) / 2, + 0, + 0); } static void on_z_changed (GtkSpinButton *button, EventApp *app) { - clutter_actor_rotate_z (app->hand, - gtk_spin_button_get_value (button), - clutter_actor_get_width (app->hand) /2, - clutter_actor_get_height (app->hand)/2); + clutter_actor_set_rotation (app->hand, CLUTTER_Z_AXIS, + gtk_spin_button_get_value (button), + clutter_actor_get_width (app->hand) / 2, + clutter_actor_get_height (app->hand) / 2, + 0); } static void diff --git a/examples/gtk-clutter-test.c b/examples/gtk-clutter-test.c index ff5de99..c5c4dbd 100644 --- a/examples/gtk-clutter-test.c +++ b/examples/gtk-clutter-test.c @@ -70,23 +70,24 @@ frame_cb (ClutterTimeline *timeline, #endif /* Rotate everything clockwise about stage center*/ - clutter_actor_rotate_z (CLUTTER_ACTOR(oh->group), - frame_num, - WINWIDTH/2, - WINHEIGHT/2); + clutter_actor_set_rotation (CLUTTER_ACTOR (oh->group), + CLUTTER_Z_AXIS, + frame_num, + WINWIDTH / 2, WINHEIGHT / 2, 0); + for (i = 0; i < NHANDS; i++) { /* rotate each hand around there centers */ - clutter_actor_rotate_z (oh->hand[i], - - 6.0 * frame_num, - clutter_actor_get_width (oh->hand[i])/2, - clutter_actor_get_height (oh->hand[i])/2); - if (fade == TRUE) { - clutter_actor_set_opacity (oh->hand[i], (255 - (frame_num % 255))); - } + clutter_actor_set_rotation (oh->hand[i], + CLUTTER_Z_AXIS, + - 6.0 * frame_num, + clutter_actor_get_width (oh->hand[i]) / 2, + clutter_actor_get_height (oh->hand[i]) / 2, + 0); + if (fade == TRUE) + clutter_actor_set_opacity (oh->hand[i], (255 - (frame_num % 255))); } - /* clutter_actor_rotate_x (CLUTTER_ACTOR(oh->group), 75.0, @@ -105,7 +106,7 @@ int main (int argc, char *argv[]) { ClutterTimeline *timeline; - ClutterActor *stage; + ClutterActor *stage; ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff }; GtkWidget *window, *clutter, *socket_box; GtkWidget *label, *button, *vbox; -- 1.7.9.5