391 lines
9.9 KiB
Diff
391 lines
9.9 KiB
Diff
From 7a3f7a425977c685ad64a4ec44682926ef345ea1 Mon Sep 17 00:00:00 2001
|
|
From: Daiki Ueno <ueno@unixuser.org>
|
|
Date: Wed, 31 Aug 2011 11:44:46 +0900
|
|
Subject: [PATCH 4/5] Supply hotkeys and symbol in engine desc.
|
|
|
|
---
|
|
configure.ac | 3 +
|
|
m4/.gitignore | 2 +
|
|
m4/ibus.m4 | 52 ++++++++++++
|
|
src/default.xml.in.in | 207 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
src/m17nutil.c | 20 +++++-
|
|
src/m17nutil.h | 6 ++
|
|
6 files changed, 289 insertions(+), 1 deletions(-)
|
|
create mode 100644 m4/ibus.m4
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 4df68b6..089aafb 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -114,6 +114,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only
|
|
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
|
|
diff --git a/m4/.gitignore b/m4/.gitignore
|
|
index 0f4126c..e28d185 100644
|
|
--- a/m4/.gitignore
|
|
+++ b/m4/.gitignore
|
|
@@ -1 +1,3 @@
|
|
*.m4
|
|
+!ibus.m4
|
|
+
|
|
diff --git a/m4/ibus.m4 b/m4/ibus.m4
|
|
new file mode 100644
|
|
index 0000000..f8f074a
|
|
--- /dev/null
|
|
+++ b/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="<!-- <hotkeys>${IBUS_HOTKEYS_DEFAULT}</hotkeys> -->"
|
|
+ elif test x$with_hotkeys = xyes -o x$with_hotkeys = x; then
|
|
+ IBUS_HOTKEYS="$IBUS_HOTKEYS_DEFAULT"
|
|
+ IBUS_HOTKEYS_XML="<hotkeys>${IBUS_HOTKEYS}</hotkeys>"
|
|
+ else
|
|
+ IBUS_HOTKEYS="$with_hotkeys"
|
|
+ IBUS_HOTKEYS_XML="<hotkeys>${IBUS_HOTKEYS}</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="<symbol>${IBUS_SYMBOL}</symbol>"
|
|
+ AC_MSG_RESULT([yes])
|
|
+ else
|
|
+ IBUS_SYMBOL_XML="<!-- <symbol>${IBUS_SYMBOL}</symbol> -->"
|
|
+ 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)
|
|
+])
|
|
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
|
|
index 785ab05..8192878 100644
|
|
--- a/src/default.xml.in.in
|
|
+++ b/src/default.xml.in.in
|
|
@@ -10,6 +10,8 @@
|
|
<name>m17n:*</name>
|
|
<rank>0</rank>
|
|
<preedit-highlight>FALSE</preedit-highlight>
|
|
+ <symbol></symbol>
|
|
+ @IBUS_HOTKEYS_XML@
|
|
</engine>
|
|
<!-- Indic engines should be selected by default:
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
|
|
@@ -203,4 +205,209 @@
|
|
<name>m17n:ja:anthy</name>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
+ <!-- Set IME symbols. -->
|
|
+ <engine>
|
|
+ <name>m17n:as:*</name>
|
|
+ <symbol>ক</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:bn:*</name>
|
|
+ <symbol>ক</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:gu:*</name>
|
|
+ <symbol>ક</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:hi:*</name>
|
|
+ <symbol>क</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:kn:*</name>
|
|
+ <symbol>ಕ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ks:*</name>
|
|
+ <symbol>क</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:mai:*</name>
|
|
+ <symbol>क</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ml:*</name>
|
|
+ <symbol>ക</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:mr:*</name>
|
|
+ <symbol>क</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ne:*</name>
|
|
+ <symbol>ने</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:or:*</name>
|
|
+ <symbol>କ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:pa:*</name>
|
|
+ <symbol>ਕ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:sa:*</name>
|
|
+ <symbol>क</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:sd:*</name>
|
|
+ <symbol>क</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:si:*</name>
|
|
+ <symbol>සි</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ta:*</name>
|
|
+ <symbol>க</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:te:*</name>
|
|
+ <symbol>క</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:*:kbd</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:*:pre</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:*:post</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:am:sera</name>
|
|
+ <symbol>አ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:bo:*</name>
|
|
+ <symbol>ཀ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:cr:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:dv:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:eo:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:fa:*</name>
|
|
+ <symbol>ف</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:fr:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ii:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:iu:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ja:anthy</name>
|
|
+ <symbol>あ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:kk:*</name>
|
|
+ <symbol>قا</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:km:*</name>
|
|
+ <symbol>ក</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:lo:*</name>
|
|
+ <symbol>ກ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:nsk:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:oj:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ps:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ru:*</name>
|
|
+ <symbol>Я</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:sv:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:syrc:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:tai:*</name>
|
|
+ <symbol>꫞</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:th:*</name>
|
|
+ <symbol>ท</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ur:*</name>
|
|
+ <symbol>خ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:vi:han</name>
|
|
+ <symbol>越</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:vi:nom*</name>
|
|
+ <symbol>喃</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:vi:*</name>
|
|
+ <symbol>Ắ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:yi:*</name>
|
|
+ <symbol></symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:zh:bopomofo</name>
|
|
+ <symbol>ㄅ</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:zh:cangjie</name>
|
|
+ <symbol>倉</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:zh:py*</name>
|
|
+ <symbol>拼</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:zh:quick</name>
|
|
+ <symbol>簡</symbol>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:zh:tonepy*</name>
|
|
+ <symbol>调</symbol>
|
|
+ </engine>
|
|
</engines>
|
|
diff --git a/src/m17nutil.c b/src/m17nutil.c
|
|
index 06e1b58..3e6b9f1 100644
|
|
--- a/src/m17nutil.c
|
|
+++ b/src/m17nutil.c
|
|
@@ -12,7 +12,9 @@ static MConverter *utf8_converter = NULL;
|
|
typedef enum {
|
|
ENGINE_CONFIG_RANK_MASK = 1 << 0,
|
|
ENGINE_CONFIG_LAYOUT_MASK = 1 << 1,
|
|
- ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 2
|
|
+ ENGINE_CONFIG_HOTKEYS_MASK = 1 << 2,
|
|
+ ENGINE_CONFIG_SYMBOL_MASK = 1 << 3,
|
|
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 4
|
|
} EngineConfigMask;
|
|
|
|
struct _EngineConfigNode {
|
|
@@ -129,6 +131,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,
|
|
@@ -271,6 +275,10 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
|
|
config->rank = cnode->config.rank;
|
|
if (cnode->mask & ENGINE_CONFIG_LAYOUT_MASK)
|
|
config->layout = cnode->config.layout;
|
|
+ if (cnode->mask & ENGINE_CONFIG_HOTKEYS_MASK)
|
|
+ config->hotkeys = cnode->config.hotkeys;
|
|
+ if (cnode->mask & ENGINE_CONFIG_SYMBOL_MASK)
|
|
+ config->symbol = cnode->config.symbol;
|
|
if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
|
|
config->preedit_highlight = cnode->config.preedit_highlight;
|
|
}
|
|
@@ -309,6 +317,16 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
|
|
cnode->mask |= ENGINE_CONFIG_LAYOUT_MASK;
|
|
continue;
|
|
}
|
|
+ if (g_strcmp0 (sub_node->name , "hotkeys") == 0) {
|
|
+ cnode->config.hotkeys = g_strdup (sub_node->text);
|
|
+ cnode->mask |= ENGINE_CONFIG_HOTKEYS_MASK;
|
|
+ continue;
|
|
+ }
|
|
+ if (g_strcmp0 (sub_node->name , "symbol") == 0) {
|
|
+ cnode->config.symbol = g_strdup (sub_node->text);
|
|
+ cnode->mask |= ENGINE_CONFIG_SYMBOL_MASK;
|
|
+ continue;
|
|
+ }
|
|
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
|
|
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
|
|
cnode->config.preedit_highlight = TRUE;
|
|
diff --git a/src/m17nutil.h b/src/m17nutil.h
|
|
index c7b283e..21b1bb9 100644
|
|
--- a/src/m17nutil.h
|
|
+++ b/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;
|
|
};
|
|
--
|
|
1.7.6.1
|
|
|