+2008-01-23 Emmanuele Bassi <ebassi@openedhand.com>
+
+ * configure.ac: Bump up to 0.5.1 and require Clutter 0.5.3
+ using clutter-x11.
+
+ * clutter-gtk.pc.in: Require clutter-x11-0.5.
+
+ * clutter-gtk/Makefile.am:
+ * clutter-gtk/gtk-clutter-embed.[ch]: Add the new GtkClutterEmbed
+ widget; this widget reverts back to the old, pre-XEMBED implementation
+ of an embeddable stage, by letting Clutter draw directly onto a
+ child GdkWindow, thanks to the fixes that went into Clutter
+ core. (#716, #717, #718, based on a patch by Havoc Pennington)
+
+ * clutter-gtk/clutter-gtk.[ch]: Remove the XEMBED based embeddable
+ widget.
+
+ * examples/gtk-clutter-events.c:
+ * examples/gtk-clutter-test.c: Update the tests for the new API.
+
2008-01-17 Emmanuele Bassi <ebassi@openedhand.com>
* NEWS:
Version: @VERSION@
Libs: -L${libdir} -lclutter-gtk-0.5
Cflags: -I${includedir}/clutter-0.5/clutter-gtk
-Requires: clutter-0.5 gtk+-2.0
+Requires: clutter-x11-0.5 gtk+-2.0
lib_LTLIBRARIES = libclutter-gtk-0.5.la
-libclutter_gtk_0_5_la_SOURCES = clutter-gtk.c
+libclutter_gtk_0_5_la_SOURCES = gtk-clutter-embed.c
libclutter_gtk_0_5_la_LIBADD = $(CLUTTER_LIBS) $(GTK_LIBS)
libclutter_gtk_0_5_la_LDFLAGS = $(CLUTTER_LT_LDFLAGS)
cluttergtkheadersdir = $(includedir)/clutter-0.5/clutter-gtk
-cluttergtkheaders_HEADERS = clutter-gtk.h
+cluttergtkheaders_HEADERS = gtk-clutter-embed.h
+++ /dev/null
-/*
- * 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/clutter-x11.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;
-
- guint is_embedded : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_EMBEDDED
-};
-
-G_DEFINE_TYPE (GtkClutter, gtk_clutter, GTK_TYPE_SOCKET);
-
-static void
-gtk_clutter_destroy (GtkObject *object)
-{
- GtkClutterPrivate *priv;
-
- 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)
- 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)
-{
- GtkSocket *socket = GTK_SOCKET (widget);
- GtkClutterPrivate *priv = GTK_CLUTTER (widget)->priv;
- ClutterStage *stage = CLUTTER_STAGE (priv->stage);
-
- if (!priv->is_embedded)
- {
- g_object_ref (widget);
-
- gtk_socket_add_id (socket, clutter_x11_get_stage_window (stage));
- priv->is_embedded = TRUE;
-
- g_object_notify (G_OBJECT (widget), "embedded");
- g_object_unref (widget);
- }
-
- GTK_WIDGET_CLASS (gtk_clutter_parent_class)->map (widget);
-}
-
-static void
-gtk_clutter_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkClutter *gtk_clutter = GTK_CLUTTER (gobject);
-
- switch (prop_id)
- {
- case PROP_EMBEDDED:
- g_value_set_boolean (value, gtk_clutter->priv->is_embedded);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-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);
-
- gobject_class->get_property = gtk_clutter_get_property;
-
- 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_object_class_install_property (gobject_class,
- PROP_EMBEDDED,
- g_param_spec_boolean ("embedded",
- "Embedded",
- "Whether the stage has been successfully embedded",
- FALSE,
- G_PARAM_READABLE));
-
- 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);
- 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;
-}
-
-/**
- * gtk_clutter_get_stage:
- * @clutter: A #GtkClutter object.
- *
- * Obtains the #ClutterStage associated with this object.
- *
- * Return value: the main stage
- */
-ClutterActor *
-gtk_clutter_get_stage (GtkClutter *clutter)
-{
- g_return_val_if_fail (GTK_IS_CLUTTER (clutter), NULL);
-
- return clutter->priv->stage;
-}
-
-/**
- * gtk_clutter_new:
- *
- * Creates a new #GtkClutter widget. You can use this widget inside
- * any GTK+ application. Once you added it to a container you should
- * call gtk_clutter_get_stage() to obtain the #ClutterStage and add
- * Clutter actors to it.
- *
- * All the mouse events will be forwarded to the stage.
- *
- * Return value: the newly created #GtkClutter widget
- */
-GtkWidget *
-gtk_clutter_new (void)
-{
- return g_object_new (GTK_TYPE_CLUTTER, NULL);
-}
+++ /dev/null
-/*
- * 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
-{
- /*< private >*/
- GtkSocket parent;
-
- GtkClutterPrivate *priv;
-};
-
-struct _GtkClutterClass
-{
- /*< private >*/
- 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__ */
--- /dev/null
+/* gtk-clutter-embed.c: Embeddable ClutterStage
+ *
+ * Copyright (C) 2007 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 see <http://www.fsf.org/licensing>.
+ *
+ * Authors:
+ * Iain Holmes <iain@openedhand.com>
+ * Emmanuele Bassi <ebassi@openedhand.com>
+ */
+
+/**
+ * SECTION:gtk-clutter-embed
+ * @short_description: Widget for embedding a Clutter scene
+ *
+ * #GtkClutterEmbed is a GTK+ widget embedding a #ClutterStage. Using
+ * a #GtkClutterEmbed widget is possible to build, show and interact with
+ * a scene built using Clutter inside a GTK+ application.
+ *
+ * Since: 0.6
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib-object.h>
+
+#include <clutter/clutter-main.h>
+#include <clutter/clutter-stage.h>
+
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#include <clutter/clutter-x11.h>
+
+#include "gtk-clutter-embed.h"
+
+G_DEFINE_TYPE (GtkClutterEmbed, gtk_clutter_embed, GTK_TYPE_WIDGET);
+
+#define GTK_CLUTTER_EMBED_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_CLUTTER_EMBED, GtkClutterEmbedPrivate))
+
+struct _GtkClutterEmbedPrivate
+{
+ ClutterActor *stage;
+};
+
+static void
+gtk_clutter_embed_dispose (GObject *gobject)
+{
+ G_OBJECT_CLASS (gtk_clutter_embed_parent_class)->dispose (gobject);
+}
+
+static void
+gtk_clutter_embed_realize (GtkWidget *widget)
+{
+ GtkClutterEmbedPrivate *priv = GTK_CLUTTER_EMBED (widget)->priv;
+ GdkWindowAttr attributes;
+ int attributes_mask;
+
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.colormap = gtk_widget_get_colormap (widget);
+ attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
+
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes,
+ attributes_mask);
+ gdk_window_set_user_data (widget->window, widget);
+
+ widget->style = gtk_style_attach (widget->style, widget->window);
+ gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+
+ gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
+
+ clutter_x11_set_stage_foreign (CLUTTER_STAGE (priv->stage),
+ GDK_WINDOW_XID (widget->window));
+
+ /* allow a redraw here */
+ clutter_actor_queue_redraw (priv->stage);
+}
+
+static void
+gtk_clutter_embed_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GtkClutterEmbedPrivate *priv = GTK_CLUTTER_EMBED (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_embed_parent_class)->size_allocate (widget, allocation);
+}
+
+static gboolean
+gtk_clutter_embed_button_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ ClutterEvent cevent = { 0, };
+
+ if (event->type == GDK_BUTTON_PRESS ||
+ event->type == GDK_2BUTTON_PRESS ||
+ event->type == GDK_3BUTTON_PRESS)
+ cevent.type = cevent.button.type = CLUTTER_BUTTON_PRESS;
+ else if (event->type == GDK_BUTTON_RELEASE)
+ cevent.type = cevent.button.type = CLUTTER_BUTTON_RELEASE;
+ else
+ return FALSE;
+
+ cevent.button.x = event->x;
+ cevent.button.y = event->y;
+ cevent.button.time = event->time;
+ cevent.button.click_count =
+ (event->type == GDK_BUTTON_PRESS ? 1
+ : (event->type == GDK_2BUTTON_PRESS ? 2
+ : 3));
+ cevent.button.modifier_state = event->state;
+ cevent.button.button = event->button;
+
+ clutter_do_event (&cevent);
+
+ return TRUE;
+}
+
+static gboolean
+gtk_clutter_embed_key_event (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ ClutterEvent cevent = { 0, };
+
+ if (event->type == GDK_KEY_PRESS)
+ cevent.type = cevent.key.type = CLUTTER_KEY_PRESS;
+ else if (event->type == GDK_KEY_RELEASE)
+ cevent.type = cevent.key.type = CLUTTER_KEY_RELEASE;
+ else
+ return FALSE;
+
+ cevent.key.time = event->time;
+ cevent.key.modifier_state = event->state;
+ cevent.key.keyval = event->keyval;
+ cevent.key.hardware_keycode = event->hardware_keycode;
+
+ clutter_do_event (&cevent);
+
+ return TRUE;
+}
+
+static void
+gtk_clutter_embed_class_init (GtkClutterEmbedClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GtkClutterEmbedPrivate));
+
+ gobject_class->dispose = gtk_clutter_embed_dispose;
+
+ widget_class->size_allocate = gtk_clutter_embed_size_allocate;
+ widget_class->realize = gtk_clutter_embed_realize;
+ widget_class->button_press_event = gtk_clutter_embed_button_event;
+ widget_class->button_release_event = gtk_clutter_embed_button_event;
+ widget_class->key_press_event = gtk_clutter_embed_key_event;
+ widget_class->key_release_event = gtk_clutter_embed_key_event;
+}
+
+static void
+gtk_clutter_embed_init (GtkClutterEmbed *embed)
+{
+ GtkClutterEmbedPrivate *priv;
+ const XVisualInfo *xvinfo;
+ GdkVisual *visual;
+ GdkColormap *colormap;
+
+ embed->priv = priv = GTK_CLUTTER_EMBED_GET_PRIVATE (embed);
+
+ gtk_widget_set_double_buffered (GTK_WIDGET (embed), FALSE);
+
+ /* note we never ref or unref this */
+ priv->stage = clutter_stage_get_default ();
+
+ /* We need to use the colormap from the Clutter visual */
+ xvinfo = clutter_x11_get_stage_visual (CLUTTER_STAGE (priv->stage));
+ visual = gdk_x11_screen_lookup_visual (gdk_screen_get_default (),
+ xvinfo->visualid);
+ colormap = gdk_colormap_new (visual, FALSE);
+ gtk_widget_set_colormap (GTK_WIDGET (embed), colormap);
+}
+
+/**
+ * gtk_clutter_embed_new:
+ *
+ * FIXME
+ *
+ * Return value: the newly created #GtkClutterEmbed
+ *
+ * Since: 0.6
+ */
+GtkWidget *
+gtk_clutter_embed_new (void)
+{
+ return g_object_new (GTK_TYPE_CLUTTER_EMBED, NULL);
+}
+
+/**
+ * gtk_clutter_embed_get_stage:
+ * @embed: a #GtkClutterEmbed
+ *
+ * Retrieves the #ClutterStage from @embed. The returned stage can be
+ * used to add actors to the Clutter scene.
+ *
+ * Return value: the Clutter stage. You should never destroy or unref
+ * the returned actor.
+ *
+ * Since: 0.6
+ */
+ClutterActor *
+gtk_clutter_embed_get_stage (GtkClutterEmbed *embed)
+{
+ g_return_val_if_fail (GTK_IS_CLUTTER_EMBED (embed), NULL);
+
+ return embed->priv->stage;
+}
--- /dev/null
+/* gtk-clutter-embed.h: Embeddable ClutterStage
+ *
+ * Copyright (C) 2007 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 see <http://www.fsf.org/licensing>.
+ *
+ * Authors:
+ * Iain Holmes <iain@openedhand.com>
+ * Emmanuele Bassi <ebassi@openedhand.com>
+ */
+
+#ifndef __GTK_CLUTTER_EMBED_H__
+#define __GTK_CLUTTER_EMBED_H__
+
+#include <gtk/gtkwidget.h>
+#include <clutter/clutter-actor.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CLUTTER_EMBED (gtk_clutter_embed_get_type ())
+#define GTK_CLUTTER_EMBED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_CLUTTER_EMBED, GtkClutterEmbed))
+#define GTK_IS_CLUTTER_EMBED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_CLUTTER_EMBED))
+#define GTK_CLUTTER_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_CLUTTER_EMBED, GtkClutterEmbedClass))
+#define GTK_IS_CLUTTER_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_CLUTTER_EMBED))
+#define GTK_CLUTTER_EMBED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_CLUTTER_EMBED, GtkClutterEmbedClass))
+
+typedef struct _GtkClutterEmbed GtkClutterEmbed;
+typedef struct _GtkClutterEmbedPrivate GtkClutterEmbedPrivate;
+typedef struct _GtkClutterEmbedClass GtkClutterEmbedClass;
+
+/**
+ * GtkClutterEmbed:
+ *
+ * A #GtkWidget containing the default Clutter stage.
+ *
+ * Since: 0.6
+ */
+struct _GtkClutterEmbed
+{
+ /*< private >*/
+ GtkWidget parent_instance;
+
+ GtkClutterEmbedPrivate *priv;
+};
+
+/**
+ * GtkClutterEmbedClass:
+ *
+ * Base class for #GtkClutterEmbed.
+ *
+ * Since: 0.6
+ */
+struct _GtkClutterEmbedClass
+{
+ /*< private >*/
+ GtkWidgetClass parent_class;
+
+ /* padding for future expansion */
+ void (*_clutter_gtk_reserved1) (void);
+ void (*_clutter_gtk_reserved2) (void);
+ void (*_clutter_gtk_reserved3) (void);
+ void (*_clutter_gtk_reserved4) (void);
+ void (*_clutter_gtk_reserved5) (void);
+ void (*_clutter_gtk_reserved6) (void);
+};
+
+GType gtk_clutter_embed_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_clutter_embed_new (void);
+ClutterActor *gtk_clutter_embed_get_stage (GtkClutterEmbed *embed);
+
+G_END_DECLS
+
+#endif /* __GTK_CLUTTER_EMBED_H__ */
# An even micro number indicates a released version.
m4_define([clutter_major_version], [0])
m4_define([clutter_minor_version], [5])
-m4_define([clutter_micro_version], [0])
+m4_define([clutter_micro_version], [1])
m4_define([clutter_version],
[clutter_major_version.clutter_minor_version.clutter_micro_version])
AC_FUNC_MMAP
AC_CHECK_FUNCS([memset munmap strcasecmp strdup])
-CLUTTER_REQUIRED=0.5.2
+CLUTTER_REQUIRED=0.5.3
-PKG_CHECK_MODULES(CLUTTER, clutter-glx-0.5 >= $CLUTTER_REQUIRED)
+PKG_CHECK_MODULES(CLUTTER, clutter-x11-0.5 >= $CLUTTER_REQUIRED)
AC_SUBST(CLUTTER_CFLAGS)
AC_SUBST(CLUTTER_LIBS)
#include <gtk/gtk.h>
#include <clutter/clutter.h>
-#include <clutter-gtk/clutter-gtk.h>
+#include <clutter-gtk/gtk-clutter-embed.h>
typedef struct {
text->green = (guint8) ((color.green/65535.0) * 255);
text->blue = (guint8) ((color.blue/65535.0) * 255);
}
-
+
+static gboolean
+on_stage_capture (ClutterActor *actor,
+ ClutterEvent *event,
+ gpointer dummy)
+{
+ if (event->type == CLUTTER_BUTTON_RELEASE)
+ {
+ gint x, y;
+
+ clutter_event_get_coords (event, &x, &y);
+
+ g_print ("Event captured at (%d, %d)\n", x, y);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+on_hand_button_press (ClutterActor *actor,
+ ClutterButtonEvent *event,
+ gpointer dummy)
+{
+ g_print ("Button press on hand ('%s')\n",
+ g_type_name (G_OBJECT_TYPE (actor)));
+
+ return FALSE;
+}
+
gint
main (gint argc, gchar **argv)
{
/* Set up clutter & create our stage */
create_colors (app, &stage_color, &text_color);
- widget = gtk_clutter_new ();
+ widget = gtk_clutter_embed_new ();
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
- app->stage = gtk_clutter_get_stage (GTK_CLUTTER (widget));
+ app->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (widget));
clutter_stage_set_color (CLUTTER_STAGE (app->stage), &stage_color);
+ gtk_widget_set_size_request (widget, 640, 480);
+ g_signal_connect (app->stage, "captured-event",
+ G_CALLBACK (on_stage_capture),
+ NULL);
/* Create the main texture that the spin buttons manipulate */
pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);
clutter_actor_set_position (actor,
(CLUTTER_STAGE_WIDTH ()/2) - (width/2),
(CLUTTER_STAGE_HEIGHT ()/2) - (height/2));
+ clutter_actor_set_reactive (actor, TRUE);
+ g_signal_connect (actor, "button-press-event",
+ G_CALLBACK (on_hand_button_press),
+ NULL);
/* Setup the clutter entry */
actor = clutter_entry_new_full ("Sans 10", "", &text_color);
#include <clutter/clutter.h>
#include <math.h>
-#include <clutter-gtk/clutter-gtk.h>
+#include <clutter-gtk/gtk-clutter-embed.h>
#define TRAILS 0
#define NHANDS 2
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (window), vbox);
- clutter = gtk_clutter_new ();
+ clutter = gtk_clutter_embed_new ();
gtk_container_add (GTK_CONTAINER (vbox), clutter);
- stage = gtk_clutter_get_stage (GTK_CLUTTER (clutter));
+ stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter));
label = gtk_label_new ("This is a label");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);