From a9175a605dd1e0c500a7866159611425105e0bc1 Mon Sep 17 00:00:00 2001 From: paragn Date: Thu, 5 Mar 2009 04:34:40 +0000 Subject: [PATCH] - Add iok support to ibus-m17n. --- ibus-m17n-iok.patch | 106 ++++++++++++++++++++++++++++++++++++++++++++ ibus-m17n.spec | 11 +++-- 2 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 ibus-m17n-iok.patch diff --git a/ibus-m17n-iok.patch b/ibus-m17n-iok.patch new file mode 100644 index 0000000..a3aefd0 --- /dev/null +++ b/ibus-m17n-iok.patch @@ -0,0 +1,106 @@ +--- 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); + } + diff --git a/ibus-m17n.spec b/ibus-m17n.spec index 3c28947..f15c589 100644 --- a/ibus-m17n.spec +++ b/ibus-m17n.spec @@ -1,8 +1,6 @@ -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -%define mod_path ibus-1.1 Name: ibus-m17n Version: 1.1.0.20090211 -Release: 3%{?dist} +Release: 4%{?dist} Summary: The M17N engine for IBus platform License: GPLv2+ Group: System Environment/Libraries @@ -10,6 +8,7 @@ URL: http://code.google.com/p/ibus/ Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz Patch0: ibus-m17n-HEAD.patch +Patch1: ibus-m17n-iok.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gettext-devel @@ -20,6 +19,7 @@ BuildRequires: ibus-devel Requires: ibus Requires: m17n-lib +Requires: iok > 1.3.1 %description M17N engine for IBus input platform. It allows input of many launguaes using @@ -28,6 +28,7 @@ the input table maps from m17n-db. %prep %setup -q %patch0 -p1 +%patch1 -p0 %build %configure --disable-static @@ -37,7 +38,6 @@ make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make DESTDIR=${RPM_BUILD_ROOT} install -rm -f $RPM_BUILD_ROOT%{python_sitearch}/_m17n.la %find_lang %{name} @@ -52,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/ibus/component/* %changelog +* Thu Mar 05 2009 Parag - 1.1.0.20090211-4 +- Add iok support to ibus-m17n. + * Tue Feb 24 2009 Fedora Release Engineering - 1.1.0.20090211-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild