[ibus] Updated ibus-435880-surrounding-text.patch
Takao Fujiwara
fujiwara at fedoraproject.org
Tue Sep 28 02:34:03 UTC 2010
commit eb1661ec7058168d8858fe191231ca48c1bf4776
Author: Takao Fujiwara <tfujiwar at redhat.com>
Date: Tue Sep 28 11:32:30 2010 +0900
Updated ibus-435880-surrounding-text.patch
Fixes Bug 634829 - ibus_im_context_set_surrounding() to get strings.
ibus-435880-surrounding-text.patch | 472 +++++++++++++++++++++++-------------
ibus-541492-xkb.patch | 24 +-
ibus.spec | 6 +-
3 files changed, 319 insertions(+), 183 deletions(-)
---
diff --git a/ibus-435880-surrounding-text.patch b/ibus-435880-surrounding-text.patch
index 08a20f4..2c78720 100644
--- a/ibus-435880-surrounding-text.patch
+++ b/ibus-435880-surrounding-text.patch
@@ -1,6 +1,6 @@
-From 808fee2b1148fda896055328a680666ed29d9d93 Mon Sep 17 00:00:00 2001
+From 1a1f0ce17184ca1a67137cf5fade3d250f2aaac2 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno at unixuser.org>
-Date: Tue, 14 Sep 2010 19:51:24 +0900
+Date: Tue, 28 Sep 2010 10:30:27 +0900
Subject: [PATCH] Support surrounding-text retrieval.
This change adds a new API function ibus_engine_get_surrounding_text().
@@ -22,51 +22,123 @@ Also,
- destroy
resets the current surrounding-text.
---
- bus/engineproxy.c | 14 ++++++
- bus/engineproxy.h | 4 ++
- bus/inputcontext.c | 67 ++++++++++++++++++++++++++++
- bus/inputcontext.h | 4 ++
- client/gtk2/ibusimcontext.c | 84 ++++++++++++++++++++++++++++++++---
- ibus/engine.py | 6 +++
+ bus/engineproxy.c | 42 +++++++++++++-
+ bus/engineproxy.h | 7 ++
+ bus/inputcontext.c | 48 ++++++++++++++++
+ client/gtk2/ibusimcontext.c | 85 ++++++++++++++++++++++++++--
+ ibus/engine.py | 6 ++
ibus/interface/iengine.py | 3 +
ibus/interface/iinputcontext.py | 3 +
- src/ibusengine.c | 93 +++++++++++++++++++++++++++++++++++++++
- src/ibusengine.h | 21 ++++++++-
- src/ibusinputcontext.c | 14 ++++++
- src/ibusinputcontext.h | 11 +++++
+ src/ibusengine.c | 117 ++++++++++++++++++++++++++++++++++++++-
+ src/ibusengine.h | 20 ++++++-
+ src/ibusinputcontext.c | 48 ++++++++++++++++-
+ src/ibusinputcontext.h | 11 ++++
src/ibusmarshalers.list | 1 +
- 13 files changed, 317 insertions(+), 8 deletions(-)
+ 12 files changed, 377 insertions(+), 14 deletions(-)
diff --git a/bus/engineproxy.c b/bus/engineproxy.c
-index 64dda4f..4193a30 100644
+index 03592d7..ca5a8f3 100644
--- a/bus/engineproxy.c
+++ b/bus/engineproxy.c
-@@ -730,6 +730,20 @@ void bus_engine_proxy_property_hide (BusEngineProxy *engine,
+@@ -52,6 +52,8 @@ enum {
+ static guint engine_signals[LAST_SIGNAL] = { 0 };
+ // static guint engine_signals[LAST_SIGNAL] = { 0 };
+
++static IBusText *text_empty = NULL;
++
+ /* functions prototype */
+ static void bus_engine_proxy_real_destroy (BusEngineProxy *engine);
+
+@@ -302,6 +304,8 @@ bus_engine_proxy_class_init (BusEngineProxyClass *klass)
+ 1,
+ IBUS_TYPE_PROPERTY);
+
++ text_empty = ibus_text_new_from_string ("");
++ g_object_ref_sink (text_empty);
+ }
+
+ static void
+@@ -316,6 +320,8 @@ bus_engine_proxy_init (BusEngineProxy *engine)
+ engine->enabled = FALSE;
+ engine->desc = NULL;
+ engine->keymap = NULL;
++ engine->surrounding_text = g_object_ref_sink (text_empty);
++ engine->surrounding_cursor_pos = 0;
+ }
+
+ static void
+@@ -337,6 +343,11 @@ bus_engine_proxy_real_destroy (BusEngineProxy *engine)
+ engine->keymap = NULL;
+ }
+
++ if (engine->surrounding_text) {
++ g_object_unref (engine->surrounding_text);
++ engine->surrounding_text = NULL;
++ }
++
+ IBUS_OBJECT_CLASS(bus_engine_proxy_parent_class)->destroy (IBUS_OBJECT (engine));
+ }
+
+@@ -721,8 +732,9 @@ bus_engine_proxy_property_show (BusEngineProxy *engine,
G_TYPE_INVALID);
}
-+void bus_engine_proxy_set_surrounding_text (BusEngineProxy *engine,
-+ IBusText *text,
-+ guint cursor_pos)
+-void bus_engine_proxy_property_hide (BusEngineProxy *engine,
+- const gchar *prop_name)
++void
++bus_engine_proxy_property_hide (BusEngineProxy *engine,
++ const gchar *prop_name)
+ {
+ g_assert (BUS_IS_ENGINE_PROXY (engine));
+ g_assert (prop_name != NULL);
+@@ -733,6 +745,32 @@ void bus_engine_proxy_property_hide (BusEngineProxy *engine,
+ G_TYPE_INVALID);
+ }
+
++void
++bus_engine_proxy_set_surrounding_text (BusEngineProxy *engine,
++ IBusText *text,
++ guint cursor_pos)
+{
+ g_assert (BUS_IS_ENGINE_PROXY (engine));
+ g_assert (text != NULL);
+
-+ ibus_proxy_call ((IBusProxy *) engine,
-+ "SetSurroundingText",
-+ IBUS_TYPE_TEXT, &text,
-+ G_TYPE_UINT, &cursor_pos,
-+ G_TYPE_INVALID);
++ if (!engine->surrounding_text ||
++ g_strcmp0 (text->text, engine->surrounding_text->text) != 0 ||
++ cursor_pos != engine->surrounding_cursor_pos) {
++ if (engine->surrounding_text) {
++ g_object_unref (engine->surrounding_text);
++ }
++
++ engine->surrounding_text = (IBusText *) g_object_ref_sink (text);
++ engine->surrounding_cursor_pos = cursor_pos;
++
++ ibus_proxy_call ((IBusProxy *) engine,
++ "SetSurroundingText",
++ IBUS_TYPE_TEXT, &text,
++ G_TYPE_UINT, &cursor_pos,
++ G_TYPE_INVALID);
++ }
+}
+
#define DEFINE_FUNCTION(Name, name) \
void \
bus_engine_proxy_##name (BusEngineProxy *engine) \
diff --git a/bus/engineproxy.h b/bus/engineproxy.h
-index 7c2626f..ae85da9 100644
+index 254b00c..b0e211d 100644
--- a/bus/engineproxy.h
+++ b/bus/engineproxy.h
-@@ -111,5 +111,9 @@ void bus_engine_proxy_property_show (BusEngineProxy *engine,
+@@ -59,6 +59,9 @@ struct _BusEngineProxy {
+ gint y;
+ gint w;
+ gint h;
++ /* surrounding text */
++ IBusText *surrounding_text;
++ guint surrounding_cursor_pos;
+
+ IBusEngineDesc *desc;
+ IBusKeymap *keymap;
+@@ -112,5 +115,9 @@ void bus_engine_proxy_property_show (BusEngineProxy *engine,
void bus_engine_proxy_property_hide (BusEngineProxy *engine,
const gchar *prop_name);
gboolean bus_engine_proxy_is_enabled (BusEngineProxy *engine);
@@ -77,32 +149,10 @@ index 7c2626f..ae85da9 100644
G_END_DECLS
#endif
diff --git a/bus/inputcontext.c b/bus/inputcontext.c
-index d610515..f980108 100644
+index b5ab201..1aa9f21 100644
--- a/bus/inputcontext.c
+++ b/bus/inputcontext.c
-@@ -472,6 +472,9 @@ bus_input_context_init (BusInputContext *context)
- context->lookup_table = lookup_table_empty;
- context->lookup_table_visible = FALSE;
-
-+ g_object_ref_sink (text_empty);
-+ context->surrounding_text = text_empty;
-+ context->surrounding_cursor_pos = 0;
- }
-
- static void
-@@ -514,6 +517,11 @@ bus_input_context_destroy (BusInputContext *context)
- context->client = NULL;
- }
-
-+ if (context->surrounding_text) {
-+ g_object_unref (context->surrounding_text);
-+ context->surrounding_text = NULL;
-+ }
-+
- IBUS_OBJECT_CLASS(bus_input_context_parent_class)->destroy (IBUS_OBJECT (context));
- }
-
-@@ -568,6 +576,10 @@ _ibus_introspect (BusInputContext *context,
+@@ -569,6 +569,10 @@ _ibus_introspect (BusInputContext *context,
" <arg name=\"desc\" direction=\"out\" type=\"v\"/>\n"
" </method>\n"
" <method name=\"Destroy\"/>\n"
@@ -113,7 +163,7 @@ index d610515..f980108 100644
/* signals */
" <signal name=\"CommitText\">\n"
-@@ -1097,6 +1109,60 @@ _ic_destroy (BusInputContext *context,
+@@ -1098,6 +1102,49 @@ _ic_destroy (BusInputContext *context,
return NULL;
}
@@ -147,21 +197,10 @@ index d610515..f980108 100644
+ }
+
+ if ((context->capabilities & IBUS_CAP_SURROUNDING_TEXT) &&
-+ (!context->surrounding_text ||
-+ g_strcmp0 (text->text, context->surrounding_text->text) != 0 ||
-+ cursor_pos != context->surrounding_cursor_pos)) {
-+ if (context->surrounding_text) {
-+ g_object_unref (context->surrounding_text);
-+ }
-+
-+ context->surrounding_text = (IBusText *) g_object_ref_sink (text ? text : text_empty);
-+ context->surrounding_cursor_pos = cursor_pos;
-+
-+ if (context->has_focus && context->enabled && context->engine) {
-+ bus_engine_proxy_set_surrounding_text (context->engine,
-+ text,
-+ cursor_pos);
-+ }
++ context->has_focus && context->enabled && context->engine) {
++ bus_engine_proxy_set_surrounding_text (context->engine,
++ text,
++ cursor_pos);
+ }
+
+ if (g_object_is_floating (text))
@@ -174,7 +213,7 @@ index d610515..f980108 100644
static gboolean
bus_input_context_ibus_message (BusInputContext *context,
BusConnection *connection,
-@@ -1131,6 +1197,7 @@ bus_input_context_ibus_message (BusInputContext *context,
+@@ -1132,6 +1179,7 @@ bus_input_context_ibus_message (BusInputContext *context,
{ IBUS_INTERFACE_INPUT_CONTEXT, "SetEngine", _ic_set_engine },
{ IBUS_INTERFACE_INPUT_CONTEXT, "GetEngine", _ic_get_engine },
{ IBUS_INTERFACE_INPUT_CONTEXT, "Destroy", _ic_destroy },
@@ -182,26 +221,11 @@ index d610515..f980108 100644
};
ibus_message_set_sender (message, bus_connection_get_unique_name (connection));
-diff --git a/bus/inputcontext.h b/bus/inputcontext.h
-index ebbe4ba..4b20768 100644
---- a/bus/inputcontext.h
-+++ b/bus/inputcontext.h
-@@ -91,6 +91,10 @@ struct _BusInputContext {
-
- /* is fake context */
- gboolean fake;
-+
-+ /* surrounding text */
-+ IBusText *surrounding_text;
-+ guint surrounding_cursor_pos;
- };
-
- struct _BusInputContextClass {
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
-index 2ddae8c..09a2260 100644
+index c104f38..7b4b97c 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
-@@ -106,6 +106,12 @@ static void ibus_im_context_set_cursor_location
+@@ -107,6 +107,12 @@ static void ibus_im_context_set_cursor_location
static void ibus_im_context_set_use_preedit
(GtkIMContext *context,
gboolean use_preedit);
@@ -214,7 +238,7 @@ index 2ddae8c..09a2260 100644
/* static methods*/
static void _create_input_context (IBusIMContext *context);
-@@ -124,10 +130,10 @@ static void _slave_preedit_start_cb (GtkIMContext *slave,
+@@ -125,15 +131,16 @@ static void _slave_preedit_start_cb (GtkIMContext *slave,
IBusIMContext *context);
static void _slave_preedit_end_cb (GtkIMContext *slave,
IBusIMContext *context);
@@ -227,20 +251,39 @@ index 2ddae8c..09a2260 100644
(GtkIMContext *slave,
gint offset_from_cursor,
guint nchars,
-@@ -238,6 +244,12 @@ _key_snooper_cb (GtkWidget *widget,
- _input_window = event->window;
- }
+ IBusIMContext *context);
+ static void _create_fake_input_context (void);
++static void _request_surrounding_text (IBusIMContext *context);
+
-+ if (ibusimcontext->enable) {
+
+@@ -200,6 +207,16 @@ ibus_im_context_new (void)
+ return IBUS_IM_CONTEXT (obj);
+ }
+
++static void
++_request_surrounding_text (IBusIMContext *context)
++{
++ if (context->enable) {
+ gboolean return_value;
-+ g_signal_emit (ibusimcontext, _signal_retrieve_surrounding_id, 0,
++ g_signal_emit (context, _signal_retrieve_surrounding_id, 0,
+ &return_value);
+ }
++}
++
+ static gint
+ _key_snooper_cb (GtkWidget *widget,
+ GdkEventKey *event,
+@@ -239,6 +256,8 @@ _key_snooper_cb (GtkWidget *widget,
+ _input_window = event->window;
+ }
+
++ _request_surrounding_text (ibusimcontext);
+
switch (event->type) {
case GDK_KEY_RELEASE:
retval = ibus_input_context_process_key_event (ibuscontext,
-@@ -284,6 +296,7 @@ ibus_im_context_class_init (IBusIMContextClass *klass)
+@@ -285,6 +304,7 @@ ibus_im_context_class_init (IBusIMContextClass *klass)
im_context_class->set_client_window = ibus_im_context_set_client_window;
im_context_class->set_cursor_location = ibus_im_context_set_cursor_location;
im_context_class->set_use_preedit = ibus_im_context_set_use_preedit;
@@ -248,33 +291,25 @@ index 2ddae8c..09a2260 100644
gobject_class->finalize = ibus_im_context_finalize;
_signal_commit_id =
-@@ -476,6 +489,12 @@ ibus_im_context_filter_keypress (GtkIMContext *context,
+@@ -477,6 +497,8 @@ ibus_im_context_filter_keypress (GtkIMContext *context,
if (ibusimcontext->client_window == NULL && event->window != NULL)
gtk_im_context_set_client_window ((GtkIMContext *)ibusimcontext, event->window);
-+ if (ibusimcontext->enable) {
-+ gboolean return_value;
-+ g_signal_emit (ibusimcontext, _signal_retrieve_surrounding_id, 0,
-+ &return_value);
-+ }
++ _request_surrounding_text (ibusimcontext);
+
switch (event->type) {
case GDK_KEY_RELEASE:
retval = ibus_input_context_process_key_event (ibusimcontext->ibuscontext,
-@@ -540,6 +559,12 @@ ibus_im_context_focus_in (GtkIMContext *context)
+@@ -541,6 +563,8 @@ ibus_im_context_focus_in (GtkIMContext *context)
g_object_weak_ref ((GObject *) context, _weak_notify_cb, NULL);
_focus_im_context = context;
}
+
-+ if (ibusimcontext->enable) {
-+ gboolean return_value;
-+ g_signal_emit (ibusimcontext, _signal_retrieve_surrounding_id, 0,
-+ &return_value);
-+ }
++ _request_surrounding_text (ibusimcontext);
}
static void
-@@ -705,6 +730,34 @@ ibus_im_context_set_use_preedit (GtkIMContext *context, gboolean use_preedit)
+@@ -706,6 +730,44 @@ ibus_im_context_set_use_preedit (GtkIMContext *context, gboolean use_preedit)
}
static void
@@ -283,22 +318,32 @@ index 2ddae8c..09a2260 100644
+ gint len,
+ gint cursor_index)
+{
++ IBusIMContext *ibusimcontext;
++
+ g_return_if_fail (context != NULL);
+ g_return_if_fail (IBUS_IS_IM_CONTEXT (context));
++ g_return_if_fail (text != NULL);
++ g_return_if_fail (strlen (text) >= len);
++ g_return_if_fail (0 <= cursor_index && cursor_index <= len);
+
-+ IBusIMContext *ibusimcontext = IBUS_IM_CONTEXT (context);
++ ibusimcontext = IBUS_IM_CONTEXT (context);
+
+ if (ibusimcontext->enable && ibusimcontext->ibuscontext) {
+ IBusText *ibustext;
+ guint cursor_pos;
++ gchar *p;
+
-+ ibustext = ibus_text_new_from_string (text);
-+ cursor_pos = g_utf8_strlen (text, cursor_index);
++ p = g_strndup (text, len);
++ cursor_pos = g_utf8_strlen (p, cursor_index);
++ ibustext = ibus_text_new_from_string (p);
++ g_free (p);
++ g_object_ref_sink (ibustext);
+ ibus_input_context_set_surrounding_text (ibusimcontext->ibuscontext,
+ ibustext,
+ cursor_pos);
+ g_object_unref (ibustext);
+ }
++
+ gtk_im_context_set_surrounding (ibusimcontext->slave,
+ text,
+ len,
@@ -309,33 +354,25 @@ index 2ddae8c..09a2260 100644
_bus_connected_cb (IBusBus *bus,
IBusIMContext *ibusimcontext)
{
-@@ -723,6 +776,12 @@ _ibus_context_commit_text_cb (IBusInputContext *ibuscontext,
+@@ -724,6 +786,8 @@ _ibus_context_commit_text_cb (IBusInputContext *ibuscontext,
IDEBUG ("%s", __FUNCTION__);
g_signal_emit (ibusimcontext, _signal_commit_id, 0, text->text);
+
-+ if (ibusimcontext->enable) {
-+ gboolean return_value;
-+ g_signal_emit (ibusimcontext, _signal_retrieve_surrounding_id, 0,
-+ &return_value);
-+ }
++ _request_surrounding_text (ibusimcontext);
}
static gboolean
-@@ -953,6 +1012,12 @@ _ibus_context_show_preedit_text_cb (IBusInputContext *ibuscontext,
+@@ -954,6 +1018,8 @@ _ibus_context_show_preedit_text_cb (IBusInputContext *ibuscontext,
ibusimcontext->preedit_visible = TRUE;
g_signal_emit (ibusimcontext, _signal_preedit_start_id, 0);
g_signal_emit (ibusimcontext, _signal_preedit_changed_id, 0);
+
-+ if (ibusimcontext->enable) {
-+ gboolean return_value;
-+ g_signal_emit (ibusimcontext, _signal_retrieve_surrounding_id, 0,
-+ &return_value);
-+ }
++ _request_surrounding_text (ibusimcontext);
}
static void
-@@ -1117,17 +1182,21 @@ _slave_preedit_end_cb (GtkIMContext *slave,
+@@ -1118,17 +1184,21 @@ _slave_preedit_end_cb (GtkIMContext *slave,
g_signal_emit (ibusimcontext, _signal_preedit_end_id, 0);
}
@@ -361,7 +398,7 @@ index 2ddae8c..09a2260 100644
_slave_delete_surrounding_cb (GtkIMContext *slave,
gint offset_from_cursor,
guint nchars,
-@@ -1136,9 +1205,10 @@ _slave_delete_surrounding_cb (GtkIMContext *slave,
+@@ -1137,9 +1207,10 @@ _slave_delete_surrounding_cb (GtkIMContext *slave,
gboolean return_value;
if (ibusimcontext->enable && ibusimcontext->ibuscontext) {
@@ -426,10 +463,10 @@ index 89f6dbd..2db1c9b 100644
def FocusIn(self): pass
diff --git a/src/ibusengine.c b/src/ibusengine.c
-index 899d7c8..a5101bb 100644
+index b5f53d4..a517aad 100644
--- a/src/ibusengine.c
+++ b/src/ibusengine.c
-@@ -44,6 +44,7 @@ enum {
+@@ -45,6 +45,7 @@ enum {
PROPERTY_SHOW,
PROPERTY_HIDE,
CANDIDATE_CLICKED,
@@ -437,7 +474,7 @@ index 899d7c8..a5101bb 100644
LAST_SIGNAL,
};
-@@ -58,11 +59,16 @@ enum {
+@@ -59,11 +60,16 @@ enum {
struct _IBusEnginePrivate {
gchar *name;
IBusConnection *connection;
@@ -454,7 +491,7 @@ index 899d7c8..a5101bb 100644
/* functions prototype */
static void ibus_engine_destroy (IBusEngine *engine);
static void ibus_engine_set_property (IBusEngine *engine,
-@@ -112,6 +118,10 @@ static void ibus_engine_property_show (IBusEngine *engine,
+@@ -113,6 +119,10 @@ static void ibus_engine_property_show (IBusEngine *engine,
const gchar *prop_name);
static void ibus_engine_property_hide (IBusEngine *engine,
const gchar *prop_name);
@@ -465,15 +502,7 @@ index 899d7c8..a5101bb 100644
G_DEFINE_TYPE (IBusEngine, ibus_engine, IBUS_TYPE_SERVICE)
-@@ -142,6 +152,7 @@ ibus_engine_class_init (IBusEngineClass *klass)
- IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (IBusEnginePrivate));
-+ text_empty = ibus_text_new_from_string ("");
-
- gobject_class->set_property = (GObjectSetPropertyFunc) ibus_engine_set_property;
- gobject_class->get_property = (GObjectGetPropertyFunc) ibus_engine_get_property;
-@@ -166,6 +177,7 @@ ibus_engine_class_init (IBusEngineClass *klass)
+@@ -167,6 +177,7 @@ ibus_engine_class_init (IBusEngineClass *klass)
klass->property_hide = ibus_engine_property_hide;
klass->set_cursor_location = ibus_engine_set_cursor_location;
klass->set_capabilities = ibus_engine_set_capabilities;
@@ -481,7 +510,7 @@ index 899d7c8..a5101bb 100644
/* install properties */
-@@ -543,6 +555,27 @@ ibus_engine_class_init (IBusEngineClass *klass)
+@@ -544,6 +555,29 @@ ibus_engine_class_init (IBusEngineClass *klass)
1,
G_TYPE_STRING);
@@ -500,27 +529,28 @@ index 899d7c8..a5101bb 100644
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IBusEngineClass, set_surrounding_text),
+ NULL, NULL,
-+ ibus_marshal_VOID__POINTER_UINT,
++ ibus_marshal_VOID__OBJECT_UINT,
+ G_TYPE_NONE,
+ 2,
-+ G_TYPE_POINTER,
++ G_TYPE_OBJECT,
+ G_TYPE_UINT);
+
++ text_empty = ibus_text_new_from_string ("");
++ g_object_ref_sink (text_empty);
}
static void
-@@ -553,6 +586,10 @@ ibus_engine_init (IBusEngine *engine)
+@@ -554,6 +588,9 @@ ibus_engine_init (IBusEngine *engine)
priv->name = NULL;
priv->connection = NULL;
+
-+ g_object_ref_sink (text_empty);
-+ priv->surrounding_text = text_empty;
++ priv->surrounding_text = g_object_ref_sink (text_empty);
+ priv->surrounding_cursor_pos = 0;
}
static void
-@@ -568,6 +605,11 @@ ibus_engine_destroy (IBusEngine *engine)
+@@ -569,6 +606,11 @@ ibus_engine_destroy (IBusEngine *engine)
priv->connection = NULL;
}
@@ -532,7 +562,7 @@ index 899d7c8..a5101bb 100644
IBUS_OBJECT_CLASS(ibus_engine_parent_class)->destroy (IBUS_OBJECT (engine));
}
-@@ -878,6 +920,37 @@ ibus_engine_ibus_message (IBusEngine *engine,
+@@ -879,6 +921,37 @@ ibus_engine_ibus_message (IBusEngine *engine,
ibus_object_destroy ((IBusObject *) engine);
return TRUE;
}
@@ -554,13 +584,13 @@ index 899d7c8..a5101bb 100644
+ ibus_error_free (error);
+ }
+ else {
-+ if (priv->surrounding_text &&
-+ priv->surrounding_text != text_empty) {
++ if (priv->surrounding_text) {
+ g_object_unref (priv->surrounding_text);
+ }
+
+ priv->surrounding_text = (IBusText *) g_object_ref_sink (text ? text : text_empty);
+ priv->surrounding_cursor_pos = cursor_pos;
++
+ g_signal_emit (engine, engine_signals[SET_SURROUNDING_TEXT], 0,
+ priv->surrounding_text,
+ priv->surrounding_cursor_pos);
@@ -570,7 +600,7 @@ index 899d7c8..a5101bb 100644
else {
reply = ibus_message_new_error_printf (message,
DBUS_ERROR_UNKNOWN_METHOD,
-@@ -1002,6 +1075,14 @@ ibus_engine_property_hide (IBusEngine *engine, const gchar *prop_name)
+@@ -1003,6 +1076,14 @@ ibus_engine_property_hide (IBusEngine *engine, const gchar *prop_name)
}
static void
@@ -585,30 +615,62 @@ index 899d7c8..a5101bb 100644
_send_signal (IBusEngine *engine,
const gchar *name,
GType first_arg_type,
-@@ -1209,6 +1290,18 @@ void ibus_engine_delete_surrounding_text (IBusEngine *engine,
+@@ -1199,10 +1280,24 @@ void ibus_engine_forward_key_event (IBusEngine *engine,
G_TYPE_INVALID);
}
-+void ibus_engine_get_surrounding_text (IBusEngine *engine,
-+ IBusText **text,
-+ guint *cursor_pos)
+-void ibus_engine_delete_surrounding_text (IBusEngine *engine,
+- gint offset_from_cursor,
+- guint nchars)
++void
++ibus_engine_delete_surrounding_text (IBusEngine *engine,
++ gint offset_from_cursor,
++ guint nchars)
+ {
++ IBusEnginePrivate *priv;
++
++ g_assert (IBUS_IS_ENGINE (engine));
++
++ priv = IBUS_ENGINE_GET_PRIVATE (engine);
++
++ /* Clear the current surrounding-text buffer. */
++ if (priv->surrounding_text) {
++ g_object_unref (priv->surrounding_text);
++ priv->surrounding_text = g_object_ref_sink (text_empty);
++ priv->surrounding_cursor_pos = 0;
++ }
++
+ _send_signal (engine,
+ "DeleteSurroundingText",
+ G_TYPE_INT, &offset_from_cursor,
+@@ -1211,6 +1306,22 @@ void ibus_engine_delete_surrounding_text (IBusEngine *engine,
+ }
+
+ void
++ibus_engine_get_surrounding_text (IBusEngine *engine,
++ IBusText **text,
++ guint *cursor_pos)
+{
+ IBusEnginePrivate *priv;
+
++ g_return_if_fail (text != NULL);
++ g_return_if_fail (cursor_pos != NULL);
++
+ priv = IBUS_ENGINE_GET_PRIVATE (engine);
+
-+ *text = priv->surrounding_text;
++ *text = ibus_text_new_from_string (priv->surrounding_text->text);
+ *cursor_pos = priv->surrounding_cursor_pos;
+}
+
- void
++void
ibus_engine_register_properties (IBusEngine *engine,
IBusPropList *prop_list)
+ {
diff --git a/src/ibusengine.h b/src/ibusengine.h
-index 80e87c7..f39b523 100644
+index 95be408..56b1704 100644
--- a/src/ibusengine.h
+++ b/src/ibusengine.h
-@@ -123,10 +123,14 @@ struct _IBusEngineClass {
+@@ -124,10 +124,14 @@ struct _IBusEngineClass {
guint index,
guint button,
guint state);
@@ -624,7 +686,7 @@ index 80e87c7..f39b523 100644
};
GType ibus_engine_get_type (void);
-@@ -366,6 +370,21 @@ void ibus_engine_delete_surrounding_text(IBusEngine *engine,
+@@ -367,6 +371,20 @@ void ibus_engine_delete_surrounding_text(IBusEngine *engine,
guint nchars);
/**
@@ -641,16 +703,67 @@ index 80e87c7..f39b523 100644
+ IBusText **text,
+ guint *cursor_pos);
+
-+
+/**
* ibus_engine_get_name:
* @engine: An IBusEngine.
* @returns: Name of IBusEngine.
diff --git a/src/ibusinputcontext.c b/src/ibusinputcontext.c
-index 7359de0..2610333 100644
+index b00ad3b..a55c2c6 100644
--- a/src/ibusinputcontext.c
+++ b/src/ibusinputcontext.c
-@@ -913,6 +913,20 @@ ibus_input_context_property_hide (IBusInputContext *context,
+@@ -57,13 +57,19 @@ enum {
+
+ /* BusInputContextPriv */
+ struct _IBusInputContextPrivate {
+- gboolean own;
++ gboolean own;
++
++ /* surrounding text */
++ IBusText *surrounding_text;
++ guint surrounding_cursor_pos;
+ };
+ typedef struct _IBusInputContextPrivate IBusInputContextPrivate;
+
+ static guint context_signals[LAST_SIGNAL] = { 0 };
+ // static guint context_signals[LAST_SIGNAL] = { 0 };
+
++static IBusText *text_empty = NULL;
++
+ /* functions prototype */
+ static void ibus_input_context_real_destroy (IBusInputContext *context);
+ static gboolean ibus_input_context_ibus_signal (IBusProxy *proxy,
+@@ -474,6 +480,9 @@ ibus_input_context_class_init (IBusInputContextClass *klass)
+ G_TYPE_NONE,
+ 1,
+ IBUS_TYPE_PROPERTY);
++
++ text_empty = ibus_text_new_from_string ("");
++ g_object_ref_sink (text_empty);
+ }
+
+ static void
+@@ -482,6 +491,8 @@ ibus_input_context_init (IBusInputContext *context)
+ IBusInputContextPrivate *priv;
+ priv = IBUS_INPUT_CONTEXT_GET_PRIVATE (context);
+ priv->own = TRUE;
++ priv->surrounding_text = g_object_ref_sink (text_empty);
++ priv->surrounding_cursor_pos = 0;
+ }
+
+ static void
+@@ -496,6 +507,11 @@ ibus_input_context_real_destroy (IBusInputContext *context)
+ G_TYPE_INVALID);
+ }
+
++ if (priv->surrounding_text) {
++ g_object_unref (priv->surrounding_text);
++ priv->surrounding_text = NULL;
++ }
++
+ IBUS_OBJECT_CLASS(ibus_input_context_parent_class)->destroy (IBUS_OBJECT (context));
+ }
+
+@@ -914,6 +930,36 @@ ibus_input_context_property_hide (IBusInputContext *context,
G_TYPE_INVALID);
}
@@ -659,23 +772,39 @@ index 7359de0..2610333 100644
+ IBusText *text,
+ guint32 cursor_pos)
+{
++ IBusInputContextPrivate *priv;
++
+ g_assert (IBUS_IS_INPUT_CONTEXT (context));
++ g_assert (IBUS_IS_TEXT (text));
++
++ priv = IBUS_INPUT_CONTEXT_GET_PRIVATE (context);
+
-+ ibus_proxy_call ((IBusProxy *) context,
-+ "SetSurroundingText",
-+ IBUS_TYPE_TEXT, &text,
-+ G_TYPE_UINT, &cursor_pos,
-+ G_TYPE_INVALID);
++ if (priv->surrounding_text == NULL ||
++ g_strcmp0 (text->text, priv->surrounding_text->text) != 0 ||
++ cursor_pos != priv->surrounding_cursor_pos) {
++ if (priv->surrounding_text) {
++ g_object_unref (priv->surrounding_text);
++ }
++
++ priv->surrounding_text = (IBusText *) g_object_ref_sink (text);
++ priv->surrounding_cursor_pos = cursor_pos;
++
++ ibus_proxy_call ((IBusProxy *) context,
++ "SetSurroundingText",
++ IBUS_TYPE_TEXT, &text,
++ G_TYPE_UINT, &cursor_pos,
++ G_TYPE_INVALID);
++ }
+}
+
gboolean
ibus_input_context_is_enabled (IBusInputContext *context)
{
diff --git a/src/ibusinputcontext.h b/src/ibusinputcontext.h
-index 026460b..7f2538b 100644
+index 0d508a1..7f3d3f6 100644
--- a/src/ibusinputcontext.h
+++ b/src/ibusinputcontext.h
-@@ -35,6 +35,7 @@
+@@ -36,6 +36,7 @@
#include "ibusproxy.h"
#include "ibusenginedesc.h"
@@ -683,7 +812,7 @@ index 026460b..7f2538b 100644
/*
* Type macros.
-@@ -266,6 +267,16 @@ IBusEngineDesc
+@@ -267,6 +268,16 @@ IBusEngineDesc
void ibus_input_context_set_engine (IBusInputContext *context,
const gchar *name);
@@ -701,14 +830,17 @@ index 026460b..7f2538b 100644
G_END_DECLS
#endif
diff --git a/src/ibusmarshalers.list b/src/ibusmarshalers.list
-index 4473dab..622c59a 100644
+index 4473dab..6f80970 100644
--- a/src/ibusmarshalers.list
+++ b/src/ibusmarshalers.list
-@@ -22,3 +22,4 @@ VOID:STRING,STRING,BOXED
- VOID:STRING,STRING,STRING
- VOID:UINT
- VOID:UINT,POINTER
-+VOID:POINTER,UINT
+@@ -13,6 +13,7 @@ VOID:INT,INT,INT,INT
+ VOID:UINT,UINT
+ VOID:INT,UINT
+ VOID:UINT,UINT,UINT
++VOID:OBJECT,UINT
+ VOID:OBJECT,UINT,BOOL
+ VOID:OBJECT,UINT,BOOL,UINT
+ VOID:OBJECT,BOOL
--
1.7.2.1
diff --git a/ibus-541492-xkb.patch b/ibus-541492-xkb.patch
index 4d5785a..1afeef1 100644
--- a/ibus-541492-xkb.patch
+++ b/ibus-541492-xkb.patch
@@ -1,6 +1,6 @@
-From 21ebb5e408f048561d845231062165bf154fde8e Mon Sep 17 00:00:00 2001
+From 84003d36b7a2bf7b52faec42311c4904e44b606d Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Tue, 14 Sep 2010 19:49:33 +0900
+Date: Tue, 28 Sep 2010 10:11:44 +0900
Subject: [PATCH] Add XKB layouts
---
@@ -923,7 +923,7 @@ index c6612d2..fd2995b 100644
# use global ime setting
self.__checkbutton_use_global_engine = self.__builder.get_object("checkbutton_use_global_engine")
self.__checkbutton_use_global_engine.set_active(
-@@ -223,6 +234,160 @@ class Setup(object):
+@@ -233,6 +244,160 @@ class Setup(object):
self.__combobox.connect("notify::active-engine", self.__combobox_notify_active_engine_cb)
self.__treeview.connect("notify", self.__treeview_notify_cb)
@@ -1084,7 +1084,7 @@ index c6612d2..fd2995b 100644
def __combobox_notify_active_engine_cb(self, combobox, property):
engine = self.__combobox.get_active_engine()
button = self.__builder.get_object("button_engine_add")
-@@ -255,6 +420,114 @@ class Setup(object):
+@@ -282,6 +447,114 @@ class Setup(object):
about.run()
about.destroy()
@@ -1199,7 +1199,7 @@ index c6612d2..fd2995b 100644
def __init_bus(self):
try:
self.__bus = ibus.Bus()
-@@ -439,6 +712,7 @@ class Setup(object):
+@@ -470,6 +743,7 @@ class Setup(object):
def __checkbutton_use_sys_layout_toggled_cb(self, button):
value = self.__checkbutton_use_sys_layout.get_active()
self.__config.set_value("general", "use_system_keyboard_layout", value)
@@ -1786,10 +1786,10 @@ index 0000000..3d942be
+ return self.get_property("active-engine")
+
diff --git a/src/ibusfactory.c b/src/ibusfactory.c
-index e0ec2a5..c70bfde 100644
+index 0a95108..3acd6a6 100644
--- a/src/ibusfactory.c
+++ b/src/ibusfactory.c
-@@ -28,6 +28,7 @@
+@@ -29,6 +29,7 @@
(G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_FACTORY, IBusFactoryPrivate))
enum {
@@ -1797,7 +1797,7 @@ index e0ec2a5..c70bfde 100644
LAST_SIGNAL,
};
-@@ -45,6 +46,8 @@ struct _IBusFactoryPrivate {
+@@ -46,6 +47,8 @@ struct _IBusFactoryPrivate {
};
typedef struct _IBusFactoryPrivate IBusFactoryPrivate;
@@ -1806,7 +1806,7 @@ index e0ec2a5..c70bfde 100644
/* functions prototype */
static void ibus_factory_destroy (IBusFactory *factory);
static void ibus_factory_set_property (IBusFactory *engine,
-@@ -111,7 +114,16 @@ ibus_factory_class_init (IBusFactoryClass *klass)
+@@ -112,7 +115,16 @@ ibus_factory_class_init (IBusFactoryClass *klass)
IBUS_TYPE_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
@@ -1824,7 +1824,7 @@ index e0ec2a5..c70bfde 100644
}
static void
-@@ -245,6 +257,9 @@ ibus_factory_ibus_message (IBusFactory *factory,
+@@ -246,6 +258,9 @@ ibus_factory_ibus_message (IBusFactory *factory,
return TRUE;
}
@@ -1835,10 +1835,10 @@ index e0ec2a5..c70bfde 100644
if (engine_type == G_TYPE_INVALID) {
diff --git a/src/ibusfactory.h b/src/ibusfactory.h
-index e92c810..570e464 100644
+index 515083d..42c29b9 100644
--- a/src/ibusfactory.h
+++ b/src/ibusfactory.h
-@@ -117,10 +117,13 @@ struct _IBusFactoryClass {
+@@ -118,10 +118,13 @@ struct _IBusFactoryClass {
IBusServiceClass parent;
/* signals */
diff --git a/ibus.spec b/ibus.spec
index 6e054be..92a838e 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -11,7 +11,7 @@
Name: ibus
Version: 1.3.7
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@@ -279,6 +279,10 @@ fi
%{_datadir}/gtk-doc/html/*
%changelog
+* Tue Sep 28 2010 Takao Fujiwara <tfujiwar at redhat.com> - 1.3.7-6
+- Updated ibus-435880-surrounding-text.patch
+ Fixes Bug 634829 - ibus_im_context_set_surrounding() to get strings.
+
* Tue Sep 14 2010 Takao Fujiwara <tfujiwar at redhat.com> - 1.3.7-5
- Added ibus-621795-engineproxy-segv.patch
Fixes crash in ibus_object_destroy
More information about the scm-commits
mailing list