2007-03-22 Matthew Allum <mallum@openedhand.com>
authorMatthew Allum <mallum@openedhand.com>
Thu, 22 Mar 2007 15:32:46 +0000 (15:32 +0000)
committerMatthew Allum <mallum@openedhand.com>
Thu, 22 Mar 2007 15:32:46 +0000 (15:32 +0000)
        * clutter-gtk/Makefile.am:
        * clutter-gtk/clutter-gtk.c:
        * clutter-gtk/gtk-clutter.c:
        * clutter-gtk/gtk-clutter.h:
        * configure.ac:
        * examples/gtk-clutter-test.c:
        Various naming fixups.

ChangeLog
clutter-gtk/Makefile.am
clutter-gtk/clutter-gtk.c [new file with mode: 0644]
clutter-gtk/clutter-gtk.h [new file with mode: 0644]
clutter-gtk/gtk-clutter.c [deleted file]
clutter-gtk/gtk-clutter.h [deleted file]
configure.ac
examples/gtk-clutter-test.c

index 09861d2..4ab44d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-03-22  Matthew Allum  <mallum@openedhand.com>
+
+       * clutter-gtk/Makefile.am:
+       * clutter-gtk/clutter-gtk.c:
+       * clutter-gtk/gtk-clutter.c:
+       * clutter-gtk/gtk-clutter.h:
+       * configure.ac:
+       * examples/gtk-clutter-test.c:
+       Various naming fixups. 
+
 2007-03-21  Matthew Allum  <mallum@openedhand.com>
 
        * clutter-gtk.pc.in:
index ccfe79f..551b40b 100644 (file)
@@ -11,9 +11,9 @@ INCLUDES = \
 
 lib_LTLIBRARIES = libcluttergtk-1.0.la
 
-libcluttergtk_1_0_la_SOURCES = gtk-clutter.c
+libcluttergtk_1_0_la_SOURCES = clutter-gtk.c
 libcluttergtk_1_0_la_LIBADD = $(CLUTTER_LIBS) $(GTK_LIBS)
 libcluttergtk_1_0_la_LDFLAGS = $(CLUTTER_LT_LDFLAGS)
 
 cluttergtkheadersdir = $(includedir)/clutter-0.2/clutter-gtk
