2007-12-04 Emmanuele Bassi <ebassi@openedhand.com>
authorEmmanuele Bassi <ebassi@openedhand.com>
Tue, 4 Dec 2007 10:32:15 +0000 (10:32 +0000)
committerEmmanuele Bassi <ebassi@openedhand.com>
Tue, 4 Dec 2007 10:32:15 +0000 (10:32 +0000)
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
clutter-gtk/clutter-gtk.c
examples/gtk-clutter-events.c
examples/gtk-clutter-test.c

index aa0cb93..873ef53 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2007-12-04  Emmanuele Bassi  <ebassi@openedhand.com>
+
+       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  <ebassi@openedhand.com>
 
        * doc/reference/clutter-gtk-sections.txt:
index 83f3904..d8cf5a9 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <clutter/clutter-main.h>
 #include <clutter/clutter-stage.h>
-#include <clutter/clutter-glx.h>
+#include <clutter/clutter-x11.h>
 
 #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;
 }
 
index c3635ea..c6ad51f 100644 (file)
@@ -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
index ff5de99..c5c4dbd 100644 (file)
@@ -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;