2011-09-01 10:18:22 +00:00
|
|
|
From 7a3f7a425977c685ad64a4ec44682926ef345ea1 Mon Sep 17 00:00:00 2001
|
2011-08-05 09:17:54 +00:00
|
|
|
From: Daiki Ueno <ueno@unixuser.org>
|
2011-09-01 10:18:22 +00:00
|
|
|
Date: Wed, 31 Aug 2011 11:44:46 +0900
|
|
|
|
Subject: [PATCH 4/5] Supply hotkeys and symbol in engine desc.
|
2011-08-05 09:17:54 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
configure.ac | 3 +
|
|
|
|
m4/.gitignore | 2 +
|
2011-09-01 10:18:22 +00:00
|
|
|
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(-)
|
2011-08-05 09:17:54 +00:00
|
|
|
create mode 100644 m4/ibus.m4
|
|
|
|
|
2011-09-01 10:18:22 +00:00
|
|
|
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
|
2011-07-07 05:37:21 +00:00
|
|
|
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
|
2011-09-01 10:18:22 +00:00
|
|
|
diff --git a/m4/ibus.m4 b/m4/ibus.m4
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..f8f074a
|
2011-07-07 05:37:21 +00:00
|
|
|
--- /dev/null
|
2011-09-01 10:18:22 +00:00
|
|
|
+++ b/m4/ibus.m4
|
2011-07-07 05:37:21 +00:00
|
|
|
@@ -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)
|
|
|
|
+])
|
2011-09-01 10:18:22 +00:00
|
|
|
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>
|
2011-08-05 09:17:54 +00:00
|
|
|
<rank>0</rank>
|
|
|
|
<preedit-highlight>FALSE</preedit-highlight>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ <symbol></symbol>
|
|
|
|
+ @IBUS_HOTKEYS_XML@
|
2011-08-05 09:17:54 +00:00
|
|
|
</engine>
|
2011-09-01 10:18:22 +00:00
|
|
|
<!-- Indic engines should be selected by default:
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
|
|
|
|
@@ -203,4 +205,209 @@
|
2011-08-05 09:17:54 +00:00
|
|
|
<name>m17n:ja:anthy</name>
|
|
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
|
|
</engine>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ <!-- Set IME symbols. -->
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:as:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>ক</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:bn:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>ক</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:gu:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>ક</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:hi:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>क</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:kn:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>ಕ</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:ks:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>क</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:mai:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>क</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:ml:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>ക</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:mr:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>क</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:ne:*</name>
|
|
|
|
+ <symbol>ने</symbol>
|
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:or:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>କ</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:pa:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>ਕ</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:sa:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>क</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:sd:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>क</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:si:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>සි</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:ta:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <symbol>க</symbol>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
|
|
|
+ <name>m17n:te:*</name>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <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>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ <name>m17n:ja:anthy</name>
|
|
|
|
+ <symbol>あ</symbol>
|
|
|
|
+ </engine>
|
|
|
|
+ <engine>
|
2011-08-05 09:17:54 +00:00
|
|
|
+ <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>
|
2011-09-01 10:18:22 +00:00
|
|
|
+ </engine>
|
2011-07-07 05:37:21 +00:00
|
|
|
</engines>
|
2011-09-01 10:18:22 +00:00
|
|
|
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,
|
2011-07-07 05:37:21 +00:00
|
|
|
"icon", engine_icon ? engine_icon : "",
|
2011-08-08 01:15:01 +00:00
|
|
|
"layout", config->layout ? config->layout : "us",
|
2011-07-07 05:37:21 +00:00
|
|
|
"rank", config->rank,
|
|
|
|
+ "hotkeys", config->hotkeys ? config->hotkeys : "",
|
|
|
|
+ "symbol", config->symbol ? config->symbol : "",
|
|
|
|
NULL);
|
|
|
|
#else
|
|
|
|
engine = ibus_engine_desc_new (engine_name,
|
2011-09-01 10:18:22 +00:00
|
|
|
@@ -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;
|
2011-07-07 05:37:21 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
+ if (g_strcmp0 (sub_node->name , "hotkeys") == 0) {
|
|
|
|
+ cnode->config.hotkeys = g_strdup (sub_node->text);
|
2011-09-01 10:18:22 +00:00
|
|
|
+ cnode->mask |= ENGINE_CONFIG_HOTKEYS_MASK;
|
2011-07-07 05:37:21 +00:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (g_strcmp0 (sub_node->name , "symbol") == 0) {
|
|
|
|
+ cnode->config.symbol = g_strdup (sub_node->text);
|
2011-09-01 10:18:22 +00:00
|
|
|
+ cnode->mask |= ENGINE_CONFIG_SYMBOL_MASK;
|
2011-07-07 05:37:21 +00:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
|
|
|
|
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
|
|
|
|
cnode->config.preedit_highlight = TRUE;
|
2011-09-01 10:18:22 +00:00
|
|
|
diff --git a/src/m17nutil.h b/src/m17nutil.h
|
|
|
|
index c7b283e..21b1bb9 100644
|
|
|
|
--- a/src/m17nutil.h
|
|
|
|
+++ b/src/m17nutil.h
|
2011-08-08 01:15:01 +00:00
|
|
|
@@ -17,6 +17,12 @@ struct _IBusM17NEngineConfig {
|
|
|
|
/* keyboard layout */
|
|
|
|
gchar *layout;
|
2011-07-07 05:37:21 +00:00
|
|
|
|
|
|
|
+ /* hotkeys */
|
|
|
|
+ gchar *hotkeys;
|
|
|
|
+
|
|
|
|
+ /* symbol */
|
|
|
|
+ gchar *symbol;
|
|
|
|
+
|
|
|
|
/* whether to highlight preedit */
|
|
|
|
gboolean preedit_highlight;
|
2011-08-08 01:15:01 +00:00
|
|
|
};
|
2011-09-01 10:18:22 +00:00
|
|
|
--
|
|
|
|
1.7.6.1
|
|
|
|
|