Update to 1.3.1-10.
This commit is contained in:
parent
76627c1ee5
commit
169cd4afc2
1312
ibus-m17n-HEAD.patch
1312
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 0399c80ffa111c5b16943242b817063d0e64b2fe Mon Sep 17 00:00:00 2001
|
||||||
From: Peng Huang <shawn.p.huang@gmail.com>
|
From: Daiki Ueno <ueno@unixuser.org>
|
||||||
Date: Tue, 2 Nov 2010 10:39:57 +0900
|
Date: Fri, 3 Dec 2010 17:05:45 +0900
|
||||||
Subject: [PATCH] Fix problem with ibus-1.4
|
Subject: [PATCH] Fix problem with ibus-1.4
|
||||||
|
|
||||||
---
|
---
|
||||||
src/engine.c | 203 +++++++++++++++++++++++++++++++++-----------------------
|
src/engine.c | 58 +++++++++++++++++++++++--------------------------
|
||||||
src/m17nutil.c | 26 ++++----
|
src/m17nutil.c | 27 ++++++++++-------------
|
||||||
src/main.c | 4 +-
|
src/main.c | 7 +++--
|
||||||
src/setup.c | 65 +++++++++---------
|
src/setup.c | 65 ++++++++++++++++++++++++++++---------------------------
|
||||||
4 files changed, 170 insertions(+), 128 deletions(-)
|
4 files changed, 76 insertions(+), 81 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/engine.c b/src/engine.c
|
diff --git a/src/engine.c b/src/engine.c
|
||||||
index 1dbcf34..5ef9c67 100644
|
index f8e7fe5..5fbe46f 100644
|
||||||
--- a/src/engine.c
|
--- a/src/engine.c
|
||||||
+++ b/src/engine.c
|
+++ b/src/engine.c
|
||||||
@@ -25,6 +25,16 @@ struct _IBusM17NEngineClass {
|
@@ -58,7 +58,7 @@ static void ibus_m17n_engine_class_finalize (IBusM17NEngineClass *klass);
|
||||||
IBusEngineClass parent;
|
static void ibus_m17n_config_value_changed (IBusConfig *config,
|
||||||
};
|
|
||||||
|
|
||||||
+/* 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 *section,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
- GValue *value,
|
- GValue *value,
|
||||||
+ GVariant *value,
|
+ GVariant *value,
|
||||||
gpointer user_data)
|
IBusM17NEngineClass *klass);
|
||||||
{
|
|
||||||
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);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static GObject*
|
static GObject*
|
||||||
ibus_m17n_engine_constructor (GType type,
|
ibus_m17n_engine_constructor (GType type,
|
||||||
guint n_construct_params,
|
@@ -274,7 +274,7 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
|
||||||
@@ -240,8 +309,7 @@ ibus_m17n_engine_constructor (GType type,
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
gchar *lang;
|
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
|
||||||
gchar *name;
|
IBusEngineClass *engine_class = IBUS_ENGINE_CLASS (klass);
|
||||||
gchar **strv;
|
|
||||||
- GValue value = { 0 };
|
- GValue value = { 0 };
|
||||||
- gboolean preedit_highlight;
|
|
||||||
+ GVariant *value = NULL;
|
+ GVariant *value = NULL;
|
||||||
|
gchar *engine_name, *lang = NULL, *name = NULL;
|
||||||
|
IBusM17NEngineConfig *engine_config;
|
||||||
|
|
||||||
m17n = (IBusM17NEngine *) G_OBJECT_CLASS (parent_class)->constructor (type,
|
@@ -321,43 +321,39 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
|
||||||
n_construct_params,
|
engine_config = ibus_m17n_get_engine_config (engine_name);
|
||||||
@@ -262,12 +330,21 @@ ibus_m17n_engine_constructor (GType type,
|
g_free (engine_name);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
- if (ibus_config_get_value (config,
|
||||||
- m17n->config_section,
|
- klass->config_section,
|
||||||
- "preedit_foreground",
|
- "preedit_foreground",
|
||||||
- &value)) {
|
- &value)) {
|
||||||
- const gchar *hex = g_value_get_string (&value);
|
- const gchar *hex = g_value_get_string (&value);
|
||||||
- guint color = ibus_m17n_parse_color (hex);
|
+ if (value = ibus_config_get_value (config,
|
||||||
- if (color != (guint)-1)
|
+ klass->config_section,
|
||||||
- preedit_foreground = color;
|
+ "preedit_foreground")) {
|
||||||
|
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||||
|
|
||||||
|
klass->preedit_foreground = ibus_m17n_parse_color (hex);
|
||||||
- g_value_unset (&value);
|
- g_value_unset (&value);
|
||||||
- } else if (preedit_highlight)
|
+ g_variant_unref (value);
|
||||||
- preedit_foreground = PREEDIT_FOREGROUND;
|
} else if (engine_config->preedit_highlight)
|
||||||
-
|
klass->preedit_foreground = PREEDIT_FOREGROUND;
|
||||||
|
|
||||||
- if (ibus_config_get_value (config,
|
- if (ibus_config_get_value (config,
|
||||||
- m17n->config_section,
|
- klass->config_section,
|
||||||
- "preedit_background",
|
- "preedit_background",
|
||||||
- &value)) {
|
- &value)) {
|
||||||
- const gchar *hex = g_value_get_string (&value);
|
- const gchar *hex = g_value_get_string (&value);
|
||||||
- guint color = ibus_m17n_parse_color (hex);
|
+ if (value = ibus_config_get_value (config,
|
||||||
- if (color != (guint)-1)
|
+ klass->config_section,
|
||||||
- preedit_background = color;
|
+ "preedit_background")) {
|
||||||
|
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||||
|
|
||||||
|
klass->preedit_background = ibus_m17n_parse_color (hex);
|
||||||
- g_value_unset (&value);
|
- g_value_unset (&value);
|
||||||
- } else if (preedit_highlight)
|
+ g_variant_unref (value);
|
||||||
- preedit_background = PREEDIT_BACKGROUND;
|
} else if (engine_config->preedit_highlight)
|
||||||
-
|
klass->preedit_background = PREEDIT_BACKGROUND;
|
||||||
|
|
||||||
- if (ibus_config_get_value (config,
|
- if (ibus_config_get_value (config,
|
||||||
- m17n->config_section,
|
- klass->config_section,
|
||||||
- "preedit_underline",
|
- "preedit_underline",
|
||||||
- &value)) {
|
- &value)) {
|
||||||
- preedit_underline = g_value_get_int (&value);
|
- klass->preedit_underline = g_value_get_int (&value);
|
||||||
- g_value_unset (&value);
|
- g_value_unset (&value);
|
||||||
- } else
|
+ if (value = ibus_config_get_value (config,
|
||||||
- preedit_underline = IBUS_ATTR_UNDERLINE_NONE;
|
+ 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,
|
- if (ibus_config_get_value (config,
|
||||||
- m17n->config_section,
|
- klass->config_section,
|
||||||
- "lookup_table_orientation",
|
- "lookup_table_orientation",
|
||||||
- &value)) {
|
- &value)) {
|
||||||
- lookup_table_orientation = g_value_get_int (&value);
|
- klass->lookup_table_orientation = g_value_get_int (&value);
|
||||||
- g_value_unset (&value);
|
- g_value_unset (&value);
|
||||||
- } else
|
+ if (value = ibus_config_get_value (config,
|
||||||
- lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
|
+ klass->config_section,
|
||||||
-
|
+ "lookup_table_orientation")) {
|
||||||
- g_signal_connect (config, "value-changed",
|
+ klass->lookup_table_orientation = g_variant_get_int32 (value);
|
||||||
- G_CALLBACK(ibus_config_value_changed), m17n);
|
+ g_variant_unref (value);
|
||||||
-
|
} else
|
||||||
return (GObject *) m17n;
|
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;
|
if (g_strcmp0 (section, klass->config_section) == 0) {
|
||||||
gchar *buf;
|
if (g_strcmp0 (name, "preedit_foreground") == 0) {
|
||||||
+ IBusM17NConfig *im_config;
|
- const gchar *hex = g_value_get_string (value);
|
||||||
|
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||||
+ im_config = ibus_m17n_engine_get_config (m17n);
|
guint color;
|
||||||
buf = ibus_m17n_mtext_to_utf8 (m17n->context->preedit);
|
color = ibus_m17n_parse_color (hex);
|
||||||
if (buf) {
|
if (color != INVALID_COLOR) {
|
||||||
text = ibus_text_new_from_static_string (buf);
|
klass->preedit_foreground = color;
|
||||||
- if (preedit_foreground != INVALID_COLOR)
|
}
|
||||||
+ if (im_config->preedit_foreground != INVALID_COLOR)
|
} else if (g_strcmp0 (name, "preedit_background") == 0) {
|
||||||
ibus_text_append_attribute (text, IBUS_ATTR_TYPE_FOREGROUND,
|
- const gchar *hex = g_value_get_string (value);
|
||||||
- preedit_foreground, 0, -1);
|
+ const gchar *hex = g_variant_get_string (value, NULL);
|
||||||
- if (preedit_background != INVALID_COLOR)
|
guint color;
|
||||||
+ im_config->preedit_foreground,
|
color = ibus_m17n_parse_color (hex);
|
||||||
+ 0, -1);
|
if (color != INVALID_COLOR) {
|
||||||
+ if (im_config->preedit_background != INVALID_COLOR)
|
klass->preedit_background = color;
|
||||||
ibus_text_append_attribute (text, IBUS_ATTR_TYPE_BACKGROUND,
|
}
|
||||||
- preedit_background, 0, -1);
|
} else if (g_strcmp0 (name, "preedit_underline") == 0) {
|
||||||
+ im_config->preedit_background,
|
- klass->preedit_underline = g_value_get_int (value);
|
||||||
+ 0, -1);
|
+ klass->preedit_underline = g_variant_get_int32 (value);
|
||||||
ibus_text_append_attribute (text, IBUS_ATTR_TYPE_UNDERLINE,
|
} else if (g_strcmp0 (name, "lookup_table_orientation") == 0) {
|
||||||
- preedit_underline, 0, -1);
|
- klass->lookup_table_orientation = g_value_get_int (value);
|
||||||
+ im_config->preedit_underline, 0, -1);
|
+ klass->lookup_table_orientation = g_variant_get_int32 (value);
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
diff --git a/src/m17nutil.c b/src/m17nutil.c
|
||||||
index 22b9fe1..8491d40 100644
|
index 7bc4ea5..8fac1fe 100644
|
||||||
--- a/src/m17nutil.c
|
--- a/src/m17nutil.c
|
||||||
+++ b/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_title = ibus_m17n_mtext_to_utf8 (title);
|
||||||
engine_icon = ibus_m17n_mtext_to_utf8 (icon);
|
engine_icon = ibus_m17n_mtext_to_utf8 (icon);
|
||||||
engine_desc = ibus_m17n_mtext_to_utf8 (desc);
|
engine_desc = ibus_m17n_mtext_to_utf8 (desc);
|
||||||
@ -342,18 +157,8 @@ index 22b9fe1..8491d40 100644
|
|||||||
- "us");
|
- "us");
|
||||||
- /* set default rank to 0 */
|
- /* set default rank to 0 */
|
||||||
- engine->rank = 0;
|
- engine->rank = 0;
|
||||||
-
|
+ config = ibus_m17n_get_engine_config (engine_name);
|
||||||
+
|
+
|
||||||
+ 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ engine = ibus_engine_desc_new_varargs ("name", engine_name,
|
+ engine = ibus_engine_desc_new_varargs ("name", engine_name,
|
||||||
+ "longname", engine_longname,
|
+ "longname", engine_longname,
|
||||||
+ "description", engine_desc ? engine_desc : "",
|
+ "description", engine_desc ? engine_desc : "",
|
||||||
@ -361,24 +166,41 @@ index 22b9fe1..8491d40 100644
|
|||||||
+ "license", "GPL",
|
+ "license", "GPL",
|
||||||
+ "icon", engine_icon ? engine_icon : "",
|
+ "icon", engine_icon ? engine_icon : "",
|
||||||
+ "layout", "us",
|
+ "layout", "us",
|
||||||
+ "rank", rank,
|
+ "rank", config->rank,
|
||||||
+ NULL);
|
+ NULL);
|
||||||
+
|
|
||||||
g_free (engine_name);
|
g_free (engine_name);
|
||||||
g_free (engine_longname);
|
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
|
diff --git a/src/main.c b/src/main.c
|
||||||
index 514d971..3bdafdb 100644
|
index e76898d..bba31e1 100644
|
||||||
--- a/src/main.c
|
--- a/src/main.c
|
||||||
+++ b/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);
|
engines = ibus_component_get_engines (component);
|
||||||
for (p = engines; p != NULL; p = p->next) {
|
for (p = engines; p != NULL; p = p->next) {
|
||||||
IBusEngineDesc *engine = (IBusEngineDesc *)p->data;
|
IBusEngineDesc *engine = (IBusEngineDesc *)p->data;
|
||||||
- ibus_factory_add_engine (factory, engine->name, IBUS_TYPE_M17N_ENGINE);
|
- GType type = ibus_m17n_engine_get_type_for_name (engine->name);
|
||||||
+ ibus_factory_add_engine (factory,
|
+ const gchar *engine_name = ibus_engine_desc_get_name (engine);
|
||||||
+ ibus_engine_desc_get_name (engine),
|
+ GType type = ibus_m17n_engine_get_type_for_name (engine_name);
|
||||||
+ IBUS_TYPE_M17N_ENGINE);
|
|
||||||
|
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) {
|
if (ibus) {
|
||||||
@ -540,5 +362,5 @@ index 0fe6e1b..178190e 100644
|
|||||||
|
|
||||||
index = get_combo_box_index_by_value (GTK_COMBO_BOX(combobox_orientation),
|
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
|
diff --git a/src/engine.c b/src/engine.c
|
||||||
index 260a806..abeeeef 100644
|
index f8e7fe5..ff8bbfc 100644
|
||||||
--- a/src/engine.c
|
--- a/src/engine.c
|
||||||
+++ b/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;
|
IBusProperty *setup_prop;
|
||||||
IBusPropList *prop_list;
|
IBusPropList *prop_list;
|
||||||
gchar *config_section;
|
|
||||||
+ IBusProperty *show_iok_prop;
|
+ IBusProperty *show_iok_prop;
|
||||||
+ gchar *keymap_name;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _IBusM17NEngineClass {
|
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);
|
NULL);
|
||||||
g_object_ref_sink (m17n->setup_prop);
|
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");
|
+ label = ibus_text_new_from_string ("iok");
|
||||||
+ m17n->show_iok_prop = ibus_property_new ("iok",
|
+ m17n->show_iok_prop = ibus_property_new ("iok",
|
||||||
+ PROP_TYPE_NORMAL,
|
+ PROP_TYPE_NORMAL,
|
||||||
@ -35,26 +61,7 @@ index 260a806..abeeeef 100644
|
|||||||
|
|
||||||
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
|
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
|
||||||
g_object_ref_sink (m17n->table);
|
g_object_ref_sink (m17n->table);
|
||||||
@@ -248,6 +263,7 @@ ibus_m17n_engine_constructor (GType type,
|
@@ -524,6 +549,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
|
||||||
|
|
||||||
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)
|
|
||||||
m17n->setup_prop = NULL;
|
m17n->setup_prop = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,23 +73,29 @@ index 260a806..abeeeef 100644
|
|||||||
if (m17n->table) {
|
if (m17n->table) {
|
||||||
g_object_unref (m17n->table);
|
g_object_unref (m17n->table);
|
||||||
m17n->table = NULL;
|
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);
|
LIBEXECDIR, engine_name);
|
||||||
g_spawn_command_line_async (setup, NULL);
|
g_spawn_command_line_async (setup, NULL);
|
||||||
g_free (setup);
|
g_free (setup);
|
||||||
+ } else if (g_strcmp0 (prop_name, "iok") == 0) {
|
+ } else if (g_strcmp0 (prop_name, "iok") == 0) {
|
||||||
+ gchar **strv;
|
+ const gchar *engine_name;
|
||||||
+ gchar cmd[80];
|
+ gchar *lang = NULL, *name = NULL;
|
||||||
+
|
+
|
||||||
+ strv = g_strsplit (m17n->keymap_name, ":", 3);
|
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
|
||||||
+ g_assert (g_strv_length (strv) == 3);
|
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name)) {
|
||||||
+ g_assert (g_strcmp0 (strv[0], "m17n") == 0);
|
+ gchar *iok;
|
||||||
+
|
+
|
||||||
+ sprintf (cmd, "/usr/bin/iok -n %s", strv[1]);
|
+ iok = g_strdup_printf ("/usr/bin/iok -n %s", lang);
|
||||||
+ g_debug ("keymap name = %s,prop_name=%s, prop_state=%d", m17n->keymap_name, prop_name, prop_state);
|
+ g_debug ("keymap name = %s,prop_name=%s, prop_state=%d",
|
||||||
+ g_strfreev (strv);
|
+ engine_name, prop_name, prop_state);
|
||||||
+
|
+ g_spawn_command_line_async(iok, NULL);
|
||||||
+ g_spawn_command_line_async(cmd, NULL);
|
+ g_free (iok);
|
||||||
|
+ }
|
||||||
|
+ g_free (lang);
|
||||||
|
+ g_free (name);
|
||||||
}
|
}
|
||||||
parent_class->property_activate (engine, prop_name, prop_state);
|
parent_class->property_activate (engine, prop_name, prop_state);
|
||||||
}
|
}
|
||||||
|
--
|
||||||
|
1.7.3.3
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: ibus-m17n
|
Name: ibus-m17n
|
||||||
Version: 1.3.1
|
Version: 1.3.1
|
||||||
Release: 9%{?dist}
|
Release: 10%{?dist}
|
||||||
Summary: The M17N engine for IBus platform
|
Summary: The M17N engine for IBus platform
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
@ -20,6 +20,7 @@ BuildRequires: libtool
|
|||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: m17n-lib-devel
|
BuildRequires: m17n-lib-devel
|
||||||
BuildRequires: gtk3-devel
|
BuildRequires: gtk3-devel
|
||||||
|
BuildRequires: gnome-common
|
||||||
BuildRequires: ibus-devel >= %{require_ibus_version}
|
BuildRequires: ibus-devel >= %{require_ibus_version}
|
||||||
|
|
||||||
Requires: ibus >= %{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
|
%patch1 -p1 -b .ibus-1.4
|
||||||
%patch2 -p1 -b .iok
|
%patch2 -p1 -b .iok
|
||||||
%patch3 -p1 -b .surrounding-text
|
%patch3 -p1 -b .surrounding-text
|
||||||
|
NOCONFIGURE=1 ./autogen.sh
|
||||||
|
|
||||||
%build
|
%build
|
||||||
GTK2_CFLAGS=`pkg-config gtk+-3.0 --cflags`
|
GTK2_CFLAGS=`pkg-config gtk+-3.0 --cflags`
|
||||||
@ -64,6 +66,11 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_datadir}/ibus/component/*
|
%{_datadir}/ibus/component/*
|
||||||
|
|
||||||
%changelog
|
%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
|
* Fri Dec 3 2010 Matthias Clasen <mclasen@redhat.com> - 1.3.1-9
|
||||||
- Rebuild against newer gtk3
|
- Rebuild against newer gtk3
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user