Update to 1.3.2-11.

This commit is contained in:
Daiki Ueno 2011-09-01 19:18:22 +09:00
parent 480804d4c3
commit 01b9e72fe7
6 changed files with 1630 additions and 738 deletions

View File

@ -0,0 +1,621 @@
From 736e3f89d3afe368bec030b1f01d36b417fcac5c Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Wed, 31 Aug 2011 11:44:46 +0900
Subject: [PATCH 1/5] Update the format of default.xml to allow override.
This patch allows value inheritance from the previous matches.
With the new format:
<engines>
<engine>
<name>*</name>
<rank>0</rank>
<preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ja:*</name>
<rank>2</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:ja:anthy</name>
<rank>1</rank>
</engine>
</engines>
We will get preedit-highlight == TRUE and rank == 1 for m17n:ja:anthy.
---
src/Makefile.am | 3 +-
src/default.xml.in.in | 221 +++++++++++++++++++------------------------------
src/engine.c | 2 +
src/m17nutil.c | 68 +++++++---------
src/m17nutil.h | 1 +
src/test.c | 66 +++++++++++++++
6 files changed, 186 insertions(+), 175 deletions(-)
create mode 100644 src/test.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 282128a..e354149 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,11 +40,10 @@ TESTS = \
test_m17n_SOURCES = \
- m17nutil.c \
+ test.c \
$(NULL)
test_m17n_CFLAGS = \
$(AM_CFLAGS) \
- -DDEBUG \
$(NULL)
test_m17n_LDADD = \
libm17ncommon.a \
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index 5c5d67d..dc93fd3 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -1,246 +1,197 @@
<?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. A "name" element in an "engine" element allows
+ wildcard patterns. "engine" elements are evaluated in
+ first-to-last order and the latter match may override the
+ existing default. -->
+ <!-- Default for other engines. -->
+ <engine>
+ <name>m17n:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ </engine>
+ <!-- Indic engines should be selected by default:
+ https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
+ <engine>
+ <name>m17n:as:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:bn:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:gu:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:hi:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:kn:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ks:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:mai:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ml:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:mr:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ne:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:or:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:pa:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:sa:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:sd:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:si:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ta:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:te:*</name>
+ <rank>1</rank>
+ </engine>
+ <!-- Assign higher rank to Indic engines which represent each
+ language. -->
<engine>
<name>m17n:as:phonetic</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:bn:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:gu:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:hi:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:kn:kgp</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ks:kbd</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:mai:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ml:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:mr:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ne:rom</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:or:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:pa:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:sa:harvard-kyoto</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:sd:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:si:wijesekera</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ta:tamil99</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:te:inscript</name>
<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. -->
+ <!-- Assign lower rank to Sinhala Samanala since it is a
+ 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>
+ <!-- Some CJK engines use preedit. -->
<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>
+ <name>m17n:ja:anthy</name>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
- <!-- Other Indic engines should be selected by default:
- https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
- <engine>
- <name>m17n:as:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:bn:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:gu:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:hi:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:kn:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ks:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:mai:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ml:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:mr:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ne:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:or:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:pa:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:sa:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:sd:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:si:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ta:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:te:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <!-- Default for other engines. -->
- <engine>
- <name>m17n:*</name>
- <rank>0</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
</engines>
diff --git a/src/engine.c b/src/engine.c
index b68b13e..f1e3068 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -290,6 +290,8 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
&klass->lookup_table_orientation))
klass->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
+ ibus_m17n_engine_config_free (engine_config);
+
g_signal_connect (config, "value-changed",
G_CALLBACK(ibus_m17n_config_value_changed),
klass);
diff --git a/src/m17nutil.c b/src/m17nutil.c
index 1150cc4..00b7194 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -9,12 +9,18 @@ static MConverter *utf8_converter = NULL;
#define DEFAULT_XML (SETUPDIR "/default.xml")
-struct _IBusM17NEngineConfigNode {
+typedef enum {
+ ENGINE_CONFIG_RANK_MASK = 1 << 0,
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 1
+} EngineConfigMask;
+
+struct _EngineConfigNode {
gchar *name;
+ EngineConfigMask mask;
IBusM17NEngineConfig config;
};
-typedef struct _IBusM17NEngineConfigNode IBusM17NEngineConfigNode;
+typedef struct _EngineConfigNode EngineConfigNode;
static GSList *config_list = NULL;
@@ -253,20 +259,31 @@ ibus_m17n_list_engines (void)
IBusM17NEngineConfig *
ibus_m17n_get_engine_config (const gchar *engine_name)
{
+ IBusM17NEngineConfig *config = g_slice_new0 (IBusM17NEngineConfig);
GSList *p;
for (p = config_list; p != NULL; p = p->next) {
- IBusM17NEngineConfigNode *cnode = p->data;
+ EngineConfigNode *cnode = p->data;
- if (g_pattern_match_simple (cnode->name, engine_name))
- return &cnode->config;
+ if (g_pattern_match_simple (cnode->name, engine_name)) {
+ if (cnode->mask & ENGINE_CONFIG_RANK_MASK)
+ config->rank = cnode->config.rank;
+ if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
+ config->preedit_highlight = cnode->config.preedit_highlight;
+ }
}
- g_return_val_if_reached (NULL);
+ return config;
+}
+
+void
+ibus_m17n_engine_config_free (IBusM17NEngineConfig *config)
+{
+ g_slice_free (IBusM17NEngineConfig, config);
}
static gboolean
-ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
- XMLNode *node)
+ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
+ XMLNode *node)
{
GList *p;
@@ -280,6 +297,7 @@ ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
}
if (g_strcmp0 (sub_node->name , "rank") == 0) {
cnode->config.rank = atoi (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_RANK_MASK;
continue;
}
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
@@ -288,6 +306,7 @@ ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
else if (g_ascii_strcasecmp ("FALSE", sub_node->text) != 0)
g_warning ("<%s> element contains invalid boolean value %s",
sub_node->name, sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK;
continue;
}
g_warning ("<engine> element contains invalid element <%s>",
@@ -316,7 +335,7 @@ ibus_m17n_get_component (void)
if (node && g_strcmp0 (node->name, "engines") == 0) {
for (p = node->sub_nodes; p != NULL; p = p->next) {
XMLNode *sub_node = p->data;
- IBusM17NEngineConfigNode *cnode;
+ EngineConfigNode *cnode;
if (g_strcmp0 (sub_node->name, "engine") != 0) {
g_warning ("<engines> element contains invalid element <%s>",
@@ -324,9 +343,9 @@ ibus_m17n_get_component (void)
continue;
}
- cnode = g_slice_new0 (IBusM17NEngineConfigNode);
+ cnode = g_slice_new0 (EngineConfigNode);
if (!ibus_m17n_engine_config_parse_xml_node (cnode, sub_node)) {
- g_slice_free (IBusM17NEngineConfigNode, cnode);
+ g_slice_free (EngineConfigNode, cnode);
continue;
}
config_list = g_slist_prepend (config_list, cnode);
@@ -444,30 +463,3 @@ ibus_m17n_config_get_int (IBusConfig *config,
return FALSE;
#endif /* !IBUS_CHECK_VERSION(1,3,99) */
}
-
-#ifdef DEBUG
-#include <locale.h>
-
-int main ()
-{
- IBusComponent *component;
- GString *output;
-
- setlocale (LC_ALL, "");
- ibus_init ();
- ibus_m17n_init_common ();
-
- component = ibus_m17n_get_component ();
-
- output = g_string_new ("");
-
- ibus_component_output (component, output, 1);
-
- g_debug ("\n%s", output->str);
-
- g_string_free (output, TRUE);
- g_object_unref (component);
-
- return 0;
-}
-#endif
diff --git a/src/m17nutil.h b/src/m17nutil.h
index f083194..313e7bc 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -30,6 +30,7 @@ gunichar *ibus_m17n_mtext_to_ucs4 (MText *text,
guint ibus_m17n_parse_color (const gchar *hex);
IBusM17NEngineConfig
*ibus_m17n_get_engine_config (const gchar *engine_name);
+void ibus_m17n_engine_config_free (IBusM17NEngineConfig *config);
void ibus_m17n_config_set_string (IBusConfig *config,
const gchar *section,
const gchar *name,
diff --git a/src/test.c b/src/test.c
new file mode 100644
index 0000000..0908818
--- /dev/null
+++ b/src/test.c
@@ -0,0 +1,66 @@
+/* vim:set et sts=4: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ibus.h>
+#include <locale.h>
+#include "m17nutil.h"
+
+static void
+test_output_component (void)
+{
+ IBusComponent *component;
+ GString *output;
+
+ component = ibus_m17n_get_component ();
+
+ output = g_string_new ("");
+
+ ibus_component_output (component, output, 1);
+
+ g_debug ("\n%s", output->str);
+
+ g_string_free (output, TRUE);
+ g_object_unref (component);
+}
+
+static void
+test_engine_config (void)
+{
+ IBusM17NEngineConfig *config;
+
+ config = ibus_m17n_get_engine_config ("m17n:non:exsistent");
+ g_assert_cmpint (config->rank, ==, 0);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+
+ config = ibus_m17n_get_engine_config ("m17n:si:wijesekera");
+ g_assert_cmpint (config->rank, ==, 2);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+
+ config = ibus_m17n_get_engine_config ("m17n:si:phonetic-dynamic");
+ g_assert_cmpint (config->rank, ==, 1);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+
+ config = ibus_m17n_get_engine_config ("m17n:si:samanala");
+ g_assert_cmpint (config->rank, ==, 0);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+}
+
+int main (int argc, char **argv)
+{
+ setlocale (LC_ALL, "");
+ ibus_init ();
+ ibus_m17n_init_common ();
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/test-m17n/output-component", test_output_component);
+ g_test_add_func ("/test-m17n/engine-config", test_engine_config);
+
+ return g_test_run ();
+}
--
1.7.6.1

View File

@ -1,100 +0,0 @@
Patch to support iok (Indic Onscreen Keyboard).
Index: ibus-m17n-1.3.2/src/engine.c
===================================================================
--- ibus-m17n-1.3.2.orig/src/engine.c
+++ ibus-m17n-1.3.2/src/engine.c
@@ -23,6 +23,7 @@ struct _IBusM17NEngine {
IBusProperty *setup_prop;
#endif /* HAVE_SETUP */
IBusPropList *prop_list;
+ IBusProperty *show_iok_prop;
};
struct _IBusM17NEngineClass {
@@ -34,6 +35,7 @@ struct _IBusM17NEngineClass {
guint preedit_background;
gint preedit_underline;
gint lookup_table_orientation;
+ gboolean use_iok;
MInputMethod *im;
};
@@ -248,6 +250,9 @@ ibus_m17n_engine_class_init (IBusM17NEng
}
engine_name = g_strdup_printf ("m17n:%s:%s", lang, name);
klass->config_section = g_strdup_printf ("engine/M17N/%s/%s", lang, name);
+ /* whether to use iok - maybe good to move this to default.xml */
+ klass->use_iok = g_strcmp0 (name, "inscript") == 0 ||
+ g_strcmp0 (name, "inscript2") == 0;
g_free (lang);
g_free (name);
@@ -344,6 +349,7 @@ ibus_m17n_engine_init (IBusM17NEngine *m
{
IBusText* label;
IBusText* tooltip;
+ IBusM17NEngineClass *klass = (IBusM17NEngineClass *) G_OBJECT_GET_CLASS (m17n);
m17n->prop_list = ibus_prop_list_new ();
g_object_ref_sink (m17n->prop_list);
@@ -376,6 +382,23 @@ ibus_m17n_engine_init (IBusM17NEngine *m
ibus_prop_list_append (m17n->prop_list, m17n->setup_prop);
#endif /* HAVE_SETUP */
+ label = ibus_text_new_from_string ("iok");
+ m17n->show_iok_prop = ibus_property_new ("iok",
+ PROP_TYPE_NORMAL,
+ label,
+ "/usr/share/pixmaps/iok.xpm",
+ label,
+ TRUE,
+ FALSE,
+ 0,
+ NULL);
+ g_object_ref_sink (m17n->show_iok_prop);
+
+ if (klass->use_iok)
+ ibus_property_set_visible (m17n->show_iok_prop, TRUE);
+
+ ibus_prop_list_append (m17n->prop_list, m17n->show_iok_prop);
+
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
g_object_ref_sink (m17n->table);
m17n->context = NULL;
@@ -461,6 +484,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine
}
#endif /* HAVE_SETUP */
+ if (m17n->show_iok_prop) {
+ g_object_unref (m17n->show_iok_prop);
+ m17n->show_iok_prop = NULL;
+ }
+
if (m17n->table) {
g_object_unref (m17n->table);
m17n->table = NULL;
@@ -778,6 +806,24 @@ ibus_m17n_engine_property_activate (IBus
}
#endif /* HAVE_SETUP */
+ if (g_strcmp0 (prop_name, "iok") == 0) {
+ const gchar *engine_name;
+ gchar *lang = NULL, *name = NULL;
+
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name)) {
+ gchar *iok;
+
+ iok = g_strdup_printf ("/usr/bin/iok -n %s", lang);
+ g_debug ("keymap name = %s,prop_name=%s, prop_state=%d",
+ engine_name, prop_name, prop_state);
+ g_spawn_command_line_async(iok, NULL);
+ g_free (iok);
+ }
+ g_free (lang);
+ g_free (name);
+ }
+
parent_class->property_activate (engine, prop_name, prop_state);
}

653
ibus-m17n-virtkbd.patch Normal file
View File

@ -0,0 +1,653 @@
From 03557655071092e8135a6fc5c5f8cc2b2f692a83 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Wed, 31 Aug 2011 18:28:48 +0900
Subject: [PATCH 5/5] Support virtual keyboard.
---
configure.ac | 17 ++++
src/Makefile.am | 7 ++
src/default.xml.in.in | 111 ++++++++++++++++++++++++
src/engine.c | 44 ++++++++++
src/m17nutil.c | 10 ++-
src/m17nutil.h | 3 +
src/virtkbd.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++++
src/virtkbd.h | 31 +++++++
8 files changed, 448 insertions(+), 1 deletions(-)
create mode 100644 src/virtkbd.c
create mode 100644 src/virtkbd.h
diff --git a/configure.ac b/configure.ac
index 089aafb..ea1476c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,23 @@ fi
AM_CONDITIONAL([HAVE_GTK],[test x$with_gtk != xno])
+dnl check eekboard for virtual keyboard
+AC_MSG_CHECKING([whether you enable eekboard])
+AC_ARG_ENABLE(eekboard,
+ AS_HELP_STRING([--enable-eekboard=no/yes],
+ [Enable eekboard default=yes]),
+ enable_eekboard=$enableval,
+ enable_eekboard=yes)
+
+if test x$enable_eekboard = xyes; then
+ PKG_CHECK_MODULES([EEKBOARD], [eekboard-0.90], , enable_xtest=no)
+ if test x$enable_eekboard = xyes; then
+ AC_DEFINE([HAVE_EEKBOARD], [1], [Define if eekboard is found])
+ fi
+fi
+AM_CONDITIONAL(ENABLE_EEKBOARD, [test x$enable_eekboard = xyes])
+AC_MSG_RESULT($enable_eekboard)
+
# check if minput_list, which is available in m17n-lib 1.6.2+ (CVS)
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
diff --git a/src/Makefile.am b/src/Makefile.am
index e354149..eac6629 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,11 +64,18 @@ ibus_engine_m17n_SOURCES = \
main.c \
engine.c \
engine.h \
+ virtkbd.c \
+ virtkbd.h \
+ $(NULL)
+ibus_engine_m17n_CFLAGS = \
+ @EEKBOARD_CFLAGS@ \
+ $(AM_CFLAGS) \
$(NULL)
ibus_engine_m17n_LDADD = \
libm17ncommon.a \
@IBUS_LIBS@ \
@M17N_LIBS@ \
+ @EEKBOARD_LIBS@ \
$(NULL)
if HAVE_GTK
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index 8192878..47053ae 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -12,6 +12,7 @@
<preedit-highlight>FALSE</preedit-highlight>
<symbol></symbol>
@IBUS_HOTKEYS_XML@
+ <virtual-keyboard>us</virtual-keyboard>
</engine>
<!-- Indic engines should be selected by default:
https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
@@ -410,4 +411,114 @@
<name>m17n:zh:tonepy*</name>
<symbol>调</symbol>
</engine>
+
+ <!-- Virtual keyboard. -->
+ <engine>
+ <name>m17n:ar:kbd</name>
+ <virtual-keyboard>ar,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:be:kbd</name>
+ <virtual-keyboard>be,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:fa:kbd</name>
+ <virtual-keyboard>fa,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:he:kbd</name>
+ <virtual-keyboard>he,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:kk:kbd</name>
+ <virtual-keyboard>kk,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:ks:kbd</name>
+ <virtual-keyboard>ks,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:my:kbd</name>
+ <virtual-keyboard>my,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:ru:kbd</name>
+ <virtual-keyboard>ru,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:ua:kbd</name>
+ <virtual-keyboard>ua,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:ug:kbd</name>
+ <virtual-keyboard>ug,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:be:kbd</name>
+ <virtual-keyboard>be,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:th:*</name>
+ <virtual-keyboard>th,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:zh:bopomofo</name>
+ <virtual-keyboard>zh-bopomofo,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:as:inscript</name>
+ <virtual-keyboard>as-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:bn:inscript</name>
+ <virtual-keyboard>bn-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:gu:inscript</name>
+ <virtual-keyboard>gu-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:hi:inscript</name>
+ <virtual-keyboard>hi-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:kn:inscript</name>
+ <virtual-keyboard>kn-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:ks:inscript</name>
+ <virtual-keyboard>kn-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:mai:inscript</name>
+ <virtual-keyboard>mai-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:ml:inscript</name>
+ <virtual-keyboard>ml-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:mr:inscript</name>
+ <virtual-keyboard>mr-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:or:inscript</name>
+ <virtual-keyboard>or-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:pa:inscript</name>
+ <virtual-keyboard>pa-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:sd:inscript</name>
+ <virtual-keyboard>sd-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:ta:inscript</name>
+ <virtual-keyboard>ta-inscript,us</virtual-keyboard>
+ </engine>
+ <engine>
+ <name>m17n:te:inscript</name>
+ <virtual-keyboard>te-inscript,us</virtual-keyboard>
+ </engine>
</engines>
diff --git a/src/engine.c b/src/engine.c
index f1e3068..cad01e5 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -7,6 +7,7 @@
#include <m17n.h>
#include <string.h>
#include "m17nutil.h"
+#include "virtkbd.h"
#include "engine.h"
typedef struct _IBusM17NEngine IBusM17NEngine;
@@ -18,10 +19,13 @@ struct _IBusM17NEngine {
/* members */
MInputContext *context;
IBusLookupTable *table;
+ IBusM17NVirtualKeyboard *virtkbd;
+
IBusProperty *status_prop;
#ifdef HAVE_SETUP
IBusProperty *setup_prop;
#endif /* HAVE_SETUP */
+ IBusProperty *virtkbd_prop;
IBusPropList *prop_list;
};
@@ -34,6 +38,7 @@ struct _IBusM17NEngineClass {
guint preedit_background;
gint preedit_underline;
gint lookup_table_orientation;
+ gchar *virtual_keyboard;
MInputMethod *im;
};
@@ -110,6 +115,10 @@ ibus_m17n_init (IBusBus *bus)
if (config)
g_object_ref_sink (config);
ibus_m17n_init_common ();
+
+#ifdef HAVE_EEKBOARD
+ eek_init ();
+#endif /* HAVE_EEKBOARD */
}
static gboolean
@@ -290,6 +299,8 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
&klass->lookup_table_orientation))
klass->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
+ klass->virtual_keyboard = engine_config->virtual_keyboard;
+
ibus_m17n_engine_config_free (engine_config);
g_signal_connect (config, "value-changed",
@@ -346,6 +357,7 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
{
IBusText* label;
IBusText* tooltip;
+ IBusM17NEngineClass *klass = (IBusM17NEngineClass *) G_OBJECT_GET_CLASS (m17n);
m17n->prop_list = ibus_prop_list_new ();
g_object_ref_sink (m17n->prop_list);
@@ -378,6 +390,22 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
ibus_prop_list_append (m17n->prop_list, m17n->setup_prop);
#endif /* HAVE_SETUP */
+ if (klass->virtual_keyboard != NULL) {
+ label = ibus_text_new_from_string ("On-screen Keyboard");
+ tooltip = ibus_text_new_from_string ("Show on-screen keyboard");
+ m17n->virtkbd_prop = ibus_property_new ("virtual-keyboard",
+ PROP_TYPE_NORMAL,
+ label,
+ "input-keyboard",
+ tooltip,
+ TRUE,
+ TRUE,
+ PROP_STATE_UNCHECKED,
+ NULL);
+ g_object_ref_sink (m17n->virtkbd_prop);
+ ibus_prop_list_append (m17n->prop_list, m17n->virtkbd_prop);
+ }
+
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
g_object_ref_sink (m17n->table);
m17n->context = NULL;
@@ -439,6 +467,8 @@ ibus_m17n_engine_constructor (GType type,
}
m17n->context = minput_create_ic (klass->im, m17n);
+ m17n->virtkbd = ibus_m17n_virtual_keyboard_new ((IBusEngine *)m17n,
+ klass->virtual_keyboard);
return (GObject *) m17n;
}
@@ -473,6 +503,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
m17n->context = NULL;
}
+ if (m17n->virtkbd) {
+ g_object_unref (m17n->virtkbd);
+ m17n->virtkbd = NULL;
+ }
+
IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *)m17n);
}
@@ -709,6 +744,8 @@ ibus_m17n_engine_enable (IBusEngine *engine)
ibus_engine_get_surrounding_text (engine, &text, &cursor_pos);
g_object_unref (text);
#endif /* HAVE_IBUS_ENGINE_GET_SURROUNDING_TEXT */
+
+ ibus_m17n_virtual_keyboard_enable (m17n->virtkbd);
}
static void
@@ -718,6 +755,8 @@ ibus_m17n_engine_disable (IBusEngine *engine)
ibus_m17n_engine_focus_out (engine);
parent_class->disable (engine);
+
+ ibus_m17n_virtual_keyboard_disable (m17n->virtkbd);
}
static void
@@ -780,6 +819,11 @@ ibus_m17n_engine_property_activate (IBusEngine *engine,
}
#endif /* HAVE_SETUP */
+#ifdef HAVE_EEKBOARD
+ if (g_strcmp0 (prop_name, "virtual-keyboard") == 0)
+ ibus_m17n_virtual_keyboard_toggle_display (m17n->virtkbd);
+#endif /* HAVE_EEKBOARD */
+
parent_class->property_activate (engine, prop_name, prop_state);
}
diff --git a/src/m17nutil.c b/src/m17nutil.c
index 3e6b9f1..bf8bf84 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -14,7 +14,8 @@ typedef enum {
ENGINE_CONFIG_LAYOUT_MASK = 1 << 1,
ENGINE_CONFIG_HOTKEYS_MASK = 1 << 2,
ENGINE_CONFIG_SYMBOL_MASK = 1 << 3,
- ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 4
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 4,
+ ENGINE_CONFIG_VIRTUAL_KEYBOARD_MASK = 1 << 5
} EngineConfigMask;
struct _EngineConfigNode {
@@ -281,6 +282,8 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
config->symbol = cnode->config.symbol;
if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
config->preedit_highlight = cnode->config.preedit_highlight;
+ if (cnode->mask & ENGINE_CONFIG_VIRTUAL_KEYBOARD_MASK)
+ config->virtual_keyboard = cnode->config.virtual_keyboard;
}
}
return config;
@@ -336,6 +339,11 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
cnode->mask |= ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK;
continue;
}
+ if (g_strcmp0 (sub_node->name , "virtual-keyboard") == 0) {
+ cnode->config.virtual_keyboard = g_strdup (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_VIRTUAL_KEYBOARD_MASK;
+ continue;
+ }
g_warning ("<engine> element contains invalid element <%s>",
sub_node->name);
}
diff --git a/src/m17nutil.h b/src/m17nutil.h
index 21b1bb9..f138c8b 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -25,6 +25,9 @@ struct _IBusM17NEngineConfig {
/* whether to highlight preedit */
gboolean preedit_highlight;
+
+ /* virtual keyboard type */
+ gchar *virtual_keyboard;
};
typedef struct _IBusM17NEngineConfig IBusM17NEngineConfig;
diff --git a/src/virtkbd.c b/src/virtkbd.c
new file mode 100644
index 0000000..92ae3a5
--- /dev/null
+++ b/src/virtkbd.c
@@ -0,0 +1,226 @@
+/* vim:set et sts=4: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_EEKBOARD
+#include <eekboard/eekboard-client.h>
+#endif /* HAVE_EEKBOARD */
+
+#include "virtkbd.h"
+
+struct _IBusM17NVirtualKeyboard {
+ GObject parent;
+ IBusEngine *engine;
+ gchar *keyboard_type;
+ GSList *keyboards;
+
+#ifdef HAVE_EEKBOARD
+ EekboardClient *client;
+ EekboardContext *context;
+#endif /* HAVE_EEKBOARD */
+};
+
+struct _IBusM17NVirtualKeyboardClass {
+ GObjectClass parent_class;
+};
+
+typedef struct _IBusM17NVirtualKeyboardClass IBusM17NVirtualKeyboardClass;
+
+G_DEFINE_TYPE (IBusM17NVirtualKeyboard, ibus_m17n_virtual_keyboard, G_TYPE_OBJECT);
+
+static void
+ibus_m17n_virtual_keyboard_dispose (GObject *object)
+{
+ IBusM17NVirtualKeyboard *virtkbd = IBUS_M17N_VIRTUAL_KEYBOARD (object);
+
+ if (virtkbd->engine) {
+ g_object_unref (virtkbd->engine);
+ virtkbd->engine = NULL;
+ }
+ if (virtkbd->keyboards) {
+ GSList *next = virtkbd->keyboards->next;
+ /* virtkbd->keyboards is a ring; break it before free */
+ virtkbd->keyboards->next = NULL;
+ g_slist_free (next);
+ }
+
+#ifdef HAVE_EEKBOARD
+ if (virtkbd->context) {
+ g_object_unref (virtkbd->context);
+ virtkbd->context = NULL;
+ }
+ if (virtkbd->client) {
+ g_object_unref (virtkbd->client);
+ virtkbd->client = NULL;
+ }
+#endif /* HAVE_EEKBOARD */
+
+ G_OBJECT_CLASS (ibus_m17n_virtual_keyboard_parent_class)->dispose (object);
+}
+
+static void
+ibus_m17n_virtual_keyboard_finalize (GObject *object)
+{
+ IBusM17NVirtualKeyboard *virtkbd = IBUS_M17N_VIRTUAL_KEYBOARD (object);
+
+ g_free (virtkbd->keyboard_type);
+
+ G_OBJECT_CLASS (ibus_m17n_virtual_keyboard_parent_class)->finalize (object);
+}
+
+static void
+ibus_m17n_virtual_keyboard_class_init (IBusM17NVirtualKeyboardClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->dispose = ibus_m17n_virtual_keyboard_dispose;
+ gobject_class->finalize = ibus_m17n_virtual_keyboard_finalize;
+}
+
+static void
+ibus_m17n_virtual_keyboard_init (IBusM17NVirtualKeyboard *self)
+{
+}
+
+#ifdef HAVE_EEKBOARD
+static void
+destroyed_cb (EekboardClient *client,
+ IBusM17NVirtualKeyboard *virtkbd)
+{
+ if (virtkbd->context) {
+ g_object_unref (virtkbd->context);
+ virtkbd->context = NULL;
+ }
+ if (virtkbd->client) {
+ g_object_unref (virtkbd->client);
+ virtkbd->client = NULL;
+ }
+}
+
+static void
+key_pressed_cb (EekboardContext *context,
+ gchar *keyname,
+ EekSymbol *symbol,
+ guint modifiers,
+ IBusM17NVirtualKeyboard *virtkbd)
+{
+ if (EEK_IS_TEXT (symbol)) {
+ const gchar *string;
+ IBusText *text;
+
+ string = eek_text_get_text (EEK_TEXT (symbol));
+ text = ibus_text_new_from_static_string (string);
+ ibus_engine_commit_text (virtkbd->engine, text);
+ } else if (EEK_IS_KEYSYM (symbol)) {
+ guint keyval = eek_keysym_get_xkeysym (EEK_KEYSYM (symbol));
+ ibus_engine_forward_key_event (virtkbd->engine,
+ keyval,
+ 0,
+ modifiers);
+ ibus_engine_forward_key_event (virtkbd->engine,
+ keyval,
+ 0,
+ modifiers | IBUS_RELEASE_MASK);
+ } else if (g_strcmp0 (eek_symbol_get_name (symbol),
+ "cycle-keyboard") == 0) {
+ virtkbd->keyboards = g_slist_next (virtkbd->keyboards);
+ eekboard_context_set_keyboard (virtkbd->context,
+ GPOINTER_TO_UINT (virtkbd->keyboards->data),
+ NULL);
+ }
+}
+
+static void
+init_client (IBusM17NVirtualKeyboard *virtkbd)
+{
+ GDBusConnection *connection;
+ GError *error;
+ gchar **strv, **p;
+
+ error = NULL;
+ connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+ if (connection == NULL) {
+ g_printerr ("Can't connect to the session bus: %s\n",
+ error->message);
+ return;
+ }
+
+ virtkbd->client = eekboard_client_new (connection, NULL);
+ g_object_unref (connection);
+ g_signal_connect (virtkbd->client, "destroyed",
+ G_CALLBACK (destroyed_cb), virtkbd);
+
+ virtkbd->context = eekboard_client_create_context (virtkbd->client,
+ "ibus-m17n",
+ NULL);
+ g_signal_connect (virtkbd->context, "key-pressed",
+ G_CALLBACK (key_pressed_cb), virtkbd);
+
+ strv = g_strsplit (virtkbd->keyboard_type, ",", -1);
+ for (p = strv; *p; p++) {
+ guint keyboard;
+
+ keyboard = eekboard_context_add_keyboard (virtkbd->context,
+ g_strstrip (*p),
+ NULL);
+ virtkbd->keyboards = g_slist_prepend (virtkbd->keyboards,
+ GUINT_TO_POINTER (keyboard));
+ }
+ virtkbd->keyboards = g_slist_reverse (virtkbd->keyboards);
+ g_strfreev (strv);
+
+ /* make a cycle */
+ g_slist_last (virtkbd->keyboards)->next = virtkbd->keyboards;
+
+ eekboard_context_set_keyboard (virtkbd->context,
+ GPOINTER_TO_UINT (virtkbd->keyboards->data),
+ NULL);
+}
+#endif /* HAVE_EEKBOARD */
+
+void
+ibus_m17n_virtual_keyboard_toggle_display (IBusM17NVirtualKeyboard *virtkbd)
+{
+#ifdef HAVE_EEKBOARD
+ if (virtkbd->client == NULL)
+ ibus_m17n_virtual_keyboard_enable (virtkbd);
+
+ if (virtkbd->client != NULL) {
+ if (eekboard_context_is_visible (virtkbd->context))
+ eekboard_context_hide_keyboard (virtkbd->context, NULL);
+ else
+ eekboard_context_show_keyboard (virtkbd->context, NULL);
+ }
+#endif /* HAVE_EEKBOARD */
+}
+
+void
+ibus_m17n_virtual_keyboard_enable (IBusM17NVirtualKeyboard *virtkbd)
+{
+#ifdef HAVE_EEKBOARD
+ if (virtkbd->client == NULL)
+ init_client (virtkbd);
+
+ if (virtkbd->client != NULL)
+ eekboard_client_push_context (virtkbd->client, virtkbd->context, NULL);
+#endif /* HAVE_EEKBOARD */
+}
+
+void
+ibus_m17n_virtual_keyboard_disable (IBusM17NVirtualKeyboard *virtkbd)
+{
+#ifdef HAVE_EEKBOARD
+ if (virtkbd->client != NULL)
+ eekboard_client_pop_context (virtkbd->client, NULL);
+#endif /* HAVE_EEKBOARD */
+}
+
+IBusM17NVirtualKeyboard *
+ibus_m17n_virtual_keyboard_new (IBusEngine *engine,
+ const gchar *keyboard_type)
+{
+ IBusM17NVirtualKeyboard *virtkbd = g_object_new (IBUS_M17N_TYPE_VIRTUAL_KEYBOARD, NULL);
+ virtkbd->engine = g_object_ref (engine);
+ virtkbd->keyboard_type = g_strdup (keyboard_type);
+ return virtkbd;
+}
diff --git a/src/virtkbd.h b/src/virtkbd.h
new file mode 100644
index 0000000..c28953a
--- /dev/null
+++ b/src/virtkbd.h
@@ -0,0 +1,31 @@
+#ifndef __VIRTKBD_H__
+#define __VIRTKBD_H__ 1
+
+#include <ibus.h>
+
+G_BEGIN_DECLS
+
+#define IBUS_M17N_TYPE_VIRTUAL_KEYBOARD (ibus_m17n_virtual_keyboard_get_type())
+#define IBUS_M17N_VIRTUAL_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_M17N_TYPE_VIRTUAL_KEYBOARD, IBusM17NVirtualKeyboard))
+#define IBUS_M17N_VIRTUAL_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_M17N_TYPE_VIRTUAL_KEYBOARD, IBusM17NVirtualKeyboardClass))
+#define IBUS_M17N_IS_VIRTUAL_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_M17N_TYPE_VIRTUAL_KEYBOARD))
+#define IBUS_M17N_IS_VIRTUAL_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_M17N_TYPE_VIRTUAL_KEYBOARD))
+#define IBUS_M17N_VIRTUAL_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_M17N_TYPE_VIRTUAL_KEYBOARD, IBusM17NVirtualKeyboardClass))
+
+typedef struct _IBusM17NVirtualKeyboard IBusM17NVirtualKeyboard;
+
+GType ibus_m17n_virtual_keyboard_get_type
+ (void);
+IBusM17NVirtualKeyboard *ibus_m17n_virtual_keyboard_new
+ (IBusEngine *engine,
+ const gchar *keyboard_type);
+void ibus_m17n_virtual_keyboard_toggle_display
+ (IBusM17NVirtualKeyboard *virtkbd);
+void ibus_m17n_virtual_keyboard_enable
+ (IBusM17NVirtualKeyboard *virtkbd);
+void ibus_m17n_virtual_keyboard_disable
+ (IBusM17NVirtualKeyboard *virtkbd);
+
+G_END_DECLS
+
+#endif /* __VIRTKBD_H__ */
--
1.7.6.1

