Add dependencies
[clutter-gtk] / examples / gtk-clutter-events.c
index bb2f04e..0396f86 100644 (file)
@@ -1,7 +1,7 @@
 #include <gtk/gtk.h>
 #include <clutter/clutter.h>
 
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 typedef struct {
 
@@ -20,7 +20,7 @@ on_gtk_entry_changed (GtkEditable *editable, EventApp *app)
 {
   const gchar *text = gtk_entry_get_text (GTK_ENTRY (editable));
 
-  clutter_entry_set_text (CLUTTER_ENTRY (app->clutter_entry), text);
+  clutter_text_set_text (CLUTTER_TEXT (app->clutter_entry), text);
 }
 
 static void
@@ -63,20 +63,8 @@ on_opacity_changed (GtkSpinButton *button, EventApp *app)
 static void
 create_colors (EventApp *app, ClutterColor *stage, ClutterColor *text)
 {
-  GtkStyle *style = gtk_widget_get_style (app->window);
-  GdkColor color;
-
-  /* Set the stage color to base[NORMAL] */
-  color = style->bg[GTK_STATE_NORMAL];
-  stage->red = (guint8) ((color.red/65535.0) * 255);
-  stage->green = (guint8) ((color.green/65535.0) * 255);
-  stage->blue  = (guint8) ((color.blue/65535.0) * 255);
-  
-  /* Now the text color */
-  color = style->text[GTK_STATE_NORMAL];
-  text->red =(guint8) ((color.red/65535.0) * 255);
-  text->green = (guint8) ((color.green/65535.0) * 255);
-  text->blue = (guint8) ((color.blue/65535.0) * 255);
+  gtk_clutter_get_bg_color (app->window, GTK_STATE_NORMAL, stage);
+  gtk_clutter_get_text_color (app->window, GTK_STATE_NORMAL, text);
 }
 
 static gboolean
@@ -86,11 +74,11 @@ on_stage_capture (ClutterActor *actor,
 {
   if (event->type == CLUTTER_BUTTON_RELEASE)
     {
-      gint x, y;
+      gfloat x, y;
 
       clutter_event_get_coords (event, &x, &y);
 
-      g_print ("Event captured at (%d, %d)\n", x, y);
+      g_print ("Event captured at (%.2f, %.2f)\n", x, y);
     }
 
   return FALSE;
@@ -114,7 +102,7 @@ main (gint argc, gchar **argv)
   GtkWidget     *widget, *vbox, *hbox, *button, *label, *box;
   ClutterActor  *actor;
   GdkPixbuf     *pixbuf = NULL;
-  guint          width, height;
+  gfloat         width, height;
   ClutterColor   stage_color = {255, 255, 255, 255};
   ClutterColor   text_color = {0, 0, 0, 255};
 
@@ -159,7 +147,7 @@ main (gint argc, gchar **argv)
   if (pixbuf == NULL)
     g_error ("Unable to load pixbuf\n");
 
-  actor = clutter_texture_new_from_pixbuf (pixbuf);
+  actor = gtk_clutter_texture_new_from_pixbuf (pixbuf);
   app->hand = actor;
   clutter_group_add (CLUTTER_GROUP (app->stage), actor);
   clutter_actor_get_size (actor, &width, &height);
@@ -172,7 +160,7 @@ main (gint argc, gchar **argv)
                     NULL);
 
   /* Setup the clutter entry */
-  actor = clutter_entry_new_full ("Sans 10", "", &text_color);
+  actor = clutter_text_new_full ("Sans 10", "", &text_color);
   app->clutter_entry = actor;
   clutter_group_add (CLUTTER_GROUP (app->stage), actor);
   clutter_actor_set_position (actor, 0, 0);