ibus-m17n/ibus-m17n-iok.patch
2011-07-07 14:37:21 +09:00

101 lines
3.4 KiB
Diff

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);
}