From 9a6f41415b774541c69cb45cec96839b7228fe70 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Fri, 1 Oct 2010 12:13:14 +0900 Subject: [PATCH] Fix a build error with GTK3 gdkkeysyms.h Fix a build error with DBus-1.0.gir in gobject-introspection 0.9.6 --- configure.ac | 21 +++++++++++++++++++++ client/gtk2/ibusimcontext.c | 47 +++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 4 ++-- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/client/gtk3/ibusimcontext.c b/client/gtk3/ibusimcontext.c index c104f38..a7a2c59 100644 --- a/client/gtk3/ibusimcontext.c +++ b/client/gtk3/ibusimcontext.c @@ -24,6 +24,7 @@ # include #endif +#include #include #include #include @@ -34,6 +35,10 @@ #include #include "ibusimcontext.h" +#if !GTK_CHECK_VERSION (2, 90, 7) +# define DEPRECATED_GDK_KEYSYMS 1 +#endif + #ifdef DEBUG # define IDEBUG g_debug #else @@ -733,6 +738,7 @@ _key_is_modifier (guint keyval) * really should be implemented */ switch (keyval) { +#ifdef DEPRECATED_GDK_KEYSYMS case GDK_Shift_L: case GDK_Shift_R: case GDK_Control_L: @@ -759,6 +765,34 @@ _key_is_modifier (guint keyval) case GDK_ISO_Group_Latch: case GDK_ISO_Group_Lock: return TRUE; +#else + case GDK_KEY_Shift_L: + case GDK_KEY_Shift_R: + case GDK_KEY_Control_L: + case GDK_KEY_Control_R: + case GDK_KEY_Caps_Lock: + case GDK_KEY_Shift_Lock: + case GDK_KEY_Meta_L: + case GDK_KEY_Meta_R: + case GDK_KEY_Alt_L: + case GDK_KEY_Alt_R: + case GDK_KEY_Super_L: + case GDK_KEY_Super_R: + case GDK_KEY_Hyper_L: + case GDK_KEY_Hyper_R: + case GDK_KEY_ISO_Lock: + case GDK_KEY_ISO_Level2_Latch: + case GDK_KEY_ISO_Level3_Shift: + case GDK_KEY_ISO_Level3_Latch: + case GDK_KEY_ISO_Level3_Lock: + case GDK_KEY_ISO_Level5_Shift: + case GDK_KEY_ISO_Level5_Latch: + case GDK_KEY_ISO_Level5_Lock: + case GDK_KEY_ISO_Group_Shift: + case GDK_KEY_ISO_Group_Latch: + case GDK_KEY_ISO_Group_Lock: + return TRUE; +#endif default: return FALSE; } @@ -789,7 +823,11 @@ _create_gdk_event (IBusIMContext *ibusimcontext, event->group = 0; event->is_modifier = _key_is_modifier (keyval); +#ifdef DEPRECATED_GDK_KEYSYMS if (keyval != GDK_VoidSymbol) +#else + if (keyval != GDK_KEY_VoidSymbol) +#endif c = gdk_keyval_to_unicode (keyval); if (c) { @@ -819,12 +857,21 @@ _create_gdk_event (IBusIMContext *ibusimcontext, NULL); if (event->string) event->length = bytes_written; +#ifdef DEPRECATED_GDK_KEYSYMS } else if (keyval == GDK_Escape) { +#else + } else if (keyval == GDK_KEY_Escape) { +#endif event->length = 1; event->string = g_strdup ("\033"); } +#ifdef DEPRECATED_GDK_KEYSYMS else if (keyval == GDK_Return || keyval == GDK_KP_Enter) { +#else + else if (keyval == GDK_KEY_Return || + keyval == GDK_KEY_KP_Enter) { +#endif event->length = 1; event->string = g_strdup ("\r"); } diff --git a/configure.ac b/configure.ac index 3346d0c..9cd60a3 100644 --- a/configure.ac +++ b/configure.ac @@ -171,6 +171,25 @@ fi # GObject introspection GOBJECT_INTROSPECTION_CHECK([0.6.8]) +IBUS_GIR_SCANNERFLAGS= +IBUS_GIR_INCLUDES= +if test x"$found_introspection" = x"yes" ; then + IBUS_GIR_SCANNERFLAGS="--identifier-prefix=IBus --symbol-prefix=ibus" + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6], + [gir_symbol_prefix=yes], + [gir_symbol_prefix=no]) + if test x"$gir_symbol_prefix" = x"no" ; then + IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus" + fi + + DBUS_GIR_NAME=DBus-1.0 + if test -f ${INTROSPECTION_GIRDIR}/${DBUS_GIR_NAME}.gir ; then + IBUS_GIR_INCLUDES="${IBUS_GIR_INCLUDES} ${DBUS_GIR_NAME}" + fi +fi +AC_SUBST(IBUS_GIR_SCANNERFLAGS) +AC_SUBST(IBUS_GIR_INCLUDES) + # check for gtk-doc GTK_DOC_CHECK(1.9) if test x"$enable_gtk_doc" = x"no"; then @@ -386,6 +405,8 @@ Build options: Build gconf modules $enable_gconf Build memconf modules $enable_memconf Build introspection $found_introspection + IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS" + IBus-1.0.gir includes "$IBUS_GIR_INCLUDES" Build vala binding $enable_vala Build document $enable_gtk_doc Enable key snooper $enable_key_snooper diff --git a/src/Makefile.am b/src/Makefile.am index cdd3d7c..9519d5a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -138,8 +138,8 @@ introspection_files = \ ibusenumtypes.h \ $(NULL) IBus-1.0.gir: $(ibustargetlib) Makefile -IBus_1_0_gir_SCANNERFLAGS = --strip-prefix=IBus --pkg=dbus-1,glib-2.0 -IBus_1_0_gir_INCLUDES = GLib-2.0 GObject-2.0 +IBus_1_0_gir_SCANNERFLAGS = --pkg=dbus-1,glib-2.0 $(IBUS_GIR_SCANNERFLAGS) +IBus_1_0_gir_INCLUDES = GLib-2.0 GObject-2.0 $(IBUS_GIR_INCLUDES) IBus_1_0_gir_LIBS = $(ibustargetlib) IBus_1_0_gir_FILES = $(addprefix $(srcdir)/,$(introspection_files)) IBus_1_0_gir_CFLAGS = $(INCLUDES) -- 1.7.2.1