Update to 1.3.0-2.

This commit is contained in:
Daiki Ueno 2010-07-16 06:16:32 +00:00
parent 05d0dbf5f0
commit d4227873b1
6 changed files with 316 additions and 24 deletions

View File

@ -1 +1 @@
ibus-m17n-1.2.99.20100202.tar.gz ibus-m17n-1.3.0.tar.gz

View File

@ -1 +1,276 @@
diff --git a/src/engine.c b/src/engine.c
index dcfbe48..85b4baa 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -9,6 +9,13 @@
typedef struct _IBusM17NEngine IBusM17NEngine;
typedef struct _IBusM17NEngineClass IBusM17NEngineClass;
+enum IBusM17NFocusState {
+ NO_FOCUS,
+ GOT_FOCUS,
+ HAS_FOCUS,
+ LOST_FOCUS
+};
+
struct _IBusM17NEngine {
IBusEngine parent;
@@ -17,6 +24,8 @@ struct _IBusM17NEngine {
IBusLookupTable *table;
IBusProperty *status_prop;
IBusPropList *prop_list;
+ enum IBusM17NFocusState focus_state;
+ gint cursor_pos;
};
struct _IBusM17NEngineClass {
@@ -42,7 +51,8 @@ static void ibus_m17n_engine_focus_out (IBusEngine *engine);
static void ibus_m17n_engine_reset (IBusEngine *engine);
static void ibus_m17n_engine_enable (IBusEngine *engine);
static void ibus_m17n_engine_disable (IBusEngine *engine);
-static void ibus_engine_set_cursor_location (IBusEngine *engine,
+static void ibus_m17n_engine_set_cursor_location
+ (IBusEngine *engine,
gint x,
gint y,
gint w,
@@ -129,6 +139,8 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
engine_class->cursor_down = ibus_m17n_engine_cursor_down;
engine_class->property_activate = ibus_m17n_engine_property_activate;
+
+ engine_class->set_cursor_location = ibus_m17n_engine_set_cursor_location;
}
static void
@@ -152,6 +164,8 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
g_object_ref_sink (m17n->table);
m17n->context = NULL;
+ m17n->focus_state = NO_FOCUS;
+ m17n->cursor_pos = 0;
}
static GObject*
@@ -254,12 +268,31 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
}
static void
+ibus_m17n_engine_update_preedit (IBusM17NEngine *m17n)
+{
+ IBusText *text;
+ gchar *buf;
+
+ buf = ibus_m17n_mtext_to_utf8 (m17n->context->preedit);
+ if (buf) {
+ text = ibus_text_new_from_static_string (buf);
+ ibus_text_append_attribute (text, IBUS_ATTR_TYPE_FOREGROUND, 0x00ffffff, 0, -1);
+ ibus_text_append_attribute (text, IBUS_ATTR_TYPE_BACKGROUND, 0x00000000, 0, -1);
+ ibus_engine_update_preedit_text ((IBusEngine *) m17n,
+ text,
+ m17n->context->cursor_pos,
+ mtext_len (m17n->context->preedit) > 0);
+ }
+}
+
+static void
ibus_m17n_engine_commit_string (IBusM17NEngine *m17n,
const gchar *string)
{
IBusText *text;
text = ibus_text_new_from_static_string (string);
ibus_engine_commit_text ((IBusEngine *)m17n, text);
+ ibus_m17n_engine_update_preedit (m17n);
}
MSymbol
@@ -337,6 +370,10 @@ ibus_m17n_engine_process_key (IBusM17NEngine *m17n,
MText *produced;
gint retval;
+ /* XXX: mark as the IME just got focus to prevent
+ "input-focus-move" being sent as a result of key event. */
+ m17n->focus_state = GOT_FOCUS;
+
retval = minput_filter (m17n->context, key, NULL);
if (retval) {
@@ -387,6 +424,7 @@ ibus_m17n_engine_focus_in (IBusEngine *engine)
ibus_engine_register_properties (engine, m17n->prop_list);
ibus_m17n_engine_process_key (m17n, msymbol ("input-focus-in"));
+ m17n->focus_state = GOT_FOCUS;
parent_class->focus_in (engine);
}
@@ -397,6 +435,7 @@ ibus_m17n_engine_focus_out (IBusEngine *engine)
IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
ibus_m17n_engine_process_key (m17n, msymbol ("input-focus-out"));
+ m17n->focus_state = LOST_FOCUS;
parent_class->focus_out (engine);
}
@@ -424,6 +463,7 @@ ibus_m17n_engine_disable (IBusEngine *engine)
IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
ibus_m17n_engine_focus_out (engine);
+ m17n->focus_state = NO_FOCUS;
parent_class->disable (engine);
}
@@ -503,14 +543,15 @@ ibus_m17n_engine_update_lookup_table (IBusM17NEngine *m17n)
if (mplist_key (group) == Mtext) {
MText *mt;
- gunichar *buf, *p;
+ gunichar *buf;
+ glong nchars, i;
mt = (MText *) mplist_value (group);
ibus_lookup_table_set_page_size (m17n->table, mtext_len (mt));
- buf = ibus_m17n_mtext_to_ucs4 (mt);
- for (p = buf + 1; *p != 0; p++) {
- ibus_lookup_table_append_candidate (m17n->table, ibus_text_new_from_unichar (*p));
+ buf = ibus_m17n_mtext_to_ucs4 (mt, &nchars);
+ for (i = 0; i < nchars; i++) {
+ ibus_lookup_table_append_candidate (m17n->table, ibus_text_new_from_unichar (buf[i]));
}
g_free (buf);
}
@@ -546,6 +587,36 @@ ibus_m17n_engine_update_lookup_table (IBusM17NEngine *m17n)
}
static void
+ibus_m17n_engine_set_cursor_location (IBusEngine *engine,
+ gint x,
+ gint y,
+ gint w,
+ gint h)
+{
+ IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
+
+ switch (m17n->focus_state) {
+ case GOT_FOCUS:
+ m17n->focus_state = HAS_FOCUS;
+ m17n->cursor_pos = x;
+ break;
+ case HAS_FOCUS:
+ if (m17n->cursor_pos != x) {
+ ibus_m17n_engine_process_key (m17n, msymbol ("input-focus-move"));
+ }
+ m17n->cursor_pos = x;
+ break;
+ case LOST_FOCUS:
+ m17n->focus_state = NO_FOCUS;
+ break;
+ default:
+ break;
+ }
+
+ parent_class->set_cursor_location (engine, x, y, w, h);
+}
+
+static void
ibus_m17n_engine_callback (MInputContext *context,
MSymbol command)
{
@@ -565,19 +636,7 @@ ibus_m17n_engine_callback (MInputContext *context,
ibus_engine_hide_preedit_text ((IBusEngine *)m17n);
}
else if (command == Minput_preedit_draw) {
- IBusText *text;
- gchar *buf;
-
- buf = ibus_m17n_mtext_to_utf8 (m17n->context->preedit);
- if (buf) {
- text = ibus_text_new_from_static_string (buf);
- ibus_text_append_attribute (text, IBUS_ATTR_TYPE_FOREGROUND, 0x00ffffff, 0, -1);
- ibus_text_append_attribute (text, IBUS_ATTR_TYPE_BACKGROUND, 0x00000000, 0, -1);
- ibus_engine_update_preedit_text ((IBusEngine *) m17n,
- text,
- m17n->context->cursor_pos,
- mtext_len (m17n->context->preedit) > 0);
- }
+ ibus_m17n_engine_update_preedit (m17n);
}
else if (command == Minput_preedit_done) {
ibus_engine_hide_preedit_text ((IBusEngine *)m17n);
diff --git a/src/m17nutil.c b/src/m17nutil.c
index 257f68e..dc2626e 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -5,7 +5,6 @@
#define N_(text) text
static MConverter *utf8_converter = NULL;
-static MConverter *utf32_converter = NULL;
static const gchar *keymap[] = {
"m17n:as:phonetic",
@@ -35,10 +34,6 @@ ibus_m17n_init (void)
if (utf8_converter == NULL) {
utf8_converter = mconv_buffer_converter (Mcoding_utf_8, NULL, 0);
}
-
- if (utf32_converter == NULL) {
- utf32_converter = mconv_buffer_converter (Mcoding_utf_32, NULL, 0);
- }
}
gchar *
@@ -64,25 +59,28 @@ ibus_m17n_mtext_to_utf8 (MText *text)
}
gunichar *
-ibus_m17n_mtext_to_ucs4 (MText *text)
+ibus_m17n_mtext_to_ucs4 (MText *text, glong *nchars)
{
- gint bufsize;
- gunichar *buf;
+ glong bufsize;
+ gchar *buf;
+ gunichar *ucs;
if (text == NULL)
return NULL;
- mconv_reset_converter (utf32_converter);
-
- bufsize = (mtext_len (text) + 2) * sizeof (gunichar);
- buf = (gunichar *) g_malloc (bufsize);
-
- mconv_rebind_buffer (utf32_converter, (gchar *)buf, bufsize);
- mconv_encode (utf32_converter, text);
+ mconv_reset_converter (utf8_converter);
- buf [utf32_converter->nchars] = 0;
+ bufsize = (mtext_len (text) + 1) * 6;
+ buf = (gchar *) g_malloc (bufsize);
- return buf;
+ mconv_rebind_buffer (utf8_converter, buf, bufsize);
+ if (mconv_encode (utf8_converter, text) < 0) {
+ g_free (buf);
+ return NULL;
+ }
+ ucs = g_utf8_to_ucs4_fast (buf, bufsize, nchars);
+ g_free (buf);
+ return ucs;
}
static IBusEngineDesc *
diff --git a/src/m17nutil.h b/src/m17nutil.h
index 82e7e59..707c5cc 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -9,5 +9,6 @@ void ibus_m17n_init (void);
GList *ibus_m17n_list_engines (void);
IBusComponent *ibus_m17n_get_component (void);
gchar *ibus_m17n_mtext_to_utf8 (MText *text);
-gunichar *ibus_m17n_mtext_to_ucs4 (MText *text);
+gunichar *ibus_m17n_mtext_to_ucs4 (MText *text,
+ glong *nchars);
#endif

View File

@ -1,17 +1,16 @@
diff --git a/src/engine.c b/src/engine.c diff -ru ibus-m17n-1.3.0.orig/src/engine.c ibus-m17n-1.3.0/src/engine.c
index dcfbe48..057307a 100644 --- ibus-m17n-1.3.0.orig/src/engine.c 2010-07-16 15:11:44.037229510 +0900
--- a/src/engine.c +++ ibus-m17n-1.3.0/src/engine.c 2010-07-16 15:10:50.072167078 +0900
+++ b/src/engine.c @@ -26,6 +26,8 @@
@@ -17,6 +17,8 @@ struct _IBusM17NEngine {
IBusLookupTable *table;
IBusProperty *status_prop;
IBusPropList *prop_list; IBusPropList *prop_list;
enum IBusM17NFocusState focus_state;
gint cursor_pos;
+ IBusProperty *show_iok_prop; + IBusProperty *show_iok_prop;
+ gchar *keymap_name; + gchar *keymap_name;
}; };
struct _IBusM17NEngineClass { struct _IBusM17NEngineClass {
@@ -134,6 +136,8 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass) @@ -146,6 +148,8 @@
static void static void
ibus_m17n_engine_init (IBusM17NEngine *m17n) ibus_m17n_engine_init (IBusM17NEngine *m17n)
{ {
@ -20,7 +19,7 @@ index dcfbe48..057307a 100644
m17n->status_prop = ibus_property_new ("status", m17n->status_prop = ibus_property_new ("status",
PROP_TYPE_NORMAL, PROP_TYPE_NORMAL,
NULL, NULL,
@@ -145,9 +149,22 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n) @@ -157,9 +161,22 @@
NULL); NULL);
g_object_ref_sink (m17n->status_prop); g_object_ref_sink (m17n->status_prop);
@ -43,7 +42,7 @@ index dcfbe48..057307a 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);
@@ -162,6 +179,7 @@ ibus_m17n_engine_constructor (GType type, @@ -176,6 +193,7 @@
IBusM17NEngine *m17n; IBusM17NEngine *m17n;
MInputMethod *im; MInputMethod *im;
const gchar *engine_name; const gchar *engine_name;
@ -51,7 +50,7 @@ index dcfbe48..057307a 100644
m17n = (IBusM17NEngine *) G_OBJECT_CLASS (parent_class)->constructor (type, m17n = (IBusM17NEngine *) G_OBJECT_CLASS (parent_class)->constructor (type,
n_construct_params, n_construct_params,
@@ -169,6 +187,15 @@ ibus_m17n_engine_constructor (GType type, @@ -183,6 +201,15 @@
engine_name = ibus_engine_get_name ((IBusEngine *) m17n); engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
g_assert (engine_name); g_assert (engine_name);
@ -67,7 +66,7 @@ index dcfbe48..057307a 100644
if (im_table == NULL) { if (im_table == NULL) {
im_table = g_hash_table_new_full (g_str_hash, im_table = g_hash_table_new_full (g_str_hash,
@@ -181,12 +208,6 @@ ibus_m17n_engine_constructor (GType type, @@ -195,12 +222,6 @@
if (im == NULL) { if (im == NULL) {
gchar *lang; gchar *lang;
gchar *name; gchar *name;
@ -80,7 +79,7 @@ index dcfbe48..057307a 100644
lang = strv[1]; lang = strv[1];
name = strv[2]; name = strv[2];
@@ -211,9 +232,9 @@ ibus_m17n_engine_constructor (GType type, @@ -225,9 +246,9 @@
g_hash_table_insert (im_table, g_strdup (engine_name), im); g_hash_table_insert (im_table, g_strdup (engine_name), im);
} }
@ -91,7 +90,7 @@ index dcfbe48..057307a 100644
if (im == NULL) { if (im == NULL) {
g_warning ("Can not find m17n keymap %s", engine_name); g_warning ("Can not find m17n keymap %s", engine_name);
g_object_unref (m17n); g_object_unref (m17n);
@@ -240,6 +261,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n) @@ -254,6 +275,11 @@
m17n->status_prop = NULL; m17n->status_prop = NULL;
} }
@ -103,15 +102,15 @@ index dcfbe48..057307a 100644
if (m17n->table) { if (m17n->table) {
g_object_unref (m17n->table); g_object_unref (m17n->table);
m17n->table = NULL; m17n->table = NULL;
@@ -386,6 +412,7 @@ ibus_m17n_engine_focus_in (IBusEngine *engine) @@ -423,6 +449,7 @@
IBusM17NEngine *m17n = (IBusM17NEngine *) engine; IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
ibus_engine_register_properties (engine, m17n->prop_list); ibus_engine_register_properties (engine, m17n->prop_list);
+ +
ibus_m17n_engine_process_key (m17n, msymbol ("input-focus-in")); ibus_m17n_engine_process_key (m17n, msymbol ("input-focus-in"));
m17n->focus_state = GOT_FOCUS;
parent_class->focus_in (engine); @@ -511,6 +538,23 @@
@@ -471,6 +498,20 @@ ibus_m17n_engine_property_activate (IBusEngine *engine,
const gchar *prop_name, const gchar *prop_name,
guint prop_state) guint prop_state)
{ {
@ -120,6 +119,9 @@ index dcfbe48..057307a 100644
+ +
+ IBusM17NEngine *m17n = (IBusM17NEngine *) engine; + IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
+ +
+ if (g_strcmp0 (prop_name, "iok") != 0)
+ return;
+
+ strv = g_strsplit (m17n->keymap_name, ":", 3); + strv = g_strsplit (m17n->keymap_name, ":", 3);
+ g_assert (g_strv_length (strv) == 3); + g_assert (g_strv_length (strv) == 3);
+ g_assert (g_strcmp0 (strv[0], "m17n") == 0); + g_assert (g_strcmp0 (strv[0], "m17n") == 0);
@ -132,3 +134,5 @@ index dcfbe48..057307a 100644
parent_class->property_activate (engine, prop_name, prop_state); parent_class->property_activate (engine, prop_name, prop_state);
} }
Only in ibus-m17n-1.3.0/src: engine.c.orig
Only in ibus-m17n-1.3.0/src: engine.c.rej

View File

@ -1,15 +1,16 @@
%define require_ibus_version 1.2.99 %define require_ibus_version 1.3.0
Name: ibus-m17n Name: ibus-m17n
Version: 1.2.99.20100202 Version: 1.3.0
Release: 1%{?dist} Release: 2%{?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
URL: http://code.google.com/p/ibus/ URL: http://code.google.com/p/ibus/
Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
Patch0: ibus-m17n-iok.patch Patch0: ibus-m17n-HEAD.patch
Patch1: ibus-m17n-iok.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext-devel BuildRequires: gettext-devel
@ -29,6 +30,7 @@ the input table maps from m17n-db.
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
%build %build
%configure --disable-static %configure --disable-static
@ -52,6 +54,16 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/ibus/component/* %{_datadir}/ibus/component/*
%changelog %changelog
* Fri Jul 16 2010 Daiki Ueno <dueno@redhat.com> - 1.3.0-2
- Update ibus-m17n-HEAD.patch.
- Fix bug 614867 - Invisible pre-edit buffer when using m17n Wijesekera keyboard layout
- Update iok patch.
* Mon Mar 29 2010 Peng Huang <shawn.p.huang@gmail.com> - 1.3.0-1
- Update to 1.3.0.
- Update iok patch.
- Fix bug 577148 - IOK screen appears with all keyboard layouts on ibus language panel
* Tue Feb 02 2010 Peng Huang <shawn.p.huang@gmail.com> - 1.2.99.20100202-1 * Tue Feb 02 2010 Peng Huang <shawn.p.huang@gmail.com> - 1.2.99.20100202-1
- Update to 1.2.99.20100202. - Update to 1.2.99.20100202.
- Update iok patch. - Update iok patch.

View File

@ -1 +1,2 @@
ibus-m17n-0_1_0_20080810-1_fc9:HEAD:ibus-m17n-0.1.0.20080810-1.fc9.src.rpm:1218368743 ibus-m17n-0_1_0_20080810-1_fc9:HEAD:ibus-m17n-0.1.0.20080810-1.fc9.src.rpm:1218368743
ibus-m17n-1_3_0-2_fc13:HEAD:ibus-m17n-1.3.0-2.fc13.src.rpm:1279260865

View File

@ -1 +1 @@
e1d306b31fef0182d3f50f984f3737cf ibus-m17n-1.2.99.20100202.tar.gz 898b5ce1a685df201f959ac8feeb5a82 ibus-m17n-1.3.0.tar.gz