Update to 1.3.1-11.

This commit is contained in:
Daiki Ueno 2010-12-10 15:43:35 +09:00
parent 169cd4afc2
commit 88f6916fdb
2 changed files with 148 additions and 86 deletions

View File

@ -159,12 +159,17 @@ index 07e4432..eaa8bd8 100644
) > $@
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
new file mode 100644
index 0000000..4acff1c
index 0000000..5c5d67d
--- /dev/null
+++ b/src/default.xml.in.in
@@ -0,0 +1,227 @@
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="utf-8"?>
+<engines>
+ <!-- This file defines the default config value for each
+ engine. The "engine" elements below are checked in
+ first-to-last order and a "name" element in an "engine"
+ element allows wildcard patterns. Please keep more
+ specific entries to appear first. -->
+ <!-- Indic engines which represent languages. -->
+ <engine>
+ <name>m17n:as:phonetic</name>
@ -251,6 +256,65 @@ index 0000000..4acff1c
+ <rank>2</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ </engine>
+ <!-- Samanala should have lower rank than other Sinhala
+ engines since it is the only non-keyboard input method in
+ Sinhala. -->
+ <engine>
+ <name>m17n:si:samanala</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ </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>
+ </engine>
+ <!-- Other Indic engines should be selected by default:
+ https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
+ <engine>
@ -338,56 +402,11 @@ index 0000000..4acff1c
+ <rank>1</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ </engine>
+ <!-- Chinese and Japanese engines which require preedit decoration. -->
+ <!-- Default for other engines. -->
+ <engine>
+ <name>m17n:ja:anthy</name>
+ <name>m17n:*</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>
+ <preedit-highlight>FALSE</preedit-highlight>
+ </engine>
+</engines>
diff --git a/src/engine.c b/src/engine.c
@ -1129,10 +1148,10 @@ index 3ea4394..97d72d2 100644
<engines exec=\"${libexecdir}/ibus-engine-m17n --xml\" />
</component>
diff --git a/src/m17nutil.c b/src/m17nutil.c
index ae0fe56..7bc4ea5 100644
index ae0fe56..6d6961f 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -7,39 +7,22 @@
@@ -7,39 +7,17 @@
static MConverter *utf8_converter = NULL;
@ -1154,12 +1173,8 @@ index ae0fe56..7bc4ea5 100644
- "m17n:si:wijesekera",
- "m17n:ta:tamil99",
- "m17n:te:inscript"
-};
+#define DEFAULT_XML (SETUPDIR "/default.xml")
+
+static IBusM17NEngineConfig default_config = {
+ .rank = 0,
+ .preedit_highlight = FALSE
};
-static const gchar *preedit_highlight[] = {
- "m17n:ja:anthy",
@ -1184,7 +1199,7 @@ index ae0fe56..7bc4ea5 100644
void
ibus_m17n_init_common (void)
{
@@ -101,11 +84,16 @@ guint
@@ -101,11 +79,16 @@ guint
ibus_m17n_parse_color (const gchar *hex)
{
guint color;
@ -1206,7 +1221,17 @@ index ae0fe56..7bc4ea5 100644
}
static IBusEngineDesc *
@@ -121,7 +109,6 @@ ibus_m17n_engine_new (MSymbol lang,
@@ -113,7 +96,8 @@ ibus_m17n_engine_new (MSymbol lang,
MSymbol name,
MText *title,
MText *icon,
- MText *desc)
+ MText *desc,
+ IBusM17NEngineConfig *config)
{
IBusEngineDesc *engine;
gchar *engine_name;
@@ -121,7 +105,6 @@ ibus_m17n_engine_new (MSymbol lang,
gchar *engine_title;
gchar *engine_icon;
gchar *engine_desc;
@ -1214,10 +1239,13 @@ index ae0fe56..7bc4ea5 100644
engine_name = g_strdup_printf ("m17n:%s:%s", msymbol_name (lang), msymbol_name (name));
@@ -141,14 +128,6 @@ ibus_m17n_engine_new (MSymbol lang,
/* set default rank to 0 */
engine->rank = 0;
@@ -138,16 +121,7 @@ ibus_m17n_engine_new (MSymbol lang,
"",
engine_icon ? engine_icon : "",
"us");
- /* set default rank to 0 */
- engine->rank = 0;
-
- for (i = 0; i < G_N_ELEMENTS(keymap); i++) {
- if (strcmp (engine_name, keymap[i]) == 0) {
- /* set rank of default keymap to 1 */
@ -1225,11 +1253,49 @@ index ae0fe56..7bc4ea5 100644
- break;
- }
- }
-
+ engine->rank = config->rank;
g_free (engine_name);
g_free (engine_longname);
g_free (engine_title);
@@ -241,11 +220,62 @@ ibus_m17n_list_engines (void)
@@ -178,10 +152,28 @@ ibus_m17n_list_engines (void)
MText *icon = NULL;
MText *desc = NULL;
MPlist *l;
+ gchar *engine_name;
+ IBusM17NEngineConfig *config;
lang = tag[1];
name = tag[2];
+ /* ignore input-method explicitly blacklisted in default.xml */
+ engine_name = g_strdup_printf ("m17n:%s:%s", msymbol_name (lang), msymbol_name (name));
+ config = ibus_m17n_get_engine_config (engine_name);
+ if (config == NULL) {
+ g_warning ("can't load config for %s", engine_name);
+ g_free (engine_name);
+ continue;
+ }
+ if (config->rank < 0) {
+ g_warning ("skipped %s since its rank is lower than 0",
+ engine_name);
+ g_free (engine_name);
+ continue;
+ }
+ g_free (engine_name);
+
l = minput_get_variable (lang, name, msymbol ("candidates-charset"));
if (l) {
/* check candidates encoding */
@@ -226,7 +218,7 @@ ibus_m17n_list_engines (void)
icon = mplist_value (n);
}
- engines = g_list_append (engines, ibus_m17n_engine_new (lang, name, title, icon, desc));
+ engines = g_list_append (engines, ibus_m17n_engine_new (lang, name, title, icon, desc, config));
if (desc)
m17n_object_unref (desc);
@@ -241,11 +233,58 @@ ibus_m17n_list_engines (void)
return engines;
}
@ -1244,7 +1310,7 @@ index ae0fe56..7bc4ea5 100644
+ if (g_pattern_match_simple (cnode->name, engine_name))
+ return &cnode->config;
+ }
+ return &default_config;
+ g_return_val_if_reached (NULL);
+}
+
+static gboolean
@ -1253,10 +1319,6 @@ index ae0fe56..7bc4ea5 100644
+{
+ GList *p;
+
+ cnode->name = NULL;
+ memcpy (&cnode->config, &default_config,
+ sizeof (IBusM17NEngineConfig));
+
+ for (p = node->sub_nodes; p != NULL; p = p->next) {
+ XMLNode *sub_node = (XMLNode *) p->data;
+
@ -1292,7 +1354,7 @@ index ae0fe56..7bc4ea5 100644
component = ibus_component_new ("org.freedesktop.IBus.M17n",
N_("M17N"),
@@ -256,26 +286,45 @@ ibus_m17n_get_component (void)
@@ -256,26 +295,39 @@ ibus_m17n_get_component (void)
"",
"ibus-m17n");
@ -1308,7 +1370,7 @@ index ae0fe56..7bc4ea5 100644
+ continue;
+ }
+
+ cnode = g_slice_new (IBusM17NEngineConfigNode);
+ cnode = g_slice_new0 (IBusM17NEngineConfigNode);
+ if (!ibus_m17n_engine_config_parse_xml_node (cnode, sub_node)) {
+ g_slice_free (IBusM17NEngineConfigNode, cnode);
+ continue;
@ -1323,15 +1385,11 @@ index ae0fe56..7bc4ea5 100644
+
engines = ibus_m17n_list_engines ();
for (p = engines; p != NULL; p = p->next) {
- for (p = engines; p != NULL; p = p->next) {
- ibus_component_add_engine (component, (IBusEngineDesc *) p->data);
+ IBusEngineDesc *engine = p->data;
+ IBusM17NEngineConfig *config;
+
+ config = ibus_m17n_get_engine_config (engine->name);
+ engine->rank = config->rank;
+ ibus_component_add_engine (component, engine);
}
- }
+ for (p = engines; p != NULL; p = p->next)
+ ibus_component_add_engine (component, p->data);
g_list_free (engines);
- return component;
@ -1351,13 +1409,13 @@ index ae0fe56..7bc4ea5 100644
}
#ifdef DEBUG
@@ -304,4 +353,3 @@ int main ()
@@ -304,4 +356,3 @@ int main ()
return 0;
}
#endif
-
diff --git a/src/m17nutil.h b/src/m17nutil.h
index 7561505..5427b25 100644
index 7561505..a9be667 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -10,6 +10,16 @@
@ -1365,10 +1423,10 @@ index 7561505..5427b25 100644
#define PREEDIT_BACKGROUND 0x00c8c8f0
+struct _IBusM17NEngineConfig {
+ /* engine rank (default 0) */
+ /* engine rank */
+ gint rank;
+
+ /* whether to highlight preedit (default FALSE) */
+ /* whether to highlight preedit */
+ gboolean preedit_highlight;
+};
+

View File

@ -2,7 +2,7 @@
Name: ibus-m17n
Version: 1.3.1
Release: 10%{?dist}
Release: 11%{?dist}
Summary: The M17N engine for IBus platform
License: GPLv2+
Group: System Environment/Libraries
@ -66,6 +66,10 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/ibus/component/*
%changelog
* Fri Dec 10 2010 Daiki Ueno <dueno@redhat.com> - 1.3.1-11
- Update ibus-m17n-HEAD.patch.
- Lower si-samanala.mim rank per request from a Sinhala user.
* Wed Dec 8 2010 Daiki Ueno <dueno@redhat.com> - 1.3.1-10
- Update ibus-m17n-HEAD.patch.
- Fix bug 658336 - ibus-m17n: define the IM ranks in a config file and