View File

@ -1,122 +1,49 @@
Patch to set certain XKB options when an m17n IME is set. From 98be0a7b90cd47cafabb715695d20b9bfc7dd1bb Mon Sep 17 00:00:00 2001
Index: ibus-m17n-1.3.2/src/default.xml.in.in From: Daiki Ueno <ueno@unixuser.org>
=================================================================== Date: Mon, 8 Aug 2011 09:59:28 +0900
--- ibus-m17n-1.3.2.orig/src/default.xml.in.in Subject: [PATCH 3/5] Set XKB layout option via default.xml.
+++ ibus-m17n-1.3.2/src/default.xml.in.in
@@ -12,19 +12,22 @@ ---
<preedit-highlight>FALSE</preedit-highlight> src/default.xml.in.in | 9 +++++++++
src/m17nutil.c | 13 +++++++++++--
src/m17nutil.h | 3 +++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index dc93fd3..785ab05 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -157,6 +157,15 @@
<name>m17n:si:samanala</name>
<rank>0</rank>
</engine> </engine>
<engine> + <!-- Some Indic engines expect AltGr is automatically mapped -->
- <name>m17n:bn:inscript</name> + <engine>
+ <name>m17n:bn:inscript*</name> + <name>m17n:*:inscript</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout> + <layout>default[lv3:ralt_switch]</layout>
</engine> + </engine>
<engine> + <engine>
- <name>m17n:gu:inscript</name> + <name>m17n:si:*</name>
+ <name>m17n:gu:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout> + <layout>default[lv3:ralt_switch]</layout>
</engine> + </engine>
<!-- Some CJK engines use preedit. -->
<engine> <engine>
- <name>m17n:hi:inscript</name> <name>m17n:zh:cangjie</name>
+ <name>m17n:hi:inscript*</name> diff --git a/src/m17nutil.c b/src/m17nutil.c
<rank>2</rank> index 00b7194..06e1b58 100644
<preedit-highlight>FALSE</preedit-highlight> --- a/src/m17nutil.c
+ <layout>default[lv3:ralt_switch]</layout> +++ b/src/m17nutil.c
</engine> @@ -11,7 +11,8 @@ static MConverter *utf8_converter = NULL;
<engine>
<name>m17n:kn:kgp</name> typedef enum {
@@ -37,19 +40,22 @@ ENGINE_CONFIG_RANK_MASK = 1 << 0,
<preedit-highlight>FALSE</preedit-highlight> - ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 1
</engine> + ENGINE_CONFIG_LAYOUT_MASK = 1 << 1,
<engine> + ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 2
- <name>m17n:mai:inscript</name> } EngineConfigMask;
+ <name>m17n:mai:inscript*</name>
<rank>2</rank> struct _EngineConfigNode {
<preedit-highlight>FALSE</preedit-highlight> @@ -126,7 +127,7 @@ ibus_m17n_engine_new (MSymbol lang,
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:ml:inscript</name>
+ <name>m17n:ml:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:mr:inscript</name>
+ <name>m17n:mr:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:ne:rom</name>
@@ -57,14 +63,16 @@
<preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
- <name>m17n:or:inscript</name>
+ <name>m17n:or:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
- <name>m17n:pa:inscript</name>
+ <name>m17n:pa:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:sa:harvard-kyoto</name>
@@ -72,14 +80,16 @@
<preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
- <name>m17n:sd:inscript</name>
+ <name>m17n:sd:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:si:wijesekera</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:ta:tamil99</name>
@@ -87,9 +97,10 @@
<preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
- <name>m17n:te:inscript</name>
+ <name>m17n:te:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<!-- Samanala should have lower rank than other Sinhala
engines since it is the only non-keyboard input method in
@@ -226,6 +237,7 @@
<name>m17n:si:*</name>
<rank>1</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <layout>default[lv3:ralt_switch]</layout>
</engine>
<engine>
<name>m17n:ta:*</name>
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
@@ -120,7 +120,7 @@ ibus_m17n_engine_new (MSymbol lang,
"language", msymbol_name (lang), "language", msymbol_name (lang),
"license", "GPL", "license", "GPL",
"icon", engine_icon ? engine_icon : "", "icon", engine_icon ? engine_icon : "",
@ -125,22 +52,32 @@ Index: ibus-m17n-1.3.2/src/m17nutil.c
"rank", config->rank, "rank", config->rank,
NULL); NULL);
#else #else
@@ -282,6 +282,11 @@ ibus_m17n_engine_config_parse_xml_node ( @@ -268,6 +269,8 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
cnode->config.rank = atoi (sub_node->text); if (g_pattern_match_simple (cnode->name, engine_name)) {
if (cnode->mask & ENGINE_CONFIG_RANK_MASK)
config->rank = cnode->config.rank;
+ if (cnode->mask & ENGINE_CONFIG_LAYOUT_MASK)
+ config->layout = cnode->config.layout;
if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
config->preedit_highlight = cnode->config.preedit_highlight;
}
@@ -300,6 +303,12 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
cnode->mask |= ENGINE_CONFIG_RANK_MASK;
continue; continue;
} }
+ if (g_strcmp0 (sub_node->name , "layout") == 0) { + if (g_strcmp0 (sub_node->name , "layout") == 0) {
+ g_free (cnode->config.layout); + g_free (cnode->config.layout);
+ cnode->config.layout = g_strdup (sub_node->text); + cnode->config.layout = g_strdup (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_LAYOUT_MASK;
+ continue; + continue;
+ } + }
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) { if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0) if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
cnode->config.preedit_highlight = TRUE; cnode->config.preedit_highlight = TRUE;
Index: ibus-m17n-1.3.2/src/m17nutil.h diff --git a/src/m17nutil.h b/src/m17nutil.h
=================================================================== index 313e7bc..c7b283e 100644
--- ibus-m17n-1.3.2.orig/src/m17nutil.h --- a/src/m17nutil.h
+++ ibus-m17n-1.3.2/src/m17nutil.h +++ b/src/m17nutil.h
@@ -14,6 +14,9 @@ struct _IBusM17NEngineConfig { @@ -14,6 +14,9 @@ struct _IBusM17NEngineConfig {
/* engine rank */ /* engine rank */
gint rank; gint rank;
@ -151,3 +88,6 @@ Index: ibus-m17n-1.3.2/src/m17nutil.h
/* whether to highlight preedit */ /* whether to highlight preedit */
gboolean preedit_highlight; gboolean preedit_highlight;
}; };
--
1.7.6.1

