ibus-m17n/ibus-m17n-iok.patch

112 lines
3.7 KiB
Diff
Raw Normal View History

2011-03-07 06:13:46 +00:00
From c27a0917c26624f1741efeebe20cd5cfb8647a67 Mon Sep 17 00:00:00 2001
2010-12-08 09:25:29 +00:00
From: Daiki Ueno <ueno@unixuser.org>
2011-03-07 06:13:46 +00:00
Date: Mon, 7 Mar 2011 14:57:32 +0900
Subject: [PATCH] Apply iok patch from Fedora.
2010-12-08 09:25:29 +00:00
---
2011-03-07 06:13:46 +00:00
src/engine.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
2010-12-08 09:25:29 +00:00
diff --git a/src/engine.c b/src/engine.c
2011-03-07 06:13:46 +00:00
index 62359c1..362d347 100644
--- a/src/engine.c
+++ b/src/engine.c
2011-03-07 06:13:46 +00:00
@@ -37,6 +37,7 @@ struct _IBusM17NEngine {
2010-09-03 08:30:46 +00:00
IBusProperty *setup_prop;
2011-03-07 06:13:46 +00:00
#endif /* HAVE_SETUP */
2009-03-05 04:34:40 +00:00
IBusPropList *prop_list;
+ IBusProperty *show_iok_prop;
};
struct _IBusM17NEngineClass {
2011-03-07 06:13:46 +00:00
@@ -48,6 +49,7 @@ struct _IBusM17NEngineClass {
2010-12-27 05:52:29 +00:00
guint preedit_background;
gint preedit_underline;
gint lookup_table_orientation;
+ gboolean use_iok;
MInputMethod *im;
};
2011-03-07 06:13:46 +00:00
@@ -316,6 +318,9 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
2010-12-27 05:52:29 +00:00
}
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);
2011-03-07 06:13:46 +00:00
@@ -420,6 +425,7 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
2010-12-08 09:25:29 +00:00
{
IBusText* label;
IBusText* tooltip;
2010-12-27 05:52:29 +00:00
+ IBusM17NEngineClass *klass = (IBusM17NEngineClass *) G_OBJECT_GET_CLASS (m17n);
2010-12-08 09:25:29 +00:00
2011-03-07 06:13:46 +00:00
m17n->prop_list = ibus_prop_list_new ();
g_object_ref_sink (m17n->prop_list);
@@ -452,6 +458,23 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
ibus_prop_list_append (m17n->prop_list, m17n->setup_prop);
#endif /* HAVE_SETUP */
2009-03-05 04:34:40 +00:00
2010-09-03 08:30:46 +00:00
+ label = ibus_text_new_from_string ("iok");
2009-03-05 04:34:40 +00:00
+ m17n->show_iok_prop = ibus_property_new ("iok",
2010-09-03 08:30:46 +00:00
+ PROP_TYPE_NORMAL,
+ label,
+ "/usr/share/pixmaps/iok.xpm",
+ label,
+ TRUE,
+ FALSE,
+ 0,
+ NULL);
2010-02-02 03:25:05 +00:00
+ g_object_ref_sink (m17n->show_iok_prop);
2011-01-14 01:22:55 +00:00
+
+ if (klass->use_iok)
+ ibus_property_set_visible (m17n->show_iok_prop, TRUE);
2009-03-05 04:34:40 +00:00
+
+ ibus_prop_list_append (m17n->prop_list, m17n->show_iok_prop);
2011-03-07 06:13:46 +00:00
+
2009-03-05 04:34:40 +00:00
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
2010-02-02 03:25:05 +00:00
g_object_ref_sink (m17n->table);
2011-03-07 06:13:46 +00:00
m17n->context = NULL;
@@ -537,6 +560,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
2009-03-05 04:34:40 +00:00
}
2011-03-07 06:13:46 +00:00
#endif /* HAVE_SETUP */
2009-03-05 04:34:40 +00:00
2010-02-02 03:25:05 +00:00
+ if (m17n->show_iok_prop) {
+ g_object_unref (m17n->show_iok_prop);
+ m17n->show_iok_prop = NULL;
+ }
2009-03-05 04:34:40 +00:00
+
2010-02-02 03:25:05 +00:00
if (m17n->table) {
g_object_unref (m17n->table);
m17n->table = NULL;
2011-03-07 06:13:46 +00:00
@@ -844,6 +872,24 @@ ibus_m17n_engine_property_activate (IBusEngine *engine,
}
#endif /* HAVE_SETUP */
+ if (g_strcmp0 (prop_name, "iok") == 0) {
2010-12-08 09:25:29 +00:00
+ const gchar *engine_name;
+ gchar *lang = NULL, *name = NULL;
2009-03-05 04:34:40 +00:00
+
2010-12-08 09:25:29 +00:00
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name)) {
+ gchar *iok;
2009-03-05 04:34:40 +00:00
+
2010-12-08 09:25:29 +00:00
+ 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);
2011-03-07 06:13:46 +00:00
+ }
+
2009-03-05 04:34:40 +00:00
parent_class->property_activate (engine, prop_name, prop_state);
}
2011-03-07 06:13:46 +00:00
2010-12-08 09:25:29 +00:00
--
2011-03-07 06:13:46 +00:00
1.7.4
2010-12-08 09:25:29 +00:00