ibus-m17n/ibus-m17n-iok.patch

107 lines
3.5 KiB
Diff
Raw Normal View History

2009-03-05 04:34:40 +00:00
--- src/engine.c.orig 2009-03-02 10:54:14.000000000 +0530
+++ src/engine.c 2009-03-02 13:12:42.000000000 +0530
@@ -17,6 +17,8 @@
IBusLookupTable *table;
IBusProperty *status_prop;
IBusPropList *prop_list;
+ IBusProperty *show_iok_prop;
+ gchar *keymap_name;
};
struct _IBusM17NEngineClass {
@@ -127,12 +129,14 @@
engine_class->cursor_up = ibus_m17n_engine_cursor_up;
engine_class->cursor_down = ibus_m17n_engine_cursor_down;
- // engine_class->property_activate = ibus_m17n_engine_property_activate;
+ engine_class->property_activate = ibus_m17n_engine_property_activate;
}
static void
ibus_m17n_engine_init (IBusM17NEngine *m17n)
{
+ IBusText *text;
+
m17n->status_prop = ibus_property_new ("status",
PROP_TYPE_NORMAL,
NULL,
@@ -143,8 +147,21 @@
0,
NULL);
+ text = ibus_text_new_from_string ("iok");
+ m17n->show_iok_prop = ibus_property_new ("iok",
+ PROP_TYPE_NORMAL,
+ text,
+ "/usr/share/pixmaps/iok.xpm",
+ text,
+ TRUE,
+ FALSE,
+ 0,
+ NULL);
+ g_object_unref (text);
+
m17n->prop_list = ibus_prop_list_new ();
ibus_prop_list_append (m17n->prop_list, m17n->status_prop);
+ ibus_prop_list_append (m17n->prop_list, m17n->show_iok_prop);
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
m17n->context = NULL;
@@ -165,6 +182,7 @@
engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
g_assert (engine_name);
+ m17n->keymap_name = g_strdup (engine_name);
if (im_table == NULL) {
im_table = g_hash_table_new_full (g_str_hash,
@@ -185,7 +203,9 @@
lang = strv[0];
name = strv[1];
-
+
+ if(strcmp(name,"inscript")==0)
+ ibus_property_set_visible(m17n->show_iok_prop,TRUE);
im = minput_open_im (msymbol (lang), msymbol (name), NULL);
if (im != NULL) {
mplist_put (im->driver.callback_list, Minput_preedit_start, ibus_m17n_engine_callback);
@@ -247,6 +267,7 @@
m17n->prop_list = NULL;
}
+
if (m17n->status_prop) {
g_object_unref (m17n->status_prop);
m17n->status_prop = NULL;
@@ -398,6 +419,7 @@
IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
ibus_engine_register_properties (engine, m17n->prop_list);
+
ibus_m17n_engine_process_key (m17n, msymbol ("input-focus-in"));
parent_class->focus_in (engine);
@@ -483,7 +505,20 @@
const gchar *prop_name,
guint prop_state)
{
- g_debug ("prop_name=%s, prop_state=%d", prop_name, prop_state);
+ gchar *langi;
+ gchar **strv;
+ gchar cmd[80];
+
+ IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
+
+ strv = g_strsplit (m17n->keymap_name, ":", 2);
+ g_assert (g_strv_length (strv) == 2);
+ langi = strv[0];
+
+ sprintf(cmd,"/usr/bin/iok -n %s",langi);
+ g_debug ("keymap name = %s,prop_name=%s, prop_state=%d",m17n->keymap_name, prop_name, prop_state);
+
+ g_spawn_command_line_async(cmd, NULL );
parent_class->property_activate (engine, prop_name, prop_state);
}