gir-repository r111 - in trunk: . gir
- From: lucasr svn gnome org
- To: svn-commits-list gnome org
- Subject: gir-repository r111 - in trunk: . gir
- Date: Wed, 8 Oct 2008 17:47:55 +0000 (UTC)
Author: lucasr
Date: Wed Oct 8 17:47:54 2008
New Revision: 111
URL: http://svn.gnome.org/viewvc/gir-repository?rev=111&view=rev
Log:
2008-10-08 Lucas Rocha <lucasr gnome org>
Bug 555296: Add custom lib with utility functions for simplifying
binding development on Clutter.
* configure.ac: add libtool stuff.
* gir/Clutter-custom.[ch]: utility library with custom utility
function that will help binding development in general.
* gir/Makefile.am: add librepo-Clutter-custom.la to the build.
Reference the custom lib when scanning the Clutter header files.
Added:
trunk/gir/Clutter-custom.c
trunk/gir/Clutter-custom.h
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/gir/Makefile.am
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Wed Oct 8 17:47:54 2008
@@ -5,6 +5,7 @@
AC_INIT(gir-repository, 0.1.0, http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=introspection)
AM_INIT_AUTOMAKE([-Wno-portability])
AM_MAINTAINER_MODE
+AC_PROG_LIBTOOL
AC_CONFIG_HEADER([config.h])
# GObject Introspection, required
Added: trunk/gir/Clutter-custom.c
==============================================================================
--- (empty file)
+++ trunk/gir/Clutter-custom.c Wed Oct 8 17:47:54 2008
@@ -0,0 +1,169 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* Copyright 2008 LiTL, LLC. All Rights Reserved. */
+
+#include <config.h>
+
+#include "Clutter-custom.h"
+
+ClutterColor*
+girepo_clutter_color_new (void)
+{
+ return g_slice_new0(ClutterColor);
+}
+
+GList *
+girepo_clutter_color_get_components(ClutterColor *color)
+{
+ GList *list;
+
+ list = NULL;
+ list = g_list_prepend(list, GINT_TO_POINTER((gint)color->alpha));
+ list = g_list_prepend(list, GINT_TO_POINTER((gint)color->blue));
+ list = g_list_prepend(list, GINT_TO_POINTER((gint)color->green));
+ list = g_list_prepend(list, GINT_TO_POINTER((gint)color->red));
+
+ return list;
+}
+
+void
+girepo_clutter_color_set_components(ClutterColor *color,
+ GList *components)
+{
+ g_return_if_fail(g_list_length(components) == 4);
+
+ color->red = GPOINTER_TO_INT(components->data);
+ components = g_list_next(components);
+ color->green = GPOINTER_TO_INT(components->data);
+ components = g_list_next(components);
+ color->blue = GPOINTER_TO_INT(components->data);
+ components = g_list_next(components);
+ color->alpha = GPOINTER_TO_INT(components->data);
+}
+
+gboolean
+girepo_clutter_texture_set_from_pixbuf (ClutterTexture *texture,
+ GdkPixbuf *pixbuf)
+{
+ return clutter_texture_set_from_rgb_data (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_has_alpha (pixbuf)
+ ? 4 : 3,
+ 0, NULL);
+}
+
+ClutterGeometry *
+girepo_clutter_geometry_new(void)
+{
+ return g_slice_new0(ClutterGeometry);
+}
+
+gint
+girepo_clutter_geometry_get_x(ClutterGeometry *geometry)
+{
+ return geometry->x;
+}
+
+gint
+girepo_clutter_geometry_get_y(ClutterGeometry *geometry)
+{
+ return geometry->y;
+}
+
+guint
+girepo_clutter_geometry_get_width(ClutterGeometry *geometry)
+{
+ return geometry->width;
+}
+
+guint
+girepo_clutter_geometry_get_height(ClutterGeometry *geometry)
+{
+ return geometry->height;
+}
+
+ClutterActorBox *
+girepo_clutter_actor_box_new(void)
+{
+ return g_slice_new0(ClutterActorBox);
+}
+
+/* return is ClutterUnit, but gint32 in gidl, so we want a warning here if that's ever wrong */
+gint32
+girepo_clutter_actor_box_get_x1(ClutterActorBox *actor_box)
+{
+ return actor_box->x1;
+}
+
+gint32
+girepo_clutter_actor_box_get_y1(ClutterActorBox *actor_box)
+{
+ return actor_box->y1;
+}
+
+gint32
+girepo_clutter_actor_box_get_x2(ClutterActorBox *actor_box)
+{
+ return actor_box->x2;
+}
+
+gint32
+girepo_clutter_actor_box_get_y2(ClutterActorBox *actor_box)
+{
+ return actor_box->y2;
+}
+
+/* we assume in the IDL that ClutterUnit is gint32, so use gint32 here to warn
+ * if that ever breaks
+ */
+gint
+girepo_clutter_units_to_device(gint32 units)
+{
+ return CLUTTER_UNITS_TO_DEVICE(units);
+}
+
+gint32
+girepo_clutter_device_to_units(gint device)
+{
+ return CLUTTER_UNITS_FROM_DEVICE(device);
+}
+
+gint
+girepo_clutter_event_get_x(ClutterEvent *event)
+{
+ int x;
+
+ clutter_event_get_coords(event, &x, NULL);
+
+ return x;
+}
+
+gint
+girepo_clutter_event_get_y(ClutterEvent *event)
+{
+ int y;
+
+ clutter_event_get_coords(event, NULL, &y);
+
+ return y;
+}
+
+ClutterVertex*
+girepo_clutter_vertex_new(void)
+{
+ return g_slice_new0(ClutterVertex);
+}
+
+void
+girepo_clutter_vertex_set_values(ClutterVertex *vertex,
+ int x,
+ int y,
+ int z)
+{
+ vertex->x = x;
+ vertex->y = y;
+ vertex->z = z;
+}
Added: trunk/gir/Clutter-custom.h
==============================================================================
--- (empty file)
+++ trunk/gir/Clutter-custom.h Wed Oct 8 17:47:54 2008
@@ -0,0 +1,43 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* Copyright 2008 LiTL, LLC. All Rights Reserved. */
+
+#ifndef __GIREPO_CLUTTER_CUSTOM_H__
+#define __GIREPO_CLUTTER_CUSTOM_H__
+
+#include <glib.h>
+#include <clutter/clutter.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+G_BEGIN_DECLS
+
+ClutterColor * girepo_clutter_color_new (void) G_GNUC_MALLOC;
+
+void girepo_clutter_color_set_components (ClutterColor *color,
+ GList *components);
+GList * girepo_clutter_color_get_components (ClutterColor *color);
+
+gboolean girepo_clutter_texture_set_from_pixbuf (ClutterTexture *texture,
+ GdkPixbuf *pixbuf);
+ClutterGeometry *girepo_clutter_geometry_new (void);
+gint girepo_clutter_geometry_get_x (ClutterGeometry *geometry);
+gint girepo_clutter_geometry_get_y (ClutterGeometry *geometry);
+guint girepo_clutter_geometry_get_width (ClutterGeometry *geometry);
+guint girepo_clutter_geometry_get_height (ClutterGeometry *geometry);
+ClutterActorBox *girepo_clutter_actor_box_new (void);
+gint32 girepo_clutter_actor_box_get_x1 (ClutterActorBox *actor_box);
+gint32 girepo_clutter_actor_box_get_y1 (ClutterActorBox *actor_box);
+gint32 girepo_clutter_actor_box_get_x2 (ClutterActorBox *actor_box);
+gint32 girepo_clutter_actor_box_get_y2 (ClutterActorBox *actor_box);
+gint girepo_clutter_units_to_device (gint32 units);
+gint32 girepo_clutter_device_to_units (gint device);
+gint girepo_clutter_event_get_x (ClutterEvent *event);
+gint girepo_clutter_event_get_y (ClutterEvent *event);
+ClutterVertex* girepo_clutter_vertex_new (void) G_GNUC_MALLOC;
+void girepo_clutter_vertex_set_values (ClutterVertex *vertex,
+ int x,
+ int y,
+ int z);
+
+G_END_DECLS
+
+#endif /* __GIREPO_CLUTTER_CUSTOM_H__ */
Modified: trunk/gir/Makefile.am
==============================================================================
--- trunk/gir/Makefile.am (original)
+++ trunk/gir/Makefile.am Wed Oct 8 17:47:54 2008
@@ -1,5 +1,7 @@
CLEANFILES =
EXTRA_DIST =
+lib_LTLIBRARIES =
+COMMON_CUSTOM_LDFLAGS= -module -avoid-version -rdynamic
CUSTOM_GIRSOURCES = \
cairo.gir \
@@ -331,6 +333,20 @@
# clutter
if BUILD_CLUTTER
+lib_LTLIBRARIES += libgirepo-Clutter-custom.la
+
+libgirepo_Clutter_custom_la_CPPFLAGS = \
+ $(CLUTTER_CFLAGS)
+
+libgirepo_Clutter_custom_la_LIBADD = \
+ $(CLUTTER_LIBS)
+
+libgirepo_Clutter_custom_la_LDFLAGS=$(COMMON_CUSTOM_LDFLAGS)
+
+libgirepo_Clutter_custom_la_SOURCES = \
+ Clutter-custom.c \
+ Clutter-custom.h
+
CLUTTER_INCLUDEDIR=`pkg-config --variable=includedir clutter-0.8`
CLUTTER_LIBDIR=`pkg-config --variable=libdir clutter-0.8`
ClutterJson.gir: $(G_IR_SCANNER)
@@ -344,8 +360,9 @@
-I$(CLUTTER_INCLUDEDIR) \
$(CLUTTER_INCLUDEDIR)/clutter-0.8/clutter/json/*.h
-Clutter.gir: ClutterJson.gir GdkPixbuf.gir Pango.gir PangoCairo.gir $(G_IR_SCANNER)
+Clutter.gir: libgirepo-Clutter-custom.la ClutterJson.gir GdkPixbuf.gir Pango.gir PangoCairo.gir $(G_IR_SCANNER)
$(G_IR_SCANNER) -v --namespace Clutter \
+ --strip-prefix=girepo \
--include=$(srcdir)/GL.gir \
--include=GObject.gir \
--include=$(srcdir)/xlib.gir \
@@ -354,13 +371,15 @@
--include=GdkPixbuf.gir \
--include=ClutterJson.gir \
--library=clutter-glx-0.8 \
+ --library=libgirepo-Clutter-custom.la \
$(NOCLOSURE) \
--pkg gobject-2.0 \
--pkg clutter-0.8 \
--output $@ \
-I$(CLUTTER_INCLUDEDIR) \
$(CLUTTER_INCLUDEDIR)/clutter-0.8/cogl/*.h \
- $(CLUTTER_INCLUDEDIR)/clutter-0.8/clutter/*.h
+ $(CLUTTER_INCLUDEDIR)/clutter-0.8/clutter/*.h \
+ $(builddir)/Clutter-custom.h
BUILT_GIRSOURCES += Clutter.gir ClutterJson.gir
endif BUILD_CLUTTER
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]