From 9a6f41415b774541c69cb45cec96839b7228fe70 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Thu, 30 Sep 2010 10:58:31 +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 | 8 ++++++++ client/gtk2/ibusimcontext.c | 47 +++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 2 +- 3 files changed, 56 insertions(+), 1 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..73129f0 100644 --- a/configure.ac +++ b/configure.ac @@ -171,6 +171,13 @@ fi # GObject introspection GOBJECT_INTROSPECTION_CHECK([0.6.8]) +IBUS_GIR_INCLUDES= +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 +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 +393,7 @@ Build options: Build gconf modules $enable_gconf Build memconf modules $enable_memconf Build introspection $found_introspection + 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..3174b23 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -139,7 +139,7 @@ introspection_files = \ $(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_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