Update to 1.3.1-10.
This commit is contained in:
parent
76627c1ee5
commit
169cd4afc2
1316
ibus-m17n-HEAD.patch
1316
ibus-m17n-HEAD.patch
File diff suppressed because it is too large
Load Diff
@ -1,333 +1,148 @@
|
||||
From 7905a25d3ebd3e310b5609feff48a5c109bf80f3 Mon Sep 17 00:00:00 2001
|
||||
From: Peng Huang <shawn.p.huang@gmail.com>
|
||||
Date: Tue, 2 Nov 2010 10:39:57 +0900
|
||||
From 0399c80ffa111c5b16943242b817063d0e64b2fe Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <ueno@unixuser.org>
|
||||
Date: Fri, 3 Dec 2010 17:05:45 +0900
|
||||
Subject: [PATCH] Fix problem with ibus-1.4
|
||||
|
||||
---
|
||||
src/engine.c | 203 +++++++++++++++++++++++++++++++++-----------------------
|
||||
src/m17nutil.c | 26 ++++----
|
||||
src/main.c | 4 +-
|
||||
src/setup.c | 65 +++++++++---------
|
||||
4 files changed, 170 insertions(+), 128 deletions(-)
|
||||
src/engine.c | 58 +++++++++++++++++++++++--------------------------
|
||||
src/m17nutil.c | 27 ++++++++++-------------
|
||||
src/main.c | 7 +++--
|
||||
src/setup.c | 65 ++++++++++++++++++++++++++++---------------------------
|
||||
4 files changed, 76 insertions(+), 81 deletions(-)
|
||||
|
||||
diff --git a/src/engine.c b/src/engine.c
|
||||
index 1dbcf34..5ef9c67 100644
|
||||
index f8e7fe5..5fbe46f 100644
|
||||
--- a/src/engine.c
|
||||
+++ b/src/engine.c
|
||||
@@ -25,6 +25,16 @@ struct _IBusM17NEngineClass {
|
||||
IBusEngineClass parent;
|
||||
};
|
||||
|
||||
+/* configuration shared among engines which belong to the same MInputMethod */
|
||||
+struct _IBusM17NConfig {
|
||||
+ gboolean loaded;
|
||||
+ guint preedit_foreground;
|
||||
+ guint preedit_background;
|
||||
+ gint preedit_underline;
|
||||
+ gint lookup_table_orientation;
|
||||
+};
|
||||
+typedef struct _IBusM17NConfig IBusM17NConfig;
|
||||
+
|
||||
/* functions prototype */
|
||||
static void ibus_m17n_engine_class_init (IBusM17NEngineClass *klass);
|
||||
static void ibus_m17n_engine_init (IBusM17NEngine *m17n);
|
||||
@@ -80,10 +90,6 @@ static IBusEngineClass *parent_class = NULL;
|
||||
static GHashTable *im_table = NULL;
|
||||
|
||||
static IBusConfig *config = NULL;
|
||||
-static guint preedit_foreground = INVALID_COLOR;
|
||||
-static guint preedit_background = INVALID_COLOR;
|
||||
-static gint preedit_underline = IBUS_ATTR_UNDERLINE_NONE;
|
||||
-static gint lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
|
||||
|
||||
void
|
||||
ibus_m17n_init (IBusBus *bus)
|
||||
@@ -152,37 +158,92 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
|
||||
|
||||
}
|
||||
|
||||
+static IBusM17NConfig *
|
||||
+ibus_m17n_engine_get_config (IBusM17NEngine *m17n)
|
||||
+{
|
||||
+ const gchar *engine_name;
|
||||
+ gboolean preedit_highlight;
|
||||
+ GVariant *value = NULL;
|
||||
+ IBusM17NConfig *im_config;
|
||||
+
|
||||
+ im_config = m17n->context->im->arg;
|
||||
+ g_assert (im_config);
|
||||
+
|
||||
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
|
||||
+
|
||||
+ if (im_config->loaded)
|
||||
+ return im_config;
|
||||
+
|
||||
+ preedit_highlight = ibus_m17n_preedit_highlight (engine_name);
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ m17n->config_section,
|
||||
+ "preedit_foreground")) {
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
+
|
||||
+ im_config->preedit_foreground = ibus_m17n_parse_color (hex);
|
||||
+ g_variant_unref (value);
|
||||
+ } else if (preedit_highlight)
|
||||
+ im_config->preedit_foreground = PREEDIT_FOREGROUND;
|
||||
+
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ m17n->config_section,
|
||||
+ "preedit_background")) {
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
+
|
||||
+ im_config->preedit_background = ibus_m17n_parse_color (hex);
|
||||
+ g_variant_unref (value);
|
||||
+ } else if (preedit_highlight)
|
||||
+ im_config->preedit_background = PREEDIT_BACKGROUND;
|
||||
+
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ m17n->config_section,
|
||||
+ "preedit_underline")) {
|
||||
+ im_config->preedit_underline = g_variant_get_int32 (value);
|
||||
+ g_variant_unref (value);
|
||||
+ } else
|
||||
+ im_config->preedit_underline = IBUS_ATTR_UNDERLINE_NONE;
|
||||
+
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ m17n->config_section,
|
||||
+ "lookup_table_orientation")) {
|
||||
+ im_config->lookup_table_orientation = g_variant_get_int32 (value);
|
||||
+ g_variant_unref (value);
|
||||
+ } else
|
||||
+ im_config->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
|
||||
+
|
||||
+ im_config->loaded = TRUE;
|
||||
+
|
||||
+ return im_config;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
ibus_config_value_changed (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
- GValue *value,
|
||||
+ GVariant *value,
|
||||
gpointer user_data)
|
||||
{
|
||||
IBusM17NEngine *m17n = (IBusM17NEngine *) user_data;
|
||||
|
||||
if (g_strcmp0 (section, m17n->config_section) == 0) {
|
||||
+ IBusM17NConfig *im_config;
|
||||
+
|
||||
+ im_config = ibus_m17n_engine_get_config (m17n);
|
||||
if (g_strcmp0 (name, "preedit_foreground") == 0) {
|
||||
- const gchar *hex = g_value_get_string (value);
|
||||
- guint color;
|
||||
- color = ibus_m17n_parse_color (hex);
|
||||
- if (color != INVALID_COLOR) {
|
||||
- preedit_foreground = color;
|
||||
- ibus_m17n_engine_update_preedit (m17n);
|
||||
- }
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
+
|
||||
+ im_config->preedit_foreground = ibus_m17n_parse_color (hex);
|
||||
+ ibus_m17n_engine_update_preedit (m17n);
|
||||
} else if (g_strcmp0 (name, "preedit_background") == 0) {
|
||||
- const gchar *hex = g_value_get_string (value);
|
||||
- guint color;
|
||||
- color = ibus_m17n_parse_color (hex);
|
||||
- if (color != INVALID_COLOR) {
|
||||
- preedit_background = color;
|
||||
- ibus_m17n_engine_update_preedit (m17n);
|
||||
- }
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
+
|
||||
+ im_config->preedit_background = ibus_m17n_parse_color (hex);
|
||||
+ ibus_m17n_engine_update_preedit (m17n);
|
||||
} else if (g_strcmp0 (name, "preedit_underline") == 0) {
|
||||
- preedit_underline = g_value_get_int (value);
|
||||
+ im_config->preedit_underline = g_variant_get_int32 (value);
|
||||
ibus_m17n_engine_update_preedit (m17n);
|
||||
} else if (g_strcmp0 (name, "lookup_table_orientation") == 0) {
|
||||
- lookup_table_orientation = g_value_get_int (value);
|
||||
+ im_config->lookup_table_orientation = g_variant_get_int32 (value);
|
||||
ibus_m17n_engine_update_lookup_table (m17n);
|
||||
}
|
||||
}
|
||||
@@ -229,6 +290,14 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
|
||||
m17n->context = NULL;
|
||||
}
|
||||
|
||||
+static void
|
||||
+ibus_m17n_engine_close_im (gpointer user_data)
|
||||
+{
|
||||
+ MInputMethod *im = user_data;
|
||||
+ g_slice_free (IBusM17NConfig, im->arg);
|
||||
+ minput_close_im (im);
|
||||
+}
|
||||
+
|
||||
@@ -58,7 +58,7 @@ static void ibus_m17n_engine_class_finalize (IBusM17NEngineClass *klass);
|
||||
static void ibus_m17n_config_value_changed (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
- GValue *value,
|
||||
+ GVariant *value,
|
||||
IBusM17NEngineClass *klass);
|
||||
static GObject*
|
||||
ibus_m17n_engine_constructor (GType type,
|
||||
guint n_construct_params,
|
||||
@@ -240,8 +309,7 @@ ibus_m17n_engine_constructor (GType type,
|
||||
gchar *lang;
|
||||
gchar *name;
|
||||
gchar **strv;
|
||||
ibus_m17n_engine_constructor (GType type,
|
||||
@@ -274,7 +274,7 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
|
||||
IBusEngineClass *engine_class = IBUS_ENGINE_CLASS (klass);
|
||||
- GValue value = { 0 };
|
||||
- gboolean preedit_highlight;
|
||||
+ GVariant *value = NULL;
|
||||
gchar *engine_name, *lang = NULL, *name = NULL;
|
||||
IBusM17NEngineConfig *engine_config;
|
||||
|
||||
m17n = (IBusM17NEngine *) G_OBJECT_CLASS (parent_class)->constructor (type,
|
||||
n_construct_params,
|
||||
@@ -262,12 +330,21 @@ ibus_m17n_engine_constructor (GType type,
|
||||
im_table = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
g_free,
|
||||
- (GDestroyNotify) minput_close_im);
|
||||
+ (GDestroyNotify) ibus_m17n_engine_close_im);
|
||||
}
|
||||
@@ -321,43 +321,39 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
|
||||
engine_config = ibus_m17n_get_engine_config (engine_name);
|
||||
g_free (engine_name);
|
||||
|
||||
im = (MInputMethod *) g_hash_table_lookup (im_table, engine_name);
|
||||
if (im == NULL) {
|
||||
- im = minput_open_im (msymbol (lang), msymbol (name), NULL);
|
||||
+ IBusM17NConfig *im_config;
|
||||
+
|
||||
+ im_config = g_slice_new0 (IBusM17NConfig);
|
||||
+ im_config->loaded = FALSE;
|
||||
+ im_config->preedit_foreground = INVALID_COLOR;
|
||||
+ im_config->preedit_background = INVALID_COLOR;
|
||||
+ im_config->preedit_underline = IBUS_ATTR_UNDERLINE_NONE;
|
||||
+ im_config->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
|
||||
+
|
||||
+ im = minput_open_im (msymbol (lang), msymbol (name), im_config);
|
||||
if (im != NULL) {
|
||||
mplist_put (im->driver.callback_list, Minput_preedit_start, ibus_m17n_engine_callback);
|
||||
mplist_put (im->driver.callback_list, Minput_preedit_draw, ibus_m17n_engine_callback);
|
||||
@@ -288,68 +365,23 @@ ibus_m17n_engine_constructor (GType type,
|
||||
mplist_put (im->driver.callback_list, Minput_delete_surrounding_text, ibus_m17n_engine_callback);
|
||||
|
||||
g_hash_table_insert (im_table, g_strdup (engine_name), im);
|
||||
+
|
||||
+ g_signal_connect (config, "value-changed",
|
||||
+ G_CALLBACK(ibus_config_value_changed), m17n);
|
||||
+ m17n->config_section = g_strdup_printf ("engine/M17N/%s/%s",
|
||||
+ lang, name);
|
||||
}
|
||||
}
|
||||
+ g_strfreev (strv);
|
||||
|
||||
if (im == NULL) {
|
||||
g_warning ("Can not find m17n keymap %s", engine_name);
|
||||
- g_strfreev (strv);
|
||||
g_object_unref (m17n);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
m17n->context = minput_create_ic (im, m17n);
|
||||
|
||||
- m17n->config_section = g_strdup_printf ("engine/M17N/%s/%s",
|
||||
- lang, name);
|
||||
- g_strfreev (strv);
|
||||
-
|
||||
- preedit_highlight = ibus_m17n_preedit_highlight (engine_name);
|
||||
- if (ibus_config_get_value (config,
|
||||
- m17n->config_section,
|
||||
- klass->config_section,
|
||||
- "preedit_foreground",
|
||||
- &value)) {
|
||||
- const gchar *hex = g_value_get_string (&value);
|
||||
- guint color = ibus_m17n_parse_color (hex);
|
||||
- if (color != (guint)-1)
|
||||
- preedit_foreground = color;
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ klass->config_section,
|
||||
+ "preedit_foreground")) {
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
|
||||
klass->preedit_foreground = ibus_m17n_parse_color (hex);
|
||||
- g_value_unset (&value);
|
||||
- } else if (preedit_highlight)
|
||||
- preedit_foreground = PREEDIT_FOREGROUND;
|
||||
-
|
||||
+ g_variant_unref (value);
|
||||
} else if (engine_config->preedit_highlight)
|
||||
klass->preedit_foreground = PREEDIT_FOREGROUND;
|
||||
|
||||
- if (ibus_config_get_value (config,
|
||||
- m17n->config_section,
|
||||
- klass->config_section,
|
||||
- "preedit_background",
|
||||
- &value)) {
|
||||
- const gchar *hex = g_value_get_string (&value);
|
||||
- guint color = ibus_m17n_parse_color (hex);
|
||||
- if (color != (guint)-1)
|
||||
- preedit_background = color;
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ klass->config_section,
|
||||
+ "preedit_background")) {
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
|
||||
klass->preedit_background = ibus_m17n_parse_color (hex);
|
||||
- g_value_unset (&value);
|
||||
- } else if (preedit_highlight)
|
||||
- preedit_background = PREEDIT_BACKGROUND;
|
||||
-
|
||||
+ g_variant_unref (value);
|
||||
} else if (engine_config->preedit_highlight)
|
||||
klass->preedit_background = PREEDIT_BACKGROUND;
|
||||
|
||||
- if (ibus_config_get_value (config,
|
||||
- m17n->config_section,
|
||||
- klass->config_section,
|
||||
- "preedit_underline",
|
||||
- &value)) {
|
||||
- preedit_underline = g_value_get_int (&value);
|
||||
- klass->preedit_underline = g_value_get_int (&value);
|
||||
- g_value_unset (&value);
|
||||
- } else
|
||||
- preedit_underline = IBUS_ATTR_UNDERLINE_NONE;
|
||||
-
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ klass->config_section,
|
||||
+ "preedit_underline")) {
|
||||
+ klass->preedit_underline = g_variant_get_int32 (value);
|
||||
+ g_variant_unref (value);
|
||||
} else
|
||||
klass->preedit_underline = IBUS_ATTR_UNDERLINE_NONE;
|
||||
|
||||
- if (ibus_config_get_value (config,
|
||||
- m17n->config_section,
|
||||
- klass->config_section,
|
||||
- "lookup_table_orientation",
|
||||
- &value)) {
|
||||
- lookup_table_orientation = g_value_get_int (&value);
|
||||
- klass->lookup_table_orientation = g_value_get_int (&value);
|
||||
- g_value_unset (&value);
|
||||
- } else
|
||||
- lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
|
||||
-
|
||||
- g_signal_connect (config, "value-changed",
|
||||
- G_CALLBACK(ibus_config_value_changed), m17n);
|
||||
-
|
||||
return (GObject *) m17n;
|
||||
}
|
||||
+ if (value = ibus_config_get_value (config,
|
||||
+ klass->config_section,
|
||||
+ "lookup_table_orientation")) {
|
||||
+ klass->lookup_table_orientation = g_variant_get_int32 (value);
|
||||
+ g_variant_unref (value);
|
||||
} else
|
||||
klass->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
|
||||
|
||||
@@ -395,18 +427,22 @@ ibus_m17n_engine_update_preedit (IBusM17NEngine *m17n)
|
||||
@@ -372,28 +368,28 @@ static void
|
||||
ibus_m17n_config_value_changed (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
- GValue *value,
|
||||
+ GVariant *value,
|
||||
IBusM17NEngineClass *klass)
|
||||
{
|
||||
IBusText *text;
|
||||
gchar *buf;
|
||||
+ IBusM17NConfig *im_config;
|
||||
|
||||
+ im_config = ibus_m17n_engine_get_config (m17n);
|
||||
buf = ibus_m17n_mtext_to_utf8 (m17n->context->preedit);
|
||||
if (buf) {
|
||||
text = ibus_text_new_from_static_string (buf);
|
||||
- if (preedit_foreground != INVALID_COLOR)
|
||||
+ if (im_config->preedit_foreground != INVALID_COLOR)
|
||||
ibus_text_append_attribute (text, IBUS_ATTR_TYPE_FOREGROUND,
|
||||
- preedit_foreground, 0, -1);
|
||||
- if (preedit_background != INVALID_COLOR)
|
||||
+ im_config->preedit_foreground,
|
||||
+ 0, -1);
|
||||
+ if (im_config->preedit_background != INVALID_COLOR)
|
||||
ibus_text_append_attribute (text, IBUS_ATTR_TYPE_BACKGROUND,
|
||||
- preedit_background, 0, -1);
|
||||
+ im_config->preedit_background,
|
||||
+ 0, -1);
|
||||
ibus_text_append_attribute (text, IBUS_ATTR_TYPE_UNDERLINE,
|
||||
- preedit_underline, 0, -1);
|
||||
+ im_config->preedit_underline, 0, -1);
|
||||
ibus_engine_update_preedit_text ((IBusEngine *) m17n,
|
||||
text,
|
||||
m17n->context->cursor_pos,
|
||||
@@ -694,6 +730,7 @@ ibus_m17n_engine_update_lookup_table (IBusM17NEngine *m17n)
|
||||
group = m17n->context->candidate_list;
|
||||
gint i = 0;
|
||||
gint page = 1;
|
||||
+ IBusM17NConfig *im_config;
|
||||
|
||||
while (1) {
|
||||
gint len;
|
||||
@@ -744,7 +781,9 @@ ibus_m17n_engine_update_lookup_table (IBusM17NEngine *m17n)
|
||||
if (g_strcmp0 (section, klass->config_section) == 0) {
|
||||
if (g_strcmp0 (name, "preedit_foreground") == 0) {
|
||||
- const gchar *hex = g_value_get_string (value);
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
guint color;
|
||||
color = ibus_m17n_parse_color (hex);
|
||||
if (color != INVALID_COLOR) {
|
||||
klass->preedit_foreground = color;
|
||||
}
|
||||
} else if (g_strcmp0 (name, "preedit_background") == 0) {
|
||||
- const gchar *hex = g_value_get_string (value);
|
||||
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||
guint color;
|
||||
color = ibus_m17n_parse_color (hex);
|
||||
if (color != INVALID_COLOR) {
|
||||
klass->preedit_background = color;
|
||||
}
|
||||
} else if (g_strcmp0 (name, "preedit_underline") == 0) {
|
||||
- klass->preedit_underline = g_value_get_int (value);
|
||||
+ klass->preedit_underline = g_variant_get_int32 (value);
|
||||
} else if (g_strcmp0 (name, "lookup_table_orientation") == 0) {
|
||||
- klass->lookup_table_orientation = g_value_get_int (value);
|
||||
+ klass->lookup_table_orientation = g_variant_get_int32 (value);
|
||||
}
|
||||
|
||||
ibus_lookup_table_set_cursor_pos (m17n->table, m17n->context->candidate_index - i);
|
||||
- ibus_lookup_table_set_orientation (m17n->table, lookup_table_orientation);
|
||||
+
|
||||
+ im_config = ibus_m17n_engine_get_config (m17n);
|
||||
+ ibus_lookup_table_set_orientation (m17n->table, im_config->lookup_table_orientation);
|
||||
|
||||
text = ibus_text_new_from_printf ("( %d / %d )", page, mplist_length (m17n->context->candidate_list));
|
||||
|
||||
}
|
||||
}
|
||||
diff --git a/src/m17nutil.c b/src/m17nutil.c
|
||||
index 22b9fe1..8491d40 100644
|
||||
index 7bc4ea5..8fac1fe 100644
|
||||
--- a/src/m17nutil.c
|
||||
+++ b/src/m17nutil.c
|
||||
@@ -157,26 +157,26 @@ ibus_m17n_engine_new (MSymbol lang,
|
||||
@@ -109,6 +109,7 @@ ibus_m17n_engine_new (MSymbol lang,
|
||||
gchar *engine_title;
|
||||
gchar *engine_icon;
|
||||
gchar *engine_desc;
|
||||
+ IBusM17NEngineConfig *config;
|
||||
|
||||
engine_name = g_strdup_printf ("m17n:%s:%s", msymbol_name (lang), msymbol_name (name));
|
||||
|
||||
@@ -116,17 +117,17 @@ ibus_m17n_engine_new (MSymbol lang,
|
||||
engine_title = ibus_m17n_mtext_to_utf8 (title);
|
||||
engine_icon = ibus_m17n_mtext_to_utf8 (icon);
|
||||
engine_desc = ibus_m17n_mtext_to_utf8 (desc);
|
||||
@ -342,18 +157,8 @@ index 22b9fe1..8491d40 100644
|
||||
- "us");
|
||||
- /* set default rank to 0 */
|
||||
- engine->rank = 0;
|
||||
-
|
||||
+
|
||||
+ guint rank = 0;
|
||||
for (i = 0; i < G_N_ELEMENTS(engine_config); i++) {
|
||||
if (g_pattern_match_simple (engine_config[i].name, engine_name)) {
|
||||
/* set rank of default keymap to 1 */
|
||||
- engine->rank = engine_config[i].rank;
|
||||
+ rank = engine_config[i].rank;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+ config = ibus_m17n_get_engine_config (engine_name);
|
||||
+
|
||||
+ engine = ibus_engine_desc_new_varargs ("name", engine_name,
|
||||
+ "longname", engine_longname,
|
||||
+ "description", engine_desc ? engine_desc : "",
|
||||
@ -361,24 +166,41 @@ index 22b9fe1..8491d40 100644
|
||||
+ "license", "GPL",
|
||||
+ "icon", engine_icon ? engine_icon : "",
|
||||
+ "layout", "us",
|
||||
+ "rank", rank,
|
||||
+ "rank", config->rank,
|
||||
+ NULL);
|
||||
+
|
||||
|
||||
g_free (engine_name);
|
||||
g_free (engine_longname);
|
||||
g_free (engine_title);
|
||||
@@ -315,10 +316,6 @@ ibus_m17n_get_component (void)
|
||||
|
||||
for (p = engines; p != NULL; p = p->next) {
|
||||
IBusEngineDesc *engine = p->data;
|
||||
- IBusM17NEngineConfig *config;
|
||||
-
|
||||
- config = ibus_m17n_get_engine_config (engine->name);
|
||||
- engine->rank = config->rank;
|
||||
ibus_component_add_engine (component, engine);
|
||||
}
|
||||
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 514d971..3bdafdb 100644
|
||||
index e76898d..bba31e1 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -51,7 +51,9 @@ start_component (void)
|
||||
@@ -51,13 +51,14 @@ start_component (void)
|
||||
engines = ibus_component_get_engines (component);
|
||||
for (p = engines; p != NULL; p = p->next) {
|
||||
IBusEngineDesc *engine = (IBusEngineDesc *)p->data;
|
||||
- ibus_factory_add_engine (factory, engine->name, IBUS_TYPE_M17N_ENGINE);
|
||||
+ ibus_factory_add_engine (factory,
|
||||
+ ibus_engine_desc_get_name (engine),
|
||||
+ IBUS_TYPE_M17N_ENGINE);
|
||||
- GType type = ibus_m17n_engine_get_type_for_name (engine->name);
|
||||
+ const gchar *engine_name = ibus_engine_desc_get_name (engine);
|
||||
+ GType type = ibus_m17n_engine_get_type_for_name (engine_name);
|
||||
|
||||
if (type == G_TYPE_INVALID) {
|
||||
- g_debug ("Can not create engine type for %s", engine->name);
|
||||
+ g_debug ("Can not create engine type for %s", engine_name);
|
||||
continue;
|
||||
}
|
||||
- ibus_factory_add_engine (factory, engine->name, type);
|
||||
+ ibus_factory_add_engine (factory, engine_name, type);
|
||||
}
|
||||
|
||||
if (ibus) {
|
||||
@ -540,5 +362,5 @@ index 0fe6e1b..178190e 100644
|
||||
|
||||
index = get_combo_box_index_by_value (GTK_COMBO_BOX(combobox_orientation),
|
||||
--
|
||||
1.7.3.2
|
||||
1.7.3.3
|
||||
|
||||
|
@ -1,20 +1,46 @@
|
||||
From 17e633c3e3cbfd1a240b95352167005a8396a7b2 Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <ueno@unixuser.org>
|
||||
Date: Wed, 8 Dec 2010 18:06:11 +0900
|
||||
Subject: [PATCH] Apply iok patch from fedora.
|
||||
|
||||
---
|
||||
src/engine.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 files changed, 46 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/src/engine.c b/src/engine.c
|
||||
index 260a806..abeeeef 100644
|
||||
index f8e7fe5..ff8bbfc 100644
|
||||
--- a/src/engine.c
|
||||
+++ b/src/engine.c
|
||||
@@ -19,6 +19,8 @@ struct _IBusM17NEngine {
|
||||
@@ -35,6 +35,7 @@ struct _IBusM17NEngine {
|
||||
IBusProperty *status_prop;
|
||||
IBusProperty *setup_prop;
|
||||
IBusPropList *prop_list;
|
||||
gchar *config_section;
|
||||
+ IBusProperty *show_iok_prop;
|
||||
+ gchar *keymap_name;
|
||||
};
|
||||
|
||||
struct _IBusM17NEngineClass {
|
||||
@@ -218,10 +220,23 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
|
||||
@@ -411,6 +412,8 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
|
||||
{
|
||||
IBusText* label;
|
||||
IBusText* tooltip;
|
||||
+ const gchar *engine_name;
|
||||
+ gchar *lang = NULL, *name = NULL;
|
||||
|
||||
m17n->status_prop = ibus_property_new ("status",
|
||||
PROP_TYPE_NORMAL,
|
||||
@@ -436,10 +439,32 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
|
||||
NULL);
|
||||
g_object_ref_sink (m17n->setup_prop);
|
||||
|
||||
+ /* show iok icon for inscript - should be go in default.xml? */
|
||||
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
|
||||
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name) &&
|
||||
+ (g_strcmp0 (name, "inscript") == 0 ||
|
||||
+ g_strcmp0 (name, "inscript2") == 0))
|
||||
+ ibus_property_set_visible (m17n->show_iok_prop, TRUE);
|
||||
+ g_free (lang);
|
||||
+ g_free (name);
|
||||
+
|
||||
+ label = ibus_text_new_from_string ("iok");
|
||||
+ m17n->show_iok_prop = ibus_property_new ("iok",
|
||||
+ PROP_TYPE_NORMAL,
|
||||
@ -35,26 +61,7 @@ index 260a806..abeeeef 100644
|
||||
|
||||
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
|
||||
g_object_ref_sink (m17n->table);
|
||||
@@ -248,6 +263,7 @@ ibus_m17n_engine_constructor (GType type,
|
||||
|
||||
engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
|
||||
g_assert (engine_name);
|
||||
+ m17n->keymap_name = g_strdup (engine_name);
|
||||
|
||||
strv = g_strsplit (engine_name, ":", 3);
|
||||
|
||||
@@ -257,6 +273,10 @@ ibus_m17n_engine_constructor (GType type,
|
||||
lang = strv[1];
|
||||
name = strv[2];
|
||||
|
||||
+ /* show iok icon for inscript */
|
||||
+ if(strcmp (name, "inscript") == 0 || strcmp (name , "inscript2") == 0)
|
||||
+ ibus_property_set_visible (m17n->show_iok_prop, TRUE);
|
||||
+
|
||||
if (im_table == NULL) {
|
||||
im_table = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
@@ -369,6 +389,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
|
||||
@@ -524,6 +549,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
|
||||
m17n->setup_prop = NULL;
|
||||
}
|
||||
|
||||
@ -66,23 +73,29 @@ index 260a806..abeeeef 100644
|
||||
if (m17n->table) {
|
||||
g_object_unref (m17n->table);
|
||||
m17n->table = NULL;
|
||||
@@ -669,6 +694,19 @@ ibus_m17n_engine_property_activate (IBusEngine *engine,
|
||||
@@ -827,6 +857,22 @@ ibus_m17n_engine_property_activate (IBusEngine *engine,
|
||||
LIBEXECDIR, engine_name);
|
||||
g_spawn_command_line_async (setup, NULL);
|
||||
g_free (setup);
|
||||
+ } else if (g_strcmp0 (prop_name, "iok") == 0) {
|
||||
+ gchar **strv;
|
||||
+ gchar cmd[80];
|
||||
+ const gchar *engine_name;
|
||||
+ gchar *lang = NULL, *name = NULL;
|
||||
+
|
||||
+ strv = g_strsplit (m17n->keymap_name, ":", 3);
|
||||
+ g_assert (g_strv_length (strv) == 3);
|
||||
+ g_assert (g_strcmp0 (strv[0], "m17n") == 0);
|
||||
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
|
||||
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name)) {
|
||||
+ gchar *iok;
|
||||
+
|
||||
+ sprintf (cmd, "/usr/bin/iok -n %s", strv[1]);
|
||||
+ g_debug ("keymap name = %s,prop_name=%s, prop_state=%d", m17n->keymap_name, prop_name, prop_state);
|
||||
+ g_strfreev (strv);
|
||||
+
|
||||
+ g_spawn_command_line_async(cmd, NULL);
|
||||
+ 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);
|
||||
}
|
||||
--
|
||||
1.7.3.3
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Name: ibus-m17n
|
||||
Version: 1.3.1
|
||||
Release: 9%{?dist}
|
||||
Release: 10%{?dist}
|
||||
Summary: The M17N engine for IBus platform
|
||||
License: GPLv2+
|
||||
Group: System Environment/Libraries
|
||||
@ -20,6 +20,7 @@ BuildRequires: libtool
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: m17n-lib-devel
|
||||
BuildRequires: gtk3-devel
|
||||
BuildRequires: gnome-common
|
||||
BuildRequires: ibus-devel >= %{require_ibus_version}
|
||||
|
||||
Requires: ibus >= %{require_ibus_version}
|
||||
@ -36,6 +37,7 @@ the input table maps from m17n-db.
|
||||
%patch1 -p1 -b .ibus-1.4
|
||||
%patch2 -p1 -b .iok
|
||||
%patch3 -p1 -b .surrounding-text
|
||||
NOCONFIGURE=1 ./autogen.sh
|
||||
|
||||
%build
|
||||
GTK2_CFLAGS=`pkg-config gtk+-3.0 --cflags`
|
||||
@ -64,6 +66,11 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/ibus/component/*
|
||||
|
||||
%changelog
|
||||
* Wed Dec 8 2010 Daiki Ueno <dueno@redhat.com> - 1.3.1-10
|
||||
- Update ibus-m17n-HEAD.patch.
|
||||
- Fix bug 658336 - ibus-m17n: define the IM ranks in a config file and
|
||||
not in a compiled binary
|
||||
|
||||
* Fri Dec 3 2010 Matthias Clasen <mclasen@redhat.com> - 1.3.1-9
|
||||
- Rebuild against newer gtk3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user