From ad221bfe4e6d1210b00bd51382433674bfbd21f3 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 30 Jun 2008 15:03:42 +0000 Subject: [PATCH] 2008-06-30 Emmanuele Bassi Bug 1000 - clutter-x11 should define gtypes for its enumerations * clutter/x11/Makefile.am: * clutter/x11/clutter-event-x11.c: * clutter/x11/clutter-x11-enum-types.c.in: * clutter/x11/clutter-x11-enum-types.h.in: * clutter/x11/clutter-x11.h: Add the GTypes for the X11-specific enumerations, so that they can be used by the bindings. (Andy Wingo) --- ChangeLog | 12 ++++++ clutter/x11/Makefile.am | 54 ++++++++++++++++++++----- clutter/x11/clutter-event-x11.c | 2 +- clutter/x11/clutter-x11-enum-types.c.in | 31 ++++++++++++++ clutter/x11/clutter-x11-enum-types.h.in | 26 ++++++++++++ clutter/x11/clutter-x11.h | 1 + 6 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 clutter/x11/clutter-x11-enum-types.c.in create mode 100644 clutter/x11/clutter-x11-enum-types.h.in diff --git a/ChangeLog b/ChangeLog index dcdb4665f..f444ffd82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-06-30 Emmanuele Bassi + + Bug 1000 - clutter-x11 should define gtypes for its enumerations + + * clutter/x11/Makefile.am: + * clutter/x11/clutter-event-x11.c: + * clutter/x11/clutter-x11-enum-types.c.in: + * clutter/x11/clutter-x11-enum-types.h.in: + * clutter/x11/clutter-x11.h: Add the GTypes for the X11-specific + enumerations, so that they can be used by the bindings. (Andy + Wingo) + 2008-06-30 Chris Lord * tests/test-shader.c: diff --git a/clutter/x11/Makefile.am b/clutter/x11/Makefile.am index 193971a51..74f6c615c 100644 --- a/clutter/x11/Makefile.am +++ b/clutter/x11/Makefile.am @@ -1,13 +1,3 @@ -libclutter_x11_includedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/clutter/x11 -libclutter_x11_include_HEADERS = clutter-x11.h \ - clutter-x11-texture-pixmap.h - -clutter-x11-$(CLUTTER_API_VERSION).pc: clutter-x11.pc - @cp -f $< $(@F) - -pkgconfig_DATA = clutter-x11-@CLUTTER_API_VERSION@.pc -pkgconfigdir = $(libdir)/pkgconfig - INCLUDES = \ -DG_LOG_DOMAIN=\"ClutterX11\" \ -I$(top_srcdir) \ @@ -19,6 +9,29 @@ INCLUDES = \ LDADD = $(CLUTTER_LIBS) +source_h = \ + clutter-x11-texture-pixmap.h \ + clutter-x11.h + +BUILT_SOURCES = clutter-x11-enum-types.h clutter-x11-enum-types.c + +clutter-x11-enum-types.h: stamp-clutter-x11-enum-types.h + @true +stamp-clutter-x11-enum-types.h: $(source_h) Makefile + ( $(GLIB_MKENUMS) \ + --template $(srcdir)/clutter-x11-enum-types.h.in \ + $(source_h) ) >> xgen-ceth && \ + (cmp xgen-ceth clutter-x11-enum-types.h || cp xgen-ceth clutter-x11-enum-types.h ) && \ + rm -f xgen-ceth && \ + echo timestamp > $(@F) + +clutter-x11-enum-types.c: clutter-x11-enum-types.h + ( $(GLIB_MKENUMS) \ + --template $(srcdir)/clutter-x11-enum-types.c.in \ + $(source_h) ) >> xgen-cetc && \ + cp xgen-cetc clutter-x11-enum-types.c && \ + rm -f xgen-cetc + noinst_LTLIBRARIES = libclutter-x11.la libclutter_x11_la_SOURCES = \ @@ -27,10 +40,29 @@ libclutter_x11_la_SOURCES = \ clutter-event-x11.c \ clutter-stage-x11.h \ clutter-stage-x11.c \ + clutter-x11-enum-types.h \ + clutter-x11-enum-types.c \ clutter-x11-texture-pixmap.h \ clutter-x11-texture-pixmap.c \ clutter-x11.h +libclutter_x11_includedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/clutter/x11 +libclutter_x11_include_HEADERS = \ + clutter-x11.h \ + clutter-x11-enum-types.h \ + clutter-x11-texture-pixmap.h + +clutter-x11-$(CLUTTER_API_VERSION).pc: clutter-x11.pc + @cp -f $< $(@F) + +pkgconfig_DATA = clutter-x11-@CLUTTER_API_VERSION@.pc +pkgconfigdir = $(libdir)/pkgconfig + CLEANFILES = clutter-x11-$(CLUTTER_API_VERSION).pc -EXTRA_DIST = clutter-x11.pc.in +DISTCLEANFILES = stamp-clutter-x11-enum-types.h + +EXTRA_DIST = \ + clutter-x11.pc.in \ + clutter-x11-enum-types.h.in \ + clutter-x11-enum-types.c.in diff --git a/clutter/x11/clutter-event-x11.c b/clutter/x11/clutter-event-x11.c index e1a4f7de1..38efe33d1 100644 --- a/clutter/x11/clutter-event-x11.c +++ b/clutter/x11/clutter-event-x11.c @@ -238,7 +238,7 @@ convert_xdevicekey_to_xkey (XDeviceKeyEvent *xkev, XEvent *xevent) xevent->xkey.keycode = xkev->keycode; xevent->xkey.same_screen = xkev->same_screen; } -#endif +#endif /* USE_XINPUT */ static void translate_key_event (ClutterBackend *backend, diff --git a/clutter/x11/clutter-x11-enum-types.c.in b/clutter/x11/clutter-x11-enum-types.c.in new file mode 100644 index 000000000..abb5e76b2 --- /dev/null +++ b/clutter/x11/clutter-x11-enum-types.c.in @@ -0,0 +1,31 @@ +/*** BEGIN file-header ***/ +#include "clutter-x11-enum-types.h" +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type(void) { + static GType etype = 0; + if (G_UNLIKELY (!etype)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + } + return etype; +} + +/*** END value-tail ***/ diff --git a/clutter/x11/clutter-x11-enum-types.h.in b/clutter/x11/clutter-x11-enum-types.h.in new file mode 100644 index 000000000..f63e936bb --- /dev/null +++ b/clutter/x11/clutter-x11-enum-types.h.in @@ -0,0 +1,26 @@ +/*** BEGIN file-header ***/ +#ifndef __CLUTTER_X11_ENUM_TYPES_H__ +#define __CLUTTER_X11_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* !__CLUTTER_X11_ENUM_TYPES_H__ */ +/*** END file-tail ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define CLUTTER_X11_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) + +/*** END value-header ***/ + diff --git a/clutter/x11/clutter-x11.h b/clutter/x11/clutter-x11.h index deed9c5fb..1cdb3188a 100644 --- a/clutter/x11/clutter-x11.h +++ b/clutter/x11/clutter-x11.h @@ -42,6 +42,7 @@ #include #include #include +#include #include G_BEGIN_DECLS