View File

@ -1,23 +1,23 @@
From 432d6f93be857d2544ad19ba67caea22d5843cc5 Mon Sep 17 00:00:00 2001 From 7a3f7a425977c685ad64a4ec44682926ef345ea1 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org> From: Daiki Ueno <ueno@unixuser.org>
Date: Tue, 5 Jul 2011 16:26:49 +0900 Date: Wed, 31 Aug 2011 11:44:46 +0900
Subject: [PATCH] Supply hotkeys and symbol in engine desc. Subject: [PATCH 4/5] Supply hotkeys and symbol in engine desc.
--- ---
configure.ac | 3 + configure.ac | 3 +
m4/.gitignore | 2 + m4/.gitignore | 2 +
m4/ibus.m4 | 52 +++++++++ m4/ibus.m4 | 52 ++++++++++++
src/default.xml.in.in | 284 +++++++++++++++++++++++++++++++++++++++++-------- src/default.xml.in.in | 207 +++++++++++++++++++++++++++++++++++++++++++++++++
src/m17nutil.c | 10 ++ src/m17nutil.c | 20 +++++-
src/m17nutil.h | 6 + src/m17nutil.h | 6 ++
6 files changed, 312 insertions(+), 45 deletions(-) 6 files changed, 289 insertions(+), 1 deletions(-)
create mode 100644 m4/ibus.m4 create mode 100644 m4/ibus.m4
Index: ibus-m17n-1.3.2/configure.ac diff --git a/configure.ac b/configure.ac
=================================================================== index 4df68b6..089aafb 100644
--- ibus-m17n-1.3.2.orig/configure.ac --- a/configure.ac
+++ ibus-m17n-1.3.2/configure.ac +++ b/configure.ac
@@ -114,6 +114,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GET @@ -114,6 +114,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only
AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.16.1) AM_GNU_GETTEXT_VERSION(0.16.1)
@ -27,10 +27,19 @@ Index: ibus-m17n-1.3.2/configure.ac
# OUTPUT files # OUTPUT files
AC_CONFIG_FILES([ po/Makefile.in AC_CONFIG_FILES([ po/Makefile.in
Index: ibus-m17n-1.3.2/m4/ibus.m4 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 --- /dev/null
+++ ibus-m17n-1.3.2/m4/ibus.m4 +++ b/m4/ibus.m4
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
+# IBUS_WITH_HOTKEYS([DEFAULT]) +# IBUS_WITH_HOTKEYS([DEFAULT])
+AC_DEFUN([IBUS_WITH_HOTKEYS], [ +AC_DEFUN([IBUS_WITH_HOTKEYS], [
@ -84,503 +93,245 @@ Index: ibus-m17n-1.3.2/m4/ibus.m4
+ fi + fi
+ AC_SUBST(IBUS_SYMBOL_XML) + AC_SUBST(IBUS_SYMBOL_XML)
+]) +])
Index: ibus-m17n-1.3.2/src/default.xml.in.in diff --git a/src/default.xml.in.in b/src/default.xml.in.in
=================================================================== index 785ab05..8192878 100644
--- ibus-m17n-1.3.2.orig/src/default.xml.in.in --- a/src/default.xml.in.in
+++ ibus-m17n-1.3.2/src/default.xml.in.in +++ b/src/default.xml.in.in
@@ -10,97 +10,114 @@ @@ -10,6 +10,8 @@
<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>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>ক</symbol>
</engine>
<engine>
<name>m17n:gu:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>ક</symbol>
</engine>
<engine>
<name>m17n:hi:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<layout>default[lv3:ralt_switch]</layout>
+ <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>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:ml:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>ക</symbol>
</engine>
<engine>
<name>m17n:mr:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<layout>default[lv3:ralt_switch]</layout>
+ <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>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>କ</symbol>
</engine>
<engine>
<name>m17n:pa:inscript*</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<layout>default[lv3:ralt_switch]</layout>
+ <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>
<layout>default[lv3:ralt_switch]</layout>
+ <symbol>क</symbol>
</engine>
<engine>
<name>m17n:si:wijesekera</name>
<rank>2</rank>
<preedit-highlight>FALSE</preedit-highlight>
<layout>default[lv3:ralt_switch]</layout>
+ <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>
<layout>default[lv3:ralt_switch]</layout>
+ <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>
<layout>default[lv3:ralt_switch]</layout>
+ <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> <name>m17n:*</name>
<rank>0</rank> <rank>0</rank>
<preedit-highlight>FALSE</preedit-highlight> <preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol> + <symbol></symbol>
+ @IBUS_HOTKEYS_XML@ + @IBUS_HOTKEYS_XML@
</engine> </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> </engines>
Index: ibus-m17n-1.3.2/src/m17nutil.c diff --git a/src/m17nutil.c b/src/m17nutil.c
=================================================================== index 06e1b58..3e6b9f1 100644
--- ibus-m17n-1.3.2.orig/src/m17nutil.c --- a/src/m17nutil.c
+++ ibus-m17n-1.3.2/src/m17nutil.c +++ b/src/m17nutil.c
@@ -122,6 +122,8 @@ ibus_m17n_engine_new (MSymbol lang, @@ -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 : "", "icon", engine_icon ? engine_icon : "",
"layout", config->layout ? config->layout : "us", "layout", config->layout ? config->layout : "us",
"rank", config->rank, "rank", config->rank,
@ -589,25 +340,38 @@ Index: ibus-m17n-1.3.2/src/m17nutil.c
NULL); NULL);
#else #else
engine = ibus_engine_desc_new (engine_name, engine = ibus_engine_desc_new (engine_name,
@@ -287,6 +289,14 @@ ibus_m17n_engine_config_parse_xml_node ( @@ -271,6 +275,10 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
cnode->config.layout = g_strdup (sub_node->text); 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; continue;
} }
+ if (g_strcmp0 (sub_node->name , "hotkeys") == 0) { + if (g_strcmp0 (sub_node->name , "hotkeys") == 0) {
+ cnode->config.hotkeys = g_strdup (sub_node->text); + cnode->config.hotkeys = g_strdup (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_HOTKEYS_MASK;
+ continue; + continue;
+ } + }
+ if (g_strcmp0 (sub_node->name , "symbol") == 0) { + if (g_strcmp0 (sub_node->name , "symbol") == 0) {
+ cnode->config.symbol = g_strdup (sub_node->text); + cnode->config.symbol = g_strdup (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_SYMBOL_MASK;
+ continue; + continue;
+ } + }
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) { if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0) if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
cnode->config.preedit_highlight = TRUE; cnode->config.preedit_highlight = TRUE;
Index: ibus-m17n-1.3.2/src/m17nutil.h diff --git a/src/m17nutil.h b/src/m17nutil.h
=================================================================== index c7b283e..21b1bb9 100644
--- ibus-m17n-1.3.2.orig/src/m17nutil.h --- a/src/m17nutil.h
+++ ibus-m17n-1.3.2/src/m17nutil.h +++ b/src/m17nutil.h
@@ -17,6 +17,12 @@ struct _IBusM17NEngineConfig { @@ -17,6 +17,12 @@ struct _IBusM17NEngineConfig {
/* keyboard layout */ /* keyboard layout */
gchar *layout; gchar *layout;
@ -621,3 +385,6 @@ Index: ibus-m17n-1.3.2/src/m17nutil.h
/* whether to highlight preedit */ /* whether to highlight preedit */
gboolean preedit_highlight; gboolean preedit_highlight;
}; };
--
1.7.6.1

View File

@ -11,9 +11,13 @@
%global _with_hotkeys --with-hotkeys %global _with_hotkeys --with-hotkeys
%endif %endif
%if (0%{?fedora} > 16)
%global _enable_eekboard --enable_eekboard
%endif
Name: ibus-m17n Name: ibus-m17n
Version: 1.3.2 Version: 1.3.2
Release: 10%{?dist} Release: 11%{?dist}
Summary: The M17N engine for IBus platform Summary: The M17N engine for IBus platform
License: GPLv2+ License: GPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
@ -21,9 +25,10 @@ URL: http://code.google.com/p/ibus/
Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
Patch0: ibus-m17n-HEAD.patch Patch0: ibus-m17n-HEAD.patch
Patch1: ibus-m17n-iok.patch Patch1: ibus-m17n-default-xml-override.patch
Patch2: ibus-m17n-xkb-options.patch Patch2: ibus-m17n-xkb-options.patch
Patch3: ibus-m17n-xx-icon-symbol.patch Patch3: ibus-m17n-xx-icon-symbol.patch
Patch4: ibus-m17n-virtkbd.patch
# The following BR is for autogen and not necessary when packging # The following BR is for autogen and not necessary when packging
# released tarballs. # released tarballs.
@ -39,10 +44,11 @@ BuildRequires: gtk2-devel
%endif %endif
BuildRequires: libxklavier-devel BuildRequires: libxklavier-devel
BuildRequires: ibus-devel >= %{require_ibus_version} BuildRequires: ibus-devel >= %{require_ibus_version}
BuildRequires: eekboard-devel
Requires: ibus >= %{require_ibus_version} Requires: ibus >= %{require_ibus_version}
Requires: m17n-lib Requires: m17n-lib
Requires: iok > 1.3.1 Requires: eekboard
%description %description
M17N engine for IBus input platform. It allows input of many languages using M17N engine for IBus input platform. It allows input of many languages using
@ -51,13 +57,14 @@ the input table maps from m17n-db.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .HEAD %patch0 -p1 -b .HEAD
%patch1 -p1 -b .iok %patch1 -p1 -b .default-xml-override
%patch2 -p1 -b .xkb-options %patch2 -p1 -b .xkb-options
%patch3 -p1 -b .xx-icon-symbol %patch3 -p1 -b .xx-icon-symbol
%patch4 -p1 -b .virtkbd
NOCONFIGURE=1 ./autogen.sh NOCONFIGURE=1 ./autogen.sh
%build %build
%configure --disable-static %{?_with_gtk} %{?_with_hotkeys} %configure --disable-static %{?_with_gtk} %{?_with_hotkeys} %{?_enable_eekboard}
# make -C po update-gmo # make -C po update-gmo
make %{?_smp_mflags} make %{?_smp_mflags}
@ -75,6 +82,10 @@ make DESTDIR=${RPM_BUILD_ROOT} install
%{_datadir}/ibus/component/* %{_datadir}/ibus/component/*
%changelog %changelog
* Thu Sep 1 2011 Daiki Ueno <dueno@redhat.com> - 1.3.2-11
- Add ibus-m17n-default-xml-override.patch.
- Add ibus-m17n-virtkbd.patch, instead of ibus-m17n-iok.patch.
* Tue Aug 9 2011 Daiki Ueno <dueno@redhat.com> - 1.3.2-10 * Tue Aug 9 2011 Daiki Ueno <dueno@redhat.com> - 1.3.2-10
- Set symbol for m17n:ne:rom. - Set symbol for m17n:ne:rom.