-cluttergtkheaders_HEADERS = gtk-clutter.h
+cluttergtkheaders_HEADERS = clutter-gtk.h
diff --git a/clutter-gtk/clutter-gtk.c b/clutter-gtk/clutter-gtk.c
new file mode 100644 (file)
index 0000000..25489b0
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Clutter-Gtk
+ *
+ * GTK+ widget for Clutter.
+ *
+ * Authored By Iain Holmes  <iain@openedhand.com>
+ *
+ * Copyright (C) 2006 OpenedHand
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gtk-clutter
+ * @short_description: GTK+ widget displaying a #ClutterStage.
+ *
+ * #GtkClutter is a GTK+ widget, derived from #GtkSocket that contains a
+ * #ClutterStage, allowing it to be used in a GTK+ based program like any 
+ * normal GTK+ widget.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gdk/gdkx.h>
+
+#include <gtk/gtkwidget.h>
+
+#include <clutter/clutter-main.h>
+#include <clutter/clutter-stage.h>
+
+#include "clutter-gtk.h"
+
+#define GTK_CLUTTER_GET_PRIVATE(obj) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CLUTTER, GtkClutterPrivate))
+
+struct _GtkClutterPrivate
+{
+  ClutterActor *stage;
+  gboolean embedded;
+};
+
+G_DEFINE_TYPE (GtkClutter, gtk_clutter, GTK_TYPE_SOCKET);
+
+static void
+gtk_clutter_destroy (GtkObject *object)
+{
+  GtkClutterPrivate *priv;
+
+  priv = GTK_CLUTTER (object)->priv;
+
+  if (priv->stage)
+    {
+      clutter_actor_destroy (priv->stage);
+      priv->stage = NULL;
+    }
+
+  GTK_OBJECT_CLASS (gtk_clutter_parent_class)->destroy (object);
+}
+
+static void
+gtk_clutter_size_allocate (GtkWidget     *widget,
+                           GtkAllocation *allocation)
+{
+  GtkClutterPrivate *priv = GTK_CLUTTER (widget)->priv;
+
+  clutter_actor_set_size (priv->stage,
+                          allocation->width,
+                          allocation->height);
+
+  if (CLUTTER_ACTOR_IS_VISIBLE (priv->stage))
+    clutter_actor_queue_redraw (priv->stage);
+
+  GTK_WIDGET_CLASS (gtk_clutter_parent_class)->size_allocate (widget, 
+                                                             allocation);
+}
+
+static void
+gtk_clutter_size_request (GtkWidget      *widget,
+                          GtkRequisition *req)
+{
+  GtkClutterPrivate *priv;
+
+  priv = GTK_CLUTTER (widget)->priv;
+
+  req->width = clutter_actor_get_width (priv->stage);
+  req->height = clutter_actor_get_height (priv->stage);
+}
+
+static void
+gtk_clutter_map (GtkWidget *widget)
+{
+  GtkClutterPrivate *priv;
+
+  priv = GTK_CLUTTER (widget)->priv;
+
+  if (priv->embedded == FALSE) {
+    gtk_socket_add_id (GTK_SOCKET (widget), 
+                      clutter_stage_get_xwindow (CLUTTER_STAGE(priv->stage)));
+    priv->embedded = TRUE;
+  }
+
+  GTK_WIDGET_CLASS (gtk_clutter_parent_class)->map (widget);
+}
+
+static void
+gtk_clutter_class_init (GtkClutterClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->destroy = gtk_clutter_destroy;
+
+  widget_class->size_request = gtk_clutter_size_request;
+  widget_class->size_allocate = gtk_clutter_size_allocate;
+  widget_class->map = gtk_clutter_map;
+
+  g_type_class_add_private (gobject_class, sizeof (GtkClutterPrivate));
+}
+
+static void
+gtk_clutter_init (GtkClutter *clutter)
+{
+  GtkClutterPrivate *priv;
+
+  clutter->priv = priv = GTK_CLUTTER_GET_PRIVATE (clutter);
+
+  gtk_widget_set_double_buffered (GTK_WIDGET (clutter), FALSE);
+
+  priv->stage = clutter_stage_get_default ();
+  priv->embedded = FALSE;
+}
+
+/**
+ * gtk_clutter_get_stage:
+ * @clutter: A #GtkClutter object.
+ *
+ * Obtains the #ClutterStage associated with this object.
+ *
+ * Return value: A #ClutterActor.
+ */
+ClutterActor *
+gtk_clutter_get_stage (GtkClutter *clutter)
+{
+  g_return_val_if_fail (GTK_IS_CLUTTER (clutter), NULL);
+
+  return clutter->priv->stage;
+}
+
+GtkWidget *
+gtk_clutter_new (void)
+{
+  return g_object_new (GTK_TYPE_CLUTTER, NULL);
+}
diff --git a/clutter-gtk/clutter-gtk.h b/clutter-gtk/clutter-gtk.h
new file mode 100644 (file)
index 0000000..c887bba
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * GTK-Clutter.
+ *
+ * GTK+ widget for Clutter.
+ *
+ * Authored By Iain Holmes  <iain@openedhand.com>
+ *
+ * Copyright (C) 2006 OpenedHand
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_CLUTTER_H__
+#define __GTK_CLUTTER_H__
+
+#include <gtk/gtksocket.h>
+#include <clutter/clutter-actor.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CLUTTER (gtk_clutter_get_type ())
+
+#define GTK_CLUTTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  GTK_TYPE_CLUTTER, GtkClutter))
+
+#define GTK_CLUTTER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CASE ((klass), \
+  GTK_TYPE_CLUTTER, GtkClutterClass))
+
+#define GTK_IS_CLUTTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  GTK_TYPE_CLUTTER))
+
+#define GTK_IS_CLUTTER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  GTK_TYPE_CLUTTER))
+
+#define GTK_CLUTTER_STAGE_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  GTK_TYPE_CLUTTER, GtkClutterClass))
+
+typedef struct _GtkClutter              GtkClutter;
+typedef struct _GtkClutterClass         GtkClutterClass;
+typedef struct _GtkClutterPrivate       GtkClutterPrivate;
+
+struct _GtkClutter 
+{
+  GtkSocket parent;
+
+  /*< private >*/
+  GtkClutterPrivate *priv;
+};
+
+struct _GtkClutterClass
+{
+  GtkSocketClass parent_class;
+
+  void (*_gtk_clutter_1) (void);
+  void (*_gtk_clutter_2) (void);
+  void (*_gtk_clutter_3) (void);
+  void (*_gtk_clutter_4) (void);
+  void (*_gtk_clutter_5) (void);
+  void (*_gtk_clutter_6) (void);
+};
+
+GType gtk_clutter_get_type (void) G_GNUC_CONST;
+
+GtkWidget    *gtk_clutter_new       (void);
+ClutterActor *gtk_clutter_get_stage (GtkClutter *clutter);
+
+G_END_DECLS
+
+#endif /* __GTK_CLUTTER_H__ */
diff --git a/clutter-gtk/gtk-clutter.c b/clutter-gtk/gtk-clutter.c
deleted file mode 100644 (file)
index dde71a9..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * GTK-Clutter.
- *
- * GTK+ widget for Clutter.
- *
- * Authored By Iain Holmes  <iain@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gtk-clutter
- * @short_description: GTK+ widget displaying a #ClutterStage.
- *
- * #GtkClutter is a GTK+ widget, derived from #GtkSocket that contains a
- * #ClutterStage, allowing it to be used in a GTK+ based program like any 
- * normal GTK+ widget.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gdk/gdkx.h>
-
-#include <gtk/gtkwidget.h>
-
-#include <clutter/clutter-main.h>
-#include <clutter/clutter-stage.h>
-
-#include "gtk-clutter.h"
-
-#define GTK_CLUTTER_GET_PRIVATE(obj) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CLUTTER, GtkClutterPrivate))
-
-struct _GtkClutterPrivate
-{
-  ClutterActor *stage;
-  gboolean embedded;
-};
-
-G_DEFINE_TYPE (GtkClutter, gtk_clutter, GTK_TYPE_SOCKET);
-
-static void
-gtk_clutter_destroy (GtkObject *object)
-{
-  GtkClutterPrivate *priv;
-
-  priv = GTK_CLUTTER (object)->priv;
-
-  if (priv->stage)
-    {
-      clutter_actor_destroy (priv->stage);
-      priv->stage = NULL;
-    }
-
-  GTK_OBJECT_CLASS (gtk_clutter_parent_class)->destroy (object);
-}
-
-static void
-gtk_clutter_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
-{
-  GtkClutterPrivate *priv = GTK_CLUTTER (widget)->priv;
-
-  clutter_actor_set_size (priv->stage,
-                          allocation->width,
-                          allocation->height);
-
-  if (CLUTTER_ACTOR_IS_VISIBLE (priv->stage))
-    clutter_actor_queue_redraw (priv->stage);
-
-  GTK_WIDGET_CLASS (gtk_clutter_parent_class)->size_allocate (widget, 
-                                                             allocation);
-}
-
-static void
-gtk_clutter_size_request (GtkWidget      *widget,
-                          GtkRequisition *req)
-{
-  GtkClutterPrivate *priv;
-
-  priv = GTK_CLUTTER (widget)->priv;
-
-  req->width = clutter_actor_get_width (priv->stage);
-  req->height = clutter_actor_get_height (priv->stage);
-}
-
-static void
-gtk_clutter_map (GtkWidget *widget)
-{
-  GtkClutterPrivate *priv;
-
-  priv = GTK_CLUTTER (widget)->priv;
-
-  if (priv->embedded == FALSE) {
-    gtk_socket_add_id (GTK_SOCKET (widget), 
-                      clutter_stage_get_xwindow (CLUTTER_STAGE(priv->stage)));
-    priv->embedded = TRUE;
-  }
-
-  GTK_WIDGET_CLASS (gtk_clutter_parent_class)->map (widget);
-}
-
-static void
-gtk_clutter_class_init (GtkClutterClass *klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  object_class->destroy = gtk_clutter_destroy;
-
-  widget_class->size_request = gtk_clutter_size_request;
-  widget_class->size_allocate = gtk_clutter_size_allocate;
-  widget_class->map = gtk_clutter_map;
-
-  g_type_class_add_private (gobject_class, sizeof (GtkClutterPrivate));
-}
-
-static void
-gtk_clutter_init (GtkClutter *clutter)
-{
-  GtkClutterPrivate *priv;
-
-  clutter->priv = priv = GTK_CLUTTER_GET_PRIVATE (clutter);
-
-  gtk_widget_set_double_buffered (GTK_WIDGET (clutter), FALSE);
-
-  priv->stage = clutter_stage_get_default ();
-  priv->embedded = FALSE;
-}
-
-/**
- * gtk_clutter_get_stage:
- * @clutter: A #GtkClutter object.
- *
- * Obtains the #ClutterStage associated with this object.
- *
- * Return value: A #ClutterActor.
- */
-ClutterActor *
-gtk_clutter_get_stage (GtkClutter *clutter)
-{
-  g_return_val_if_fail (GTK_IS_CLUTTER (clutter), NULL);
-
-  return clutter->priv->stage;
-}
-
-GtkWidget *
-gtk_clutter_new (void)
-{
-  return g_object_new (GTK_TYPE_CLUTTER, NULL);
-}
diff --git a/clutter-gtk/gtk-clutter.h b/clutter-gtk/gtk-clutter.h
deleted file mode 100644 (file)
index c887bba..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * GTK-Clutter.
- *
- * GTK+ widget for Clutter.
- *
- * Authored By Iain Holmes  <iain@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GTK_CLUTTER_H__
-#define __GTK_CLUTTER_H__
-
-#include <gtk/gtksocket.h>
-#include <clutter/clutter-actor.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_CLUTTER (gtk_clutter_get_type ())
-
-#define GTK_CLUTTER(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-  GTK_TYPE_CLUTTER, GtkClutter))
-
-#define GTK_CLUTTER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CASE ((klass), \
-  GTK_TYPE_CLUTTER, GtkClutterClass))
-
-#define GTK_IS_CLUTTER(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-  GTK_TYPE_CLUTTER))
-
-#define GTK_IS_CLUTTER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-  GTK_TYPE_CLUTTER))
-
-#define GTK_CLUTTER_STAGE_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-  GTK_TYPE_CLUTTER, GtkClutterClass))
-
-typedef struct _GtkClutter              GtkClutter;
-typedef struct _GtkClutterClass         GtkClutterClass;
-typedef struct _GtkClutterPrivate       GtkClutterPrivate;
-
-struct _GtkClutter 
-{
-  GtkSocket parent;
-
-  /*< private >*/
-  GtkClutterPrivate *priv;
-};
-
-struct _GtkClutterClass
-{
-  GtkSocketClass parent_class;
-
-  void (*_gtk_clutter_1) (void);
-  void (*_gtk_clutter_2) (void);
-  void (*_gtk_clutter_3) (void);
-  void (*_gtk_clutter_4) (void);
-  void (*_gtk_clutter_5) (void);
-  void (*_gtk_clutter_6) (void);
-};
-
-GType gtk_clutter_get_type (void) G_GNUC_CONST;
-
-GtkWidget    *gtk_clutter_new       (void);
-ClutterActor *gtk_clutter_get_stage (GtkClutter *clutter);
-
-G_END_DECLS
-
-#endif /* __GTK_CLUTTER_H__ */
index 5462efc..7b80ef3 100644 (file)
@@ -21,7 +21,7 @@ AC_PREREQ(2.53)
 AC_INIT([clutter-gtk],
         [clutter_version],
         [http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter])
-AC_CONFIG_SRCDIR([clutter-gtk/gtk-clutter.h])
+AC_CONFIG_SRCDIR([clutter-gtk/clutter-gtk.h])
 AM_CONFIG_HEADER([config.h])
 
 AM_INIT_AUTOMAKE([1.7])
index dde4b19..56c198c 100644 (file)
@@ -2,7 +2,7 @@
 #include <clutter/clutter.h>
 #include <math.h>
 
-#include <clutter-gtk/gtk-clutter.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #define TRAILS 0
 #define NHANDS  2
@@ -31,9 +31,6 @@ input_cb (ClutterStage *stage,
       ClutterButtonEvent *bev = (ClutterButtonEvent *) event;
       ClutterActor *e;
 
-      g_print ("*** button press event (button:%d) ***\n",
-              bev->button);
-
       e = clutter_stage_get_actor_at_pos (stage, 
                                            clutter_button_event_x (bev),
                                            clutter_button_event_y (bev));