ibus-m17n/ibus-m17n-xx-icon-symbol.patch
2011-08-05 18:17:54 +09:00

624 lines
16 KiB
Diff

From 432d6f93be857d2544ad19ba67caea22d5843cc5 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
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
@@ -122,6 +122,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="<!-- <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)
+])
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 @@
<name>m17n:as:phonetic</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ক</symbol>
</engine>
<engine>
<name>m17n:bn:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>ক</symbol>
</engine>
<engine>
<name>m17n:gu:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>ક</symbol>
</engine>
<engine>
<name>m17n:hi:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:kn:kgp</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ಕ</symbol>
</engine>
<engine>
<name>m17n:ks:kbd</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:mai:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:ml:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>ക</symbol>
</engine>
<engine>
<name>m17n:mr:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:ne:rom</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
</engine>
<engine>
<name>m17n:or:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>କ</symbol>
</engine>
<engine>
<name>m17n:pa:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>ਕ</symbol>
</engine>
<engine>
<name>m17n:sa:harvard-kyoto</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:sd:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:si:wijesekera</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>සි</symbol>
</engine>
<engine>
<name>m17n:ta:tamil99</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>க</symbol>
</engine>
<engine>
<name>m17n:te:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>క</symbol>
</engine>
<!-- Samanala should have lower rank than other Sinhala
engines since it is the only non-keyboard input method in
@@ -109,57 +126,14 @@
<name>m17n:si:samanala</name>
<rank>0</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>සි</symbol>
</engine>
<!-- Chinese and Japanese engines which require preedit decoration. -->
<engine>
<name>m17n:ja:anthy</name>
<rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:cangjie</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:py-b5</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:py-gb</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:py</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:quick</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:tonepy-b5</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:tonepy-gb</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:tonepy</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:zh:util</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
+ <symbol>あ</symbol>
</engine>
<!-- Other Indic engines should be selected by default:
https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
@@ -167,92 +141,312 @@
<name>m17n:as:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ক</symbol>
</engine>
<engine>
<name>m17n:bn:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ক</symbol>
</engine>
<engine>
<name>m17n:gu:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ક</symbol>
</engine>
<engine>
<name>m17n:hi:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:kn:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ಕ</symbol>
</engine>
<engine>
<name>m17n:ks:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:mai:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:ml:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ക</symbol>
</engine>
<engine>
<name>m17n:mr:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:ne:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
</engine>
<engine>
<name>m17n:or:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>କ</symbol>
</engine>
<engine>
<name>m17n:pa:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ਕ</symbol>
</engine>
<engine>
<name>m17n:sa:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:sd:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:si:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
<xkb-options>lv3:ralt_switch</xkb-options>
+ <symbol>සි</symbol>
</engine>
<engine>
<name>m17n:ta:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>க</symbol>
</engine>
<engine>
<name>m17n:te:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol>క</symbol>
+ </engine>
+ <!-- Tweak symbols: for most maps, their "title" properties
+ fit in one character width. However, some of them are
+ bit longer. -->
+ <engine>
+ <name>m17n:*:kbd</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:*:pre</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:*:post</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:am:sera</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>አ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:bo:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ཀ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:cr:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:dv:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:eo:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:fa:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ف</symbol>
+ </engine>
+ <engine>
+ <name>m17n:fr:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:ii:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:iu:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:kk:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>قا</symbol>
+ </engine>
+ <engine>
+ <name>m17n:km:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ក</symbol>
+ </engine>
+ <engine>
+ <name>m17n:lo:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ກ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:nsk:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:oj:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:ps:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:ru:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>Я</symbol>
+ </engine>
+ <engine>
+ <name>m17n:sv:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:syrc:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:tai:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>꫞</symbol>
+ </engine>
+ <engine>
+ <name>m17n:th:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>ท</symbol>
+ </engine>
+ <engine>
+ <name>m17n:ur:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>خ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:vi:han</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>越</symbol>
+ </engine>
+ <engine>
+ <name>m17n:vi:nom*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>喃</symbol>
+ </engine>
+ <engine>
+ <name>m17n:vi:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ <symbol>Ắ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:yi:*</name>
+ <rank>0</rank>
+ <preedit-highlight>TRUE</preedit-highlight>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:bopomofo</name>
+ <rank>0</rank>
+ <preedit-highlight>TRUE</preedit-highlight>
+ <symbol>ㄅ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:cangjie</name>
+ <rank>0</rank>
+ <preedit-highlight>TRUE</preedit-highlight>
+ <symbol>倉</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:py*</name>
+ <rank>0</rank>
+ <preedit-highlight>TRUE</preedit-highlight>
+ <symbol>拼</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:quick</name>
+ <rank>0</rank>
+ <preedit-highlight>TRUE</preedit-highlight>
+ <symbol>簡</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:tonepy*</name>
+ <rank>0</rank>
+ <preedit-highlight>TRUE</preedit-highlight>
+ <symbol>调</symbol>
</engine>
<!-- Default for other engines. -->
<engine>
<name>m17n:*</name>
<rank>0</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ @IBUS_HOTKEYS_XML@
</engine>
</engines>
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;