Fix regression with the previous update. See comment 7 of bug 614867.

This commit is contained in:
Daiki Ueno 2010-07-27 07:20:03 +00:00
parent d4227873b1
commit 1c23ee29ef
4 changed files with 27 additions and 146 deletions

View File

@ -1,59 +1,8 @@
diff --git a/src/engine.c b/src/engine.c
index dcfbe48..85b4baa 100644
index dcfbe48..21fae67 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)
@@ -254,12 +254,31 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
}
static void
@ -85,42 +34,7 @@ index dcfbe48..85b4baa 100644
}
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)
@@ -503,14 +522,15 @@ ibus_m17n_engine_update_lookup_table (IBusM17NEngine *m17n)
if (mplist_key (group) == Mtext) {
MText *mt;
@ -140,44 +54,7 @@ index dcfbe48..85b4baa 100644
}
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,
@@ -565,19 +585,7 @@ ibus_m17n_engine_callback (MInputContext *context,
ibus_engine_hide_preedit_text ((IBusEngine *)m17n);
}
else if (command == Minput_preedit_draw) {

View File

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

@ -2,7 +2,7 @@
Name: ibus-m17n
Version: 1.3.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: The M17N engine for IBus platform
License: GPLv2+
Group: System Environment/Libraries
@ -54,6 +54,10 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/ibus/component/*
%changelog
* Tue Jul 27 2010 Daiki Ueno <dueno@redhat.com> - 1.3.0-3
- Update ibus-m17n-HEAD.patch.
- Fix regression with the previous update. See comment 7 of bug 614867.
* 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

View File

@ -1,2 +1,3 @@
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
ibus-m17n-1_3_0-3_fc13:HEAD:ibus-m17n-1.3.0-3.fc13.src.rpm:1280215110