From 432d6f93be857d2544ad19ba67caea22d5843cc5 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 5 Jul 2011 16:26:49 +0900 Subject: [PATCH] Supply hotkeys and symbol in engine desc. --- configure.ac | 3 + m4/.gitignore | 2 + m4/ibus.m4 | 52 +++++++++ src/default.xml.in.in | 284 +++++++++++++++++++++++++++++++++++++++++-------- src/m17nutil.c | 10 ++ src/m17nutil.h | 6 + 6 files changed, 312 insertions(+), 45 deletions(-) create mode 100644 m4/ibus.m4 Index: ibus-m17n-1.3.2/configure.ac =================================================================== --- ibus-m17n-1.3.2.orig/configure.ac +++ ibus-m17n-1.3.2/configure.ac @@ -114,6 +114,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GET AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION(0.16.1) +# hotkeys in component xml +IBUS_WITH_HOTKEYS + # 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 @@ -10,97 +10,114 @@ m17n:as:phonetic 2 FALSE + m17n:bn:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:gu:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:hi:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:kn:kgp 2 FALSE + m17n:ks:kbd 2 FALSE + m17n:mai:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:ml:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:mr:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:ne:rom 2 FALSE + m17n:or:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:pa:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:sa:harvard-kyoto 2 FALSE + m17n:sd:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:si:wijesekera 2 FALSE default[lv3:ralt_switch] + සි m17n:ta:tamil99 2 FALSE + m17n:te:inscript* 2 FALSE default[lv3:ralt_switch] + m17n:ja:anthy 0 TRUE - - - m17n:zh:cangjie - 0 - TRUE - - - m17n:zh:py-b5 - 0 - TRUE - - - m17n:zh:py-gb - 0 - TRUE - - - m17n:zh:py - 0 - TRUE - - - m17n:zh:quick - 0 - TRUE - - - m17n:zh:tonepy-b5 - 0 - TRUE - - - m17n:zh:tonepy-gb - 0 - TRUE - - - m17n:zh:tonepy - 0 - TRUE - - - m17n:zh:util - 0 - TRUE + @@ -167,92 +141,312 @@ m17n:as:* 1 FALSE + m17n:bn:* 1 FALSE + m17n:gu:* 1 FALSE + m17n:hi:* 1 FALSE + m17n:kn:* 1 FALSE + m17n:ks:* 1 FALSE + m17n:mai:* 1 FALSE + m17n:ml:* 1 FALSE + m17n:mr:* 1 FALSE + m17n:ne:* 1 FALSE + m17n:or:* 1 FALSE + m17n:pa:* 1 FALSE + m17n:sa:* 1 FALSE + m17n:sd:* 1 FALSE + m17n:si:* 1 FALSE default[lv3:ralt_switch] + සි m17n:ta:* 1 FALSE + m17n:te:* 1 FALSE + + + + + m17n:*:kbd + 0 + FALSE + + + + m17n:*:pre + 0 + FALSE + + + + m17n:*:post + 0 + FALSE + + + + m17n:am:sera + 0 + FALSE + + + + m17n:bo:* + 0 + FALSE + + + + m17n:cr:* + 0 + FALSE + + + + m17n:dv:* + 0 + FALSE + + + + m17n:eo:* + 0 + FALSE + + + + m17n:fa:* + 0 + FALSE + ف + + + m17n:fr:* + 0 + FALSE + + + + m17n:ii:* + 0 + FALSE + + + + m17n:iu:* + 0 + FALSE + + + + m17n:kk:* + 0 + FALSE + قا + + + m17n:km:* + 0 + FALSE + + + + m17n:lo:* + 0 + FALSE + + + + m17n:nsk:* + 0 + FALSE + + + + m17n:oj:* + 0 + FALSE + + + + m17n:ps:* + 0 + FALSE + + + + m17n:ru:* + 0 + FALSE + Я + + + m17n:sv:* + 0 + FALSE + + + + m17n:syrc:* + 0 + FALSE + + + + m17n:tai:* + 0 + FALSE + + + + m17n:th:* + 0 + FALSE + + + + m17n:ur:* + 0 + FALSE + خ + + + m17n:vi:han + 0 + FALSE + + + + m17n:vi:nom* + 0 + FALSE + + + + m17n:vi:* + 0 + FALSE + + + + m17n:yi:* + 0 + TRUE + + + + m17n:zh:bopomofo + 0 + TRUE + + + + m17n:zh:cangjie + 0 + TRUE + + + + m17n:zh:py* + 0 + TRUE + + + + m17n:zh:quick + 0 + TRUE + + + + m17n:zh:tonepy* + 0 + TRUE + m17n:* 0 FALSE + + @IBUS_HOTKEYS_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", config->layout ? config->layout : "us", "rank", config->rank, + "hotkeys", config->hotkeys ? config->hotkeys : "", + "symbol", config->symbol ? config->symbol : "", NULL); #else engine = ibus_engine_desc_new (engine_name, @@ -287,6 +289,14 @@ ibus_m17n_engine_config_parse_xml_node ( cnode->config.layout = g_strdup (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 @@ -17,6 +17,12 @@ struct _IBusM17NEngineConfig { /* keyboard layout */ gchar *layout; + /* hotkeys */ + gchar *hotkeys; + + /* symbol */ + gchar *symbol; + /* whether to highlight preedit */ gboolean preedit_highlight; };