Patch to embed hotkeys and symbol property in component XML. Index: ibus-m17n-1.3.2/configure.ac =================================================================== --- ibus-m17n-1.3.2.orig/configure.ac +++ ibus-m17n-1.3.2/configure.ac @@ -122,6 +122,10 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GET AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION(0.16.1) +# hotkeys in component xml +IBUS_WITH_HOTKEYS +IBUS_SET_SYMBOL([?]) + # OUTPUT files AC_CONFIG_FILES([ po/Makefile.in Index: ibus-m17n-1.3.2/m4/ibus.m4 =================================================================== --- /dev/null +++ ibus-m17n-1.3.2/m4/ibus.m4 @@ -0,0 +1,52 @@ +# IBUS_WITH_HOTKEYS([DEFAULT]) +AC_DEFUN([IBUS_WITH_HOTKEYS], [ + IBUS_HOTKEYS_DEFAULT=m4_default([$1], [Control+space,Zenkaku_Hankaku]) + AC_ARG_WITH(hotkeys, + [AC_HELP_STRING([--with-hotkeys=HOTKEYS], + [Use hotkeys for ibus bridge mode. (available value: yes/no/keys)])], + [with_hotkeys="$withval"], + [with_hotkeys="no"]) + if test x$with_hotkeys = xno; then + IBUS_HOTKEYS_XML="" + elif test x$with_hotkeys = xyes -o x$with_hotkeys = x; then + IBUS_HOTKEYS="$IBUS_HOTKEYS_DEFAULT" + IBUS_HOTKEYS_XML="${IBUS_HOTKEYS}" + else + IBUS_HOTKEYS="$with_hotkeys" + IBUS_HOTKEYS_XML="${IBUS_HOTKEYS}" + fi + if test x$IBUS_HOTKEYS != x; then + AC_DEFINE_UNQUOTED(IBUS_IBUS_HOTKEYS, ["$IBUS_HOTKEYS"], + [IME specific hotkeys for IBus]) + AC_SUBST(IBUS_HOTKEYS) + fi + AC_SUBST(IBUS_HOTKEYS_XML) +]) + +# IBUS_SET_SYMBOL(SYMBOL) +AC_DEFUN([IBUS_SET_SYMBOL], [ + IBUS_SYMBOL="$1" + if test x$PYTHON = x; then + AM_PATH_PYTHON([2.5]) + fi + AC_MSG_CHECKING([if ibus supports icon symbol]) + $PYTHON <<_IBUS_SYMBOL_TEST +import ibus +engine = ibus.EngineDesc('test') +exit(not hasattr(engine, 'symbol')) +_IBUS_SYMBOL_TEST + if test $? -eq 0; then + IBUS_SYMBOL_XML="${IBUS_SYMBOL}" + AC_MSG_RESULT([yes]) + else + IBUS_SYMBOL_XML="" + IBUS_SYMBOL= + AC_MSG_RESULT([no]) + fi + if test x$IBUS_SYMBOL != x; then + AC_DEFINE_UNQUOTED([IBUS_SYMBOL], ["$IBUS_SYMBOL"], + [Icon symbol string for IBus]) + AC_SUBST(IBUS_SYMBOL) + fi + AC_SUBST(IBUS_SYMBOL_XML) +]) Index: ibus-m17n-1.3.2/src/default.xml.in.in =================================================================== --- ibus-m17n-1.3.2.orig/src/default.xml.in.in +++ ibus-m17n-1.3.2/src/default.xml.in.in @@ -254,5 +254,7 @@ m17n:* 0 FALSE + @IBUS_HOTKEYS_XML@ + @IBUS_SYMBOL_XML@ Index: ibus-m17n-1.3.2/src/m17nutil.c =================================================================== --- ibus-m17n-1.3.2.orig/src/m17nutil.c +++ ibus-m17n-1.3.2/src/m17nutil.c @@ -122,6 +122,8 @@ ibus_m17n_engine_new (MSymbol lang, "icon", engine_icon ? engine_icon : "", "layout", "us", "rank", config->rank, + "hotkeys", config->hotkeys ? config->hotkeys : "", + "symbol", config->symbol ? config->symbol : "", NULL); #else engine = ibus_engine_desc_new (engine_name, @@ -282,6 +284,14 @@ ibus_m17n_engine_config_parse_xml_node ( cnode->config.rank = atoi (sub_node->text); continue; } + if (g_strcmp0 (sub_node->name , "hotkeys") == 0) { + cnode->config.hotkeys = g_strdup (sub_node->text); + continue; + } + if (g_strcmp0 (sub_node->name , "symbol") == 0) { + cnode->config.symbol = g_strdup (sub_node->text); + continue; + } if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) { if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0) cnode->config.preedit_highlight = TRUE; Index: ibus-m17n-1.3.2/src/m17nutil.h =================================================================== --- ibus-m17n-1.3.2.orig/src/m17nutil.h +++ ibus-m17n-1.3.2/src/m17nutil.h @@ -14,6 +14,12 @@ struct _IBusM17NEngineConfig { /* engine rank */ gint rank; + /* hotkeys */ + gchar *hotkeys; + + /* symbol */ + gchar *symbol; + /* whether to highlight preedit */ gboolean preedit_highlight;