Permalink
Browse files

* Porting Woohaa to clutter-0.8

* Add --enable-helix support to use clutter-helix instead of clutter-gst
  • Loading branch information...
1 parent f39550b commit 6ff283bfaaaffa3975f0c33be8f10d1b4a9aa3f0 @rustylynch rustylynch committed Oct 30, 2008
View
@@ -4,12 +4,10 @@ bin_PROGRAMS=woohaa wh-video-thumbnailer
PKGDATADIR = $(datadir)/woohaa
-AM_CFLAGS = $(DEPS_CFLAGS) $(GCC_FLAGS) -D_GNU_SOURCE -DPKGDATADIR=\"$(PKGDATADIR)\"
+AM_CFLAGS = $(DEPS_CFLAGS) $(CLUTTER_HELIX_CFLAGS) $(GCC_FLAGS) -D_GNU_SOURCE -DPKGDATADIR=\"$(PKGDATADIR)\"
-woohaa_LDADD = $(DEPS_LIBS)
+woohaa_LDADD = $(DEPS_LIBS) $(CLUTTER_HELIX_LIBS)
woohaa_SOURCES = woohaa.c \
- clutter-simple-layout.c \
- clutter-simple-layout.h \
wh-busy.c \
wh-busy.h \
wh-slider-menu.c \
View
@@ -17,8 +17,9 @@ Keys:
p - pause
Enter - toggle on screen display
Esc - exit back to list
- e - bonus useless feature.
+ r - rotate the screen 180 degrees
Remember its a prototype.
- -- Matthew Allum
+ -- Matthew Allum
+
@@ -1,121 +0,0 @@
-#include "clutter-simple-layout.h"
-
-G_DEFINE_TYPE (ClutterSimpleLayout, clutter_simple_layout, CLUTTER_TYPE_GROUP);
-
-#define CLUTTER_SIMPLE_LAYOUT_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- CLUTTER_TYPE_SIMPLE_LAYOUT, \
- ClutterSimpleLayoutPrivate))
-
-typedef struct _ClutterSimpleLayoutPrivate
-{
- int allocated_width, allocated_height;
-}
-ClutterSimpleLayoutPrivate;
-
-static void
-clutter_simple_layout_dispose (GObject *object)
-{
- if (G_OBJECT_CLASS (clutter_simple_layout_parent_class)->dispose)
- G_OBJECT_CLASS (clutter_simple_layout_parent_class)->dispose (object);
-}
-
-static void
-clutter_simple_layout_finalize (GObject *object)
-{
- G_OBJECT_CLASS (clutter_simple_layout_parent_class)->finalize (object);
-}
-
-static void
-clutter_simple_layout_request_coords (ClutterActor *self,
- ClutterActorBox *box)
-{
- ClutterSimpleLayoutPrivate *priv = CLUTTER_SIMPLE_LAYOUT_PRIVATE(self);
-
- priv->allocated_width = CLUTTER_UNITS_TO_INT(box->x2 - box->x1);
- priv->allocated_height = CLUTTER_UNITS_TO_INT(box->y2 - box->y1);
-
- /*
- printf("setting clip to %ix%i\n",
- priv->allocated_width, priv->allocated_height);
- */
- clutter_actor_set_clip (self, 0, 0,
- priv->allocated_width, priv->allocated_height);
-}
-
-static void
-clutter_simple_layout_query_coords (ClutterActor *self,
- ClutterActorBox *box)
-{
- ClutterSimpleLayoutPrivate *priv = CLUTTER_SIMPLE_LAYOUT_PRIVATE(self);
-
- box->x2 = box->x1 + CLUTTER_UNITS_FROM_INT(priv->allocated_width);
- box->y2 = box->y1 + CLUTTER_UNITS_FROM_INT(priv->allocated_height);
-}
-
-static void
-clutter_simple_layout_class_init (ClutterSimpleLayoutClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
-
- actor_class->request_coords = clutter_simple_layout_request_coords;
- actor_class->query_coords = clutter_simple_layout_query_coords;
-
- object_class->dispose = clutter_simple_layout_dispose;
- object_class->finalize = clutter_simple_layout_finalize;
-
- g_type_class_add_private (klass, sizeof (ClutterSimpleLayoutPrivate));
-}
-
-static void
-add_handler (ClutterGroup *group,
- ClutterActor *actor,
- gpointer user_data)
-{
- ClutterSimpleLayoutPrivate *priv = CLUTTER_SIMPLE_LAYOUT_PRIVATE(group);
-
- g_object_set(actor, "x",
- (priv->allocated_width - clutter_actor_get_width(actor))/2,
- NULL);
- /*
- printf("x -> %i - %i / 2 = %i\n",
- priv->allocated_width,
- clutter_actor_get_width(actor),
- (priv->allocated_width - clutter_actor_get_width(actor))/2);
- */
-}
-
-static void
-remove_handler (ClutterGroup *group,
- ClutterActor *actor,
- gpointer user_data)
-{
-
- /* ClutterSimpleLayoutPrivate *priv = CLUTTER_SIMPLE_LAYOUT_PRIVATE(group); */
-
-}
-
-
-static void
-clutter_simple_layout_init (ClutterSimpleLayout *self)
-{
- g_signal_connect (self,
- "add",
- G_CALLBACK (add_handler),
- NULL);
-
- g_signal_connect (self,
- "remove",
- G_CALLBACK (remove_handler),
- NULL);
-
-}
-
-ClutterActor*
-clutter_simple_layout_new (void)
-{
- return CLUTTER_ACTOR(g_object_new (CLUTTER_TYPE_SIMPLE_LAYOUT, NULL));
-}
-
-
@@ -1,48 +0,0 @@
-/* clutter-simple-layout.h */
-
-#ifndef _CLUTTER_SIMPLE_LAYOUT
-#define _CLUTTER_SIMPLE_LAYOUT
-
-#include <glib-object.h>
-#include <clutter/clutter.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SIMPLE_LAYOUT clutter_simple_layout_get_type()
-
-#define CLUTTER_SIMPLE_LAYOUT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CLUTTER_TYPE_SIMPLE_LAYOUT, ClutterSimpleLayout))
-
-#define CLUTTER_SIMPLE_LAYOUT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CLUTTER_TYPE_SIMPLE_LAYOUT, ClutterSimpleLayoutClass))
-
-#define CLUTTER_IS_SIMPLE_LAYOUT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CLUTTER_TYPE_SIMPLE_LAYOUT))
-
-#define CLUTTER_IS_SIMPLE_LAYOUT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CLUTTER_TYPE_SIMPLE_LAYOUT))
-
-#define CLUTTER_SIMPLE_LAYOUT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CLUTTER_TYPE_SIMPLE_LAYOUT, ClutterSimpleLayoutClass))
-
-typedef struct {
- ClutterGroup parent;
-} ClutterSimpleLayout;
-
-typedef struct {
- ClutterGroupClass parent_class;
-} ClutterSimpleLayoutClass;
-
-GType clutter_simple_layout_get_type (void);
-
-ClutterActor*
-clutter_simple_layout_new (void);
-
-G_END_DECLS
-
-#endif /* _CLUTTER_SIMPLE_LAYOUT */
View
@@ -9,14 +9,32 @@ AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
-PKG_CHECK_MODULES(DEPS, clutter-0.6 gnome-vfs-2.0 clutter-gst-0.6 sqlite3 gdk-2.0 gconf-2.0)
+PKG_CHECK_MODULES(DEPS, clutter-0.8 gnome-vfs-2.0 clutter-gst-0.8 sqlite3 gdk-2.0 gdk-pixbuf-2.0 gconf-2.0)
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)
+AC_ARG_ENABLE([helix],
+ AS_HELP_STRING([--enable-helix],[enable helix]),
+ [enable_helix=$enableval],
+ [enable_helix=no])
+
if test "x$GCC" = "xyes"; then
GCC_FLAGS="-g -Wall"
fi
+if test "x$enable_helix" = "xyes"; then
+ PKG_CHECK_MODULES(CLUTTER_HELIX, [clutter-helix-0.8],
+ [has_helix=yes],
+ [has_helix=no])
+ if test "x$has_helix" = "xno"; then
+ AC_MSG_ERROR([Clutter-Helix libraries are not available.])
+ fi
+
+ GCC_FLAGS+=" -DUSE_HELIX"
+ AC_SUBST(CLUTTER_HELIX_CFLAGS)
+ AC_SUBST(CLUTTER_HELIX_LDFAGS)
+fi
+
AC_SUBST(GCC_FLAGS)
AC_OUTPUT([
View
@@ -7,18 +7,12 @@ ClutterActor*
util_actor_from_file (const gchar *path, int width, int height)
{
ClutterActor *actor;
- GdkPixbuf *pixbuf;
- pixbuf = gdk_pixbuf_new_from_file_at_size (path, width, height, NULL);
+ actor = clutter_texture_new_from_file (path, NULL);
+ if (actor)
+ clutter_actor_set_size (actor, width, height);
- if (pixbuf)
- {
- actor = clutter_texture_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
- return actor;
- }
-
- return NULL;
+ return actor;
}
ClutterActor*
@@ -44,12 +38,20 @@ util_texture_from_root_window (void)
if (pixbuf)
{
- texture = clutter_texture_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
- return texture;
+
+ texture = clutter_texture_new ();
+ clutter_texture_set_from_rgb_data (CLUTTER_TEXTURE (texture),
+ gdk_pixbuf_get_pixels (pixbuf),
+ gdk_pixbuf_get_has_alpha (pixbuf),
+ gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf),
+ gdk_pixbuf_get_rowstride (pixbuf),
+ gdk_pixbuf_get_n_channels (pixbuf),
+ 0,
+ NULL);
}
- return NULL;
+ return texture;
}
guint32
Oops, something went wrong.

0 comments on commit 6ff283b

Please sign in to comment.