public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Takao Fujiwara <tfujiwar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ibus] autotool: Fix sync ibus_input_context_process_key_event() #3
Date: Sun, 31 May 2026 02:08:12 GMT [thread overview]
Message-ID: <178019329295.1.8516955552427891024.rpms-ibus-aa8a6c3f8a29@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/ibus
Branch : autotool
Commit : aa8a6c3f8a2969735978254d2b3cfe986a08bc25
Author : Takao Fujiwara <tfujiwar@redhat.com>
Date : 2023-07-12T09:29:03+09:00
Stats : +942/-704 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/ibus/c/aa8a6c3f8a2969735978254d2b3cfe986a08bc25?branch=autotool
Log:
Fix sync ibus_input_context_process_key_event() #3
---
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index fcbc386..8953954 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -2336,43 +2336,20 @@ index 68dde2f3..fee0b3ee 100644
--
2.41.0
-From a73ea2c335145cd5d00ebfade83204d055aa268c Mon Sep 17 00:00:00 2001
+From 139e0be07bfbc96d5ff95e5f5ebd760fbc7d94c0 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
-Date: Sun, 9 Jul 2023 18:46:21 +0900
-Subject: [PATCH 1/2] src: Fix sync ibus_input_context_process_key_event()
+Date: Wed, 12 Jul 2023 07:39:27 +0900
+Subject: [PATCH 1/3] bus: Apply code style to inputcontext.c
-The synchronous "ProcessKeyEvent" D-Bus method cannot receive
-"CommitText" and "ForwardKeyEvent" D-Bus signals during calling the method.
-To resolve the issue, now
-ibus_input_context_set_post_process_key_event() and
-ibus_input_context_post_process_key_event() are added newly.
-
-ibus_input_context_post_process_key_event() retries "CommitText" and
-"ForwardKeyEvent" D-Bus signals during calling the "ProcessKeyEvent" D-Bus
-method and ibus-daemon does not handle those signals.
-
-BUG=https://github.com/ibus/ibus/issues/2486
---
- bus/inputcontext.c | 587 +++++++++++++++++++++++++++---------
- client/gtk2/ibusimcontext.c | 225 ++++++++++----
- src/ibusinputcontext.c | 162 +++++++++-
- src/ibusinputcontext.h | 30 +-
- 4 files changed, 781 insertions(+), 223 deletions(-)
+ bus/inputcontext.c | 528 +++++++++++++++++++++++++++------------------
+ 1 file changed, 319 insertions(+), 209 deletions(-)
diff --git a/bus/inputcontext.c b/bus/inputcontext.c
-index e76bbdfc..2110af87 100644
+index e76bbdfc..8aded5d8 100644
--- a/bus/inputcontext.c
+++ b/bus/inputcontext.c
-@@ -31,6 +31,8 @@
- #include "marshalers.h"
- #include "types.h"
-
-+#define MAX_SYNC_DATA 30
-+
- struct _SetEngineByDescData {
- /* context related to the data */
- BusInputContext *context;
-@@ -38,13 +40,19 @@ struct _SetEngineByDescData {
+@@ -38,7 +38,8 @@ struct _SetEngineByDescData {
GTask *task;
/* a object to cancel bus_engine_proxy_new call */
GCancellable *cancellable;
@@ -2382,69 +2359,201 @@ index e76bbdfc..2110af87 100644
* we cancel the cancellable above as well. */
GCancellable *origin_cancellable;
gulong cancelled_handler_id;
- };
- typedef struct _SetEngineByDescData SetEngineByDescData;
-
-+typedef struct _SyncForwardingData {
-+ gchar key;
-+ IBusText *text;
-+} SyncForwardingData;
-+
- struct _BusInputContext {
- IBusService parent;
-
-@@ -98,6 +106,9 @@ struct _BusInputContext {
-
- BusPanelProxy *emoji_extension;
- gboolean is_extension_lookup_table;
-+ GQueue *queue_during_process_key_event;
-+ gboolean use_post_process_key_event;
-+ gboolean processing_key_event;
- };
-
- struct _BusInputContextClass {
-@@ -155,6 +166,15 @@ static void bus_input_context_service_method_call
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation);
-+static GVariant *
-+ bus_input_context_service_get_property
-+ (IBusService *service,
-+ GDBusConnection *connection,
-+ const gchar *sender,
-+ const gchar *object_path,
-+ const gchar *interface_name,
-+ const gchar *property_name,
-+ GError **error);
- static gboolean bus_input_context_service_set_property
- (IBusService *service,
- GDBusConnection *connection,
-@@ -214,8 +234,11 @@ static const gchar introspection_xml[] =
- "<node>"
- " <interface name='org.freedesktop.IBus.InputContext'>"
+@@ -211,112 +212,115 @@ static IBusPropList *props_empty = NULL;
+ * XML will be automatically rejected by the GDBus library (see
+ * src/ibusservice.c for details.) */
+ static const gchar introspection_xml[] =
+- "<node>"
+- " <interface name='org.freedesktop.IBus.InputContext'>"
++ "<node>\n"
++ " <interface name='org.freedesktop.IBus.InputContext'>\n"
/* properties */
-+ " <property name='PostProcessKeyEvent' type='(a(yv))' access='read' />\n"
- " <property name='ContentType' type='(uu)' access='write' />"
+- " <property name='ContentType' type='(uu)' access='write' />"
++ " <property name='ContentType' type='(uu)' access='write' />\n"
" <property name='ClientCommitPreedit' type='(b)' access='write' />\n"
-+ " <property name='EffectivePostProcessKeyEvent' type='(b)' "
-+ " access='write' />\n"
/* methods */
- " <method name='ProcessKeyEvent'>"
- " <arg direction='in' type='u' name='keyval' />"
-@@ -223,6 +246,12 @@ static const gchar introspection_xml[] =
- " <arg direction='in' type='u' name='state' />"
- " <arg direction='out' type='b' name='handled' />"
- " </method>"
-+ " <method name='ProcessKeyEventSync'>"
-+ " <arg direction='in' type='u' name='keyval' />"
-+ " <arg direction='in' type='u' name='keycode' />"
-+ " <arg direction='in' type='u' name='state' />"
-+ " <arg direction='out' type='ba(yv)' name='handled' />"
-+ " </method>"
- " <method name='SetCursorLocation'>"
- " <arg direction='in' type='i' name='x' />"
- " <arg direction='in' type='i' name='y' />"
-@@ -312,11 +341,14 @@ static const gchar introspection_xml[] =
+- " <method name='ProcessKeyEvent'>"
+- " <arg direction='in' type='u' name='keyval' />"
+- " <arg direction='in' type='u' name='keycode' />"
+- " <arg direction='in' type='u' name='state' />"
+- " <arg direction='out' type='b' name='handled' />"
+- " </method>"
+- " <method name='SetCursorLocation'>"
+- " <arg direction='in' type='i' name='x' />"
+- " <arg direction='in' type='i' name='y' />"
+- " <arg direction='in' type='i' name='w' />"
+- " <arg direction='in' type='i' name='h' />"
+- " </method>"
+- " <method name='SetCursorLocationRelative'>"
+- " <arg direction='in' type='i' name='x' />"
+- " <arg direction='in' type='i' name='y' />"
+- " <arg direction='in' type='i' name='w' />"
+- " <arg direction='in' type='i' name='h' />"
+- " </method>"
+- " <method name='ProcessHandWritingEvent'>"
+- " <arg direction='in' type='ad' name='coordinates' />"
+- " </method>"
+- " <method name='CancelHandWriting'>"
+- " <arg direction='in' type='u' name='n_strokes' />"
+- " </method>"
+- " <method name='FocusIn' />"
+- " <method name='FocusOut' />"
+- " <method name='Reset' />"
+- " <method name='SetCapabilities'>"
+- " <arg direction='in' type='u' name='caps' />"
+- " </method>"
+- " <method name='PropertyActivate'>"
+- " <arg direction='in' type='s' name='name' />"
+- " <arg direction='in' type='u' name='state' />"
+- " </method>"
+- " <method name='SetEngine'>"
+- " <arg direction='in' type='s' name='name' />"
+- " </method>"
+- " <method name='GetEngine'>"
+- " <arg direction='out' type='v' name='desc' />"
+- " </method>"
+- " <method name='SetSurroundingText'>"
+- " <arg direction='in' type='v' name='text' />"
+- " <arg direction='in' type='u' name='cursor_pos' />"
+- " <arg direction='in' type='u' name='anchor_pos' />"
+- " </method>"
++ " <method name='ProcessKeyEvent'>\n"
++ " <arg direction='in' type='u' name='keyval' />\n"
++ " <arg direction='in' type='u' name='keycode' />\n"
++ " <arg direction='in' type='u' name='state' />\n"
++ " <arg direction='out' type='b' name='handled' />\n"
++ " </method>\n"
++ " <method name='SetCursorLocation'>\n"
++ " <arg direction='in' type='i' name='x' />\n"
++ " <arg direction='in' type='i' name='y' />\n"
++ " <arg direction='in' type='i' name='w' />\n"
++ " <arg direction='in' type='i' name='h' />\n"
++ " </method>\n"
++ " <method name='SetCursorLocationRelative'>\n"
++ " <arg direction='in' type='i' name='x' />\n"
++ " <arg direction='in' type='i' name='y' />\n"
++ " <arg direction='in' type='i' name='w' />\n"
++ " <arg direction='in' type='i' name='h' />\n"
++ " </method>\n"
++ " <method name='ProcessHandWritingEvent'>\n"
++ " <arg direction='in' type='ad' name='coordinates' />\n"
++ " </method>\n"
++ " <method name='CancelHandWriting'>\n"
++ " <arg direction='in' type='u' name='n_strokes' />\n"
++ " </method>\n"
++ " <method name='FocusIn' />\n"
++ " <method name='FocusOut' />\n"
++ " <method name='Reset' />\n"
++ " <method name='SetCapabilities'>\n"
++ " <arg direction='in' type='u' name='caps' />\n"
++ " </method>\n"
++ " <method name='PropertyActivate'>\n"
++ " <arg direction='in' type='s' name='name' />\n"
++ " <arg direction='in' type='u' name='state' />\n"
++ " </method>\n"
++ " <method name='SetEngine'>\n"
++ " <arg direction='in' type='s' name='name' />\n"
++ " </method>\n"
++ " <method name='GetEngine'>\n"
++ " <arg direction='out' type='v' name='desc' />\n"
++ " </method>\n"
++ " <method name='SetSurroundingText'>\n"
++ " <arg direction='in' type='v' name='text' />\n"
++ " <arg direction='in' type='u' name='cursor_pos' />\n"
++ " <arg direction='in' type='u' name='anchor_pos' />\n"
++ " </method>\n"
+
+ /* signals */
+- " <signal name='CommitText'>"
+- " <arg type='v' name='text' />"
+- " </signal>"
+- " <signal name='ForwardKeyEvent'>"
+- " <arg type='u' name='keyval' />"
+- " <arg type='u' name='keycode' />"
+- " <arg type='u' name='state' />"
+- " </signal>"
+- " <signal name='UpdatePreeditText'>"
+- " <arg type='v' name='text' />"
+- " <arg type='u' name='cursor_pos' />"
+- " <arg type='b' name='visible' />"
+- " </signal>"
+- " <signal name='UpdatePreeditTextWithMode'>"
+- " <arg type='v' name='text' />"
+- " <arg type='u' name='cursor_pos' />"
+- " <arg type='b' name='visible' />"
+- " <arg type='u' name='mode' />"
+- " </signal>"
+- " <signal name='ShowPreeditText'/>"
+- " <signal name='HidePreeditText'/>"
+- " <signal name='UpdateAuxiliaryText'>"
+- " <arg type='v' name='text' />"
+- " <arg type='b' name='visible' />"
+- " </signal>"
+- " <signal name='ShowAuxiliaryText'/>"
+- " <signal name='HideAuxiliaryText'/>"
+- " <signal name='UpdateLookupTable'>"
+- " <arg type='v' name='table' />"
+- " <arg type='b' name='visible' />"
+- " </signal>"
+- " <signal name='ShowLookupTable'/>"
+- " <signal name='HideLookupTable'/>"
+- " <signal name='PageUpLookupTable'/>"
+- " <signal name='PageDownLookupTable'/>"
+- " <signal name='CursorUpLookupTable'/>"
+- " <signal name='CursorDownLookupTable'/>"
+- " <signal name='RegisterProperties'>"
+- " <arg type='v' name='props' />"
+- " </signal>"
+- " <signal name='UpdateProperty'>"
+- " <arg type='v' name='prop' />"
+- " </signal>"
+- " </interface>"
+- "</node>";
++ " <signal name='CommitText'>\n"
++ " <arg type='v' name='text' />\n"
++ " </signal>\n"
++ " <signal name='ForwardKeyEvent'>\n"
++ " <arg type='u' name='keyval' />\n"
++ " <arg type='u' name='keycode' />\n"
++ " <arg type='u' name='state' />\n"
++ " </signal>\n"
++ " <signal name='UpdatePreeditText'>\n"
++ " <arg type='v' name='text' />\n"
++ " <arg type='u' name='cursor_pos' />\n"
++ " <arg type='b' name='visible' />\n"
++ " </signal>\n"
++ " <signal name='UpdatePreeditTextWithMode'>\n"
++ " <arg type='v' name='text' />\n"
++ " <arg type='u' name='cursor_pos' />\n"
++ " <arg type='b' name='visible' />\n"
++ " <arg type='u' name='mode' />\n"
++ " </signal>\n"
++ " <signal name='ShowPreeditText'/>\n"
++ " <signal name='HidePreeditText'/>\n"
++ " <signal name='UpdateAuxiliaryText'>\n"
++ " <arg type='v' name='text' />\n"
++ " <arg type='b' name='visible' />\n"
++ " </signal>\n"
++ " <signal name='ShowAuxiliaryText'/>\n"
++ " <signal name='HideAuxiliaryText'/>\n"
++ " <signal name='UpdateLookupTable'>\n"
++ " <arg type='v' name='table' />\n"
++ " <arg type='b' name='visible' />\n"
++ " </signal>\n"
++ " <signal name='ShowLookupTable'/>\n"
++ " <signal name='HideLookupTable'/>\n"
++ " <signal name='PageUpLookupTable'/>\n"
++ " <signal name='PageDownLookupTable'/>\n"
++ " <signal name='CursorUpLookupTable'/>\n"
++ " <signal name='CursorDownLookupTable'/>\n"
++ " <signal name='RegisterProperties'>\n"
++ " <arg type='v' name='props' />\n"
++ " </signal>\n"
++ " <signal name='UpdateProperty'>\n"
++ " <arg type='v' name='prop' />\n"
++ " </signal>\n"
++ " </interface>\n"
++ "</node>\n";
G_DEFINE_TYPE (BusInputContext, bus_input_context, IBUS_TYPE_SERVICE)
@@ -2462,7 +2571,7 @@ index e76bbdfc..2110af87 100644
static void
_connection_destroy_cb (BusConnection *connection,
-@@ -343,17 +375,23 @@ bus_input_context_class_init (BusInputContextClass *class)
+@@ -343,17 +347,21 @@ bus_input_context_class_init (BusInputContextClass *class)
"");
g_object_ref_sink (class->default_engine_desc);
@@ -2473,8 +2582,6 @@ index e76bbdfc..2110af87 100644
/* override the parent class's implementation. */
IBUS_SERVICE_CLASS (class)->service_method_call =
bus_input_context_service_method_call;
-+ IBUS_SERVICE_CLASS (class)->service_get_property =
-+ bus_input_context_service_get_property;
IBUS_SERVICE_CLASS (class)->service_set_property =
bus_input_context_service_set_property;
- /* register the xml so that bus_ibus_impl_service_method_call will be called on a method call defined in the xml (e.g. 'FocusIn'.) */
@@ -2489,7 +2596,7 @@ index e76bbdfc..2110af87 100644
context_signals[PROCESS_KEY_EVENT] =
g_signal_new (I_("process-key-event"),
G_TYPE_FROM_CLASS (class),
-@@ -576,8 +614,11 @@ bus_input_context_class_init (BusInputContextClass *class)
+@@ -576,8 +584,11 @@ bus_input_context_class_init (BusInputContextClass *class)
G_TYPE_NONE,
0);
@@ -2503,7 +2610,7 @@ index e76bbdfc..2110af87 100644
context_signals[REQUEST_ENGINE] =
g_signal_new (I_("request-engine"),
G_TYPE_FROM_CLASS (class),
-@@ -614,7 +655,8 @@ bus_input_context_class_init (BusInputContextClass *class)
+@@ -614,7 +625,8 @@ bus_input_context_class_init (BusInputContextClass *class)
text_empty = ibus_text_new_from_string ("");
g_object_ref_sink (text_empty);
@@ -2513,7 +2620,7 @@ index e76bbdfc..2110af87 100644
g_object_ref_sink (lookup_table_empty);
props_empty = ibus_prop_list_new ();
g_object_ref_sink (props_empty);
-@@ -662,9 +704,10 @@ bus_input_context_destroy (BusInputContext *context)
+@@ -662,9 +674,10 @@ bus_input_context_destroy (BusInputContext *context)
}
if (context->connection) {
@@ -2527,7 +2634,7 @@ index e76bbdfc..2110af87 100644
g_object_unref (context->connection);
context->connection = NULL;
}
-@@ -674,7 +717,8 @@ bus_input_context_destroy (BusInputContext *context)
+@@ -674,7 +687,8 @@ bus_input_context_destroy (BusInputContext *context)
context->client = NULL;
}
@@ -2537,7 +2644,7 @@ index e76bbdfc..2110af87 100644
}
static gboolean
-@@ -689,25 +733,30 @@ bus_input_context_send_signal (BusInputContext *context,
+@@ -689,25 +703,30 @@ bus_input_context_send_signal (BusInputContext *context,
return TRUE;
}
@@ -2577,81 +2684,7 @@ index e76bbdfc..2110af87 100644
*
* Emit the D-Bus signal.
*/
-@@ -763,6 +812,11 @@ bus_input_context_property_changed (BusInputContext *context,
- }
-
-
-+typedef struct _PanelProcessKeyEventData {
-+ GDBusMethodInvocation *invocation;
-+ BusInputContext *context;
-+} PanelProcessKeyEventData;
-+
- /**
- * _panel_process_key_event_cb:
- *
-@@ -770,14 +824,21 @@ bus_input_context_property_changed (BusInputContext *context,
- * bus_panel_proxy_process_key_event() is finished.
- */
- static void
--_panel_process_key_event_cb (GObject *source,
-- GAsyncResult *res,
-- GDBusMethodInvocation *invocation)
-+_panel_process_key_event_cb (GObject *source,
-+ GAsyncResult *res,
-+ PanelProcessKeyEventData *data)
- {
- GError *error = NULL;
- GVariant *value = g_dbus_proxy_call_finish ((GDBusProxy *)source,
- res,
- &error);
-+ GDBusMethodInvocation *invocation;
-+ BusInputContext *context;
-+
-+ g_assert (data);
-+ invocation = data->invocation;
-+ context = data->context;
-+ g_slice_free (PanelProcessKeyEventData, data);
- if (value != NULL) {
- g_dbus_method_invocation_return_value (invocation, value);
- g_variant_unref (value);
-@@ -786,6 +847,7 @@ _panel_process_key_event_cb (GObject *source,
- g_dbus_method_invocation_return_gerror (invocation, error);
- g_error_free (error);
- }
-+ context->processing_key_event = FALSE;
- }
-
- typedef struct _ProcessKeyEventData ProcessKeyEventData;
-@@ -822,21 +884,27 @@ _ic_process_key_event_reply_cb (GObject *source,
- gboolean retval = FALSE;
- g_variant_get (value, "(b)", &retval);
- if (context->emoji_extension && !retval) {
-+ PanelProcessKeyEventData *pdata =
-+ g_slice_new (PanelProcessKeyEventData);
-+ pdata->invocation = invocation;
-+ pdata->context = context;
- bus_panel_proxy_process_key_event (context->emoji_extension,
- keyval,
- keycode,
- modifiers,
- (GAsyncReadyCallback)
- _panel_process_key_event_cb,
-- invocation);
-+ pdata);
- } else {
- g_dbus_method_invocation_return_value (invocation, value);
-+ context->processing_key_event = FALSE;
- }
- g_variant_unref (value);
- }
- else {
- g_dbus_method_invocation_return_gerror (invocation, error);
- g_error_free (error);
-+ context->processing_key_event = FALSE;
- }
-
- g_object_unref (context);
-@@ -850,14 +918,16 @@ _ic_process_key_event_reply_cb (GObject *source,
+@@ -850,9 +869,9 @@ _ic_process_key_event_reply_cb (GObject *source,
* org.freedesktop.IBus.InputContext interface.
*/
static void
@@ -2664,14 +2697,7 @@ index e76bbdfc..2110af87 100644
{
guint keyval = IBUS_KEY_VoidSymbol;
guint keycode = 0;
- guint modifiers = 0;
-
-+ if (context->use_post_process_key_event)
-+ context->processing_key_event = TRUE;
- g_variant_get (parameters, "(uuu)", &keyval, &keycode, &modifiers);
- if (G_UNLIKELY (!context->has_focus)) {
- /* workaround: set focus if context does not have focus */
-@@ -925,7 +995,8 @@ _ic_process_key_event (BusInputContext *context,
+@@ -925,7 +944,8 @@ _ic_process_key_event (BusInputContext *context,
/**
* _ic_set_cursor_location:
*
@@ -2681,7 +2707,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_set_cursor_location (BusInputContext *context,
-@@ -1008,7 +1079,8 @@ _ic_process_hand_writing_event (BusInputContext *context,
+@@ -1008,7 +1028,8 @@ _ic_process_hand_writing_event (BusInputContext *context,
/* do nothing if it is a fake input context */
if (context->has_focus &&
context->engine && context->fake == FALSE) {
@@ -2691,7 +2717,7 @@ index e76bbdfc..2110af87 100644
}
g_dbus_method_invocation_return_value (invocation, NULL);
}
-@@ -1032,7 +1104,8 @@ _ic_cancel_hand_writing (BusInputContext *context,
+@@ -1032,7 +1053,8 @@ _ic_cancel_hand_writing (BusInputContext *context,
/**
* _ic_focus_in:
*
@@ -2701,7 +2727,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_focus_in (BusInputContext *context,
-@@ -1044,15 +1117,17 @@ _ic_focus_in (BusInputContext *context,
+@@ -1044,15 +1066,17 @@ _ic_focus_in (BusInputContext *context,
g_dbus_method_invocation_return_value (invocation, NULL);
}
else {
@@ -2722,7 +2748,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_focus_out (BusInputContext *context,
-@@ -1064,15 +1139,17 @@ _ic_focus_out (BusInputContext *context,
+@@ -1064,15 +1088,17 @@ _ic_focus_out (BusInputContext *context,
g_dbus_method_invocation_return_value (invocation, NULL);
}
else {
@@ -2743,7 +2769,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_reset (BusInputContext *context,
-@@ -1094,7 +1171,8 @@ _ic_reset (BusInputContext *context,
+@@ -1094,7 +1120,8 @@ _ic_reset (BusInputContext *context,
/**
* _ic_set_capabilities:
*
@@ -2753,7 +2779,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_set_capabilities (BusInputContext *context,
-@@ -1112,7 +1190,8 @@ _ic_set_capabilities (BusInputContext *context,
+@@ -1112,7 +1139,8 @@ _ic_set_capabilities (BusInputContext *context,
/**
* _ic_property_activate:
*
@@ -2763,7 +2789,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_property_activate (BusInputContext *context,
-@@ -1124,7 +1203,9 @@ _ic_property_activate (BusInputContext *context,
+@@ -1124,7 +1152,9 @@ _ic_property_activate (BusInputContext *context,
g_variant_get (parameters, "(&su)", &prop_name, &prop_state);
if (context->engine) {
@@ -2774,7 +2800,7 @@ index e76bbdfc..2110af87 100644
}
#ifdef OS_CHROMEOS
-@@ -1132,9 +1213,12 @@ _ic_property_activate (BusInputContext *context,
+@@ -1132,9 +1162,12 @@ _ic_property_activate (BusInputContext *context,
* so pass PropertyActivate signal to the focused context.
*/
else if (context->fake) {
@@ -2789,7 +2815,7 @@ index e76bbdfc..2110af87 100644
}
#endif
-@@ -1164,7 +1248,8 @@ _ic_set_engine_done (BusInputContext *context,
+@@ -1164,7 +1197,8 @@ _ic_set_engine_done (BusInputContext *context,
/**
* _ic_set_engine:
*
@@ -2799,7 +2825,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_set_engine (BusInputContext *context,
-@@ -1205,7 +1290,8 @@ _ic_set_engine (BusInputContext *context,
+@@ -1205,7 +1239,8 @@ _ic_set_engine (BusInputContext *context,
/**
* _ic_get_engine:
*
@@ -2809,7 +2835,7 @@ index e76bbdfc..2110af87 100644
*/
static void
_ic_get_engine (BusInputContext *context,
-@@ -1218,7 +1304,9 @@ _ic_get_engine (BusInputContext *context,
+@@ -1218,7 +1253,9 @@ _ic_get_engine (BusInputContext *context,
g_dbus_method_invocation_return_value (invocation,
@@ -2820,7 +2846,7 @@ index e76bbdfc..2110af87 100644
}
static void
-@@ -1270,7 +1358,8 @@ bus_input_context_service_authorized_method (IBusService *service,
+@@ -1270,7 +1307,8 @@ bus_input_context_service_authorized_method (IBusService *service,
/**
* bus_input_context_service_method_call:
*
@@ -2830,7 +2856,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_service_method_call (IBusService *service,
-@@ -1283,21 +1372,23 @@ bus_input_context_service_method_call (IBusService *service,
+@@ -1283,21 +1321,23 @@ bus_input_context_service_method_call (IBusService *service,
GDBusMethodInvocation *invocation)
{
if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
@@ -2864,7 +2890,7 @@ index e76bbdfc..2110af87 100644
} methods [] = {
{ "ProcessKeyEvent", _ic_process_key_event },
{ "SetCursorLocation", _ic_set_cursor_location },
-@@ -1322,7 +1413,9 @@ bus_input_context_service_method_call (IBusService *service,
+@@ -1322,7 +1362,9 @@ bus_input_context_service_method_call (IBusService *service,
for (i = 0; i < G_N_ELEMENTS (methods); i++) {
if (g_strcmp0 (method_name, methods[i].method_name) == 0) {
@@ -2875,256 +2901,62 @@ index e76bbdfc..2110af87 100644
return;
}
}
-@@ -1330,17 +1423,109 @@ bus_input_context_service_method_call (IBusService *service,
- g_return_if_reached ();
- }
-
--static void
-+/**
-+ * _ic_get_post_process_key_event:
-+ *
-+ * Implement the "PostProcessKeyEvent" get property of the
-+ * org.freedesktop.IBus.InputContext interface because currently the Gio
-+ * D-Bus method calls don't support multiple nested tuples likes
-+ * G_VARIANT_TYPE ("((ba(yv)))")) in "ProcessKeyEvent" D-Bus method
-+ * So these post events are separated from the return value "b" of
-+ * the "ProcessKeyEvent" D-Bus method call.
-+ */
-+static GVariant *
-+_ic_get_post_process_key_event (BusInputContext *context,
-+ GDBusConnection *connection,
-+ GError **error)
-+{
-+ const char *error_message = NULL;
-+ GVariantBuilder array;
-+ SyncForwardingData *data;
-+
-+ do {
-+ if (!BUS_IS_INPUT_CONTEXT (context)) {
-+ error_message = "BusInputContext is freed";
-+ break;
-+ }
-+ if (context->processing_key_event) {
-+ error_message = "Another ProcessKeyEvent is called.";
-+ break;
-+ }
-+ g_variant_builder_init (&array, G_VARIANT_TYPE ("a(yv)"));
-+ while ((data =
-+ g_queue_pop_head (context->queue_during_process_key_event))) {
-+ GVariant *variant = ibus_serializable_serialize_object (
-+ IBUS_SERIALIZABLE (data->text));
-+ g_variant_builder_add (&array, "(yv)", data->key, variant);
-+ g_object_unref (data->text);
-+ g_slice_free (SyncForwardingData, data);
-+ }
-+ } while (FALSE);
-+ if (error_message) {
-+ g_set_error (error,
-+ G_DBUS_ERROR,
-+ G_DBUS_ERROR_FAILED,
-+ "%s", error_message);
-+ return NULL;
-+ }
-+ return g_variant_builder_end (&array);
-+}
-+
-+static GVariant *
-+bus_input_context_service_get_property (IBusService *service,
-+ GDBusConnection *connection,
-+ const gchar *sender,
-+ const gchar *object_path,
-+ const gchar *interface_name,
-+ const gchar *property_name,
-+ GError **error)
-+{
-+ int i;
-+ static const struct {
-+ const char *property_name;
-+ GVariant * (* property_callback) (BusInputContext *,
-+ GDBusConnection *,
-+ GError **);
-+ } properties [] = {
-+ { "PostProcessKeyEvent", _ic_get_post_process_key_event },
-+ };
-+
-+ if (error)
-+ *error = NULL;
-+ if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
-+ return IBUS_SERVICE_CLASS (bus_input_context_parent_class)->
-+ service_get_property (
-+ service, connection, sender, object_path,
-+ interface_name, property_name,
-+ error);
-+ }
-+ for (i = 0; i < G_N_ELEMENTS (properties); i++) {
-+ if (g_strcmp0 (properties[i].property_name, property_name) == 0) {
-+ return properties[i].property_callback ((BusInputContext *)service,
-+ connection,
-+ error);
-+ }
-+ }
-+
-+ g_set_error (error,
-+ G_DBUS_ERROR,
-+ G_DBUS_ERROR_FAILED,
-+ "service_get_property received an unknown property: %s",
-+ property_name ? property_name : "(null)");
-+ g_return_val_if_reached (NULL);
-+}
-+
-+static gboolean
- _ic_set_content_type (BusInputContext *context,
-- GVariant *value)
-+ GVariant *value,
-+ GError **error)
- {
- guint purpose = 0;
- guint hints = 0;
-+ gboolean retval = TRUE;
-
- g_variant_get (value, "(uu)", &purpose, &hints);
- if (purpose != context->purpose || hints != context->hints) {
-- GError *error;
-- gboolean retval;
-
- context->purpose = purpose;
- context->hints = hints;
-@@ -1358,24 +1543,30 @@ _ic_set_content_type (BusInputContext *context,
- context->hints);
- }
-
-- error = NULL;
- retval = bus_input_context_property_changed (context,
- "ContentType",
- value,
-- &error);
-- if (!retval) {
-- g_warning ("Failed to emit PropertiesChanged signal: %s",
-- error->message);
-- g_error_free (error);
-- }
-+ error);
- }
-+ return retval;
- }
-
--static void
-+static gboolean
- _ic_set_client_commit_preedit (BusInputContext *context,
-- GVariant *value)
-+ GVariant *value,
-+ GError **error)
- {
- g_variant_get (value, "(b)", &context->client_commit_preedit);
-+ return TRUE;
-+}
-+
-+static gboolean
-+_ic_set_use_post_process_key_event (BusInputContext *context,
-+ GVariant *value,
-+ GError **error)
-+{
-+ g_variant_get (value, "(b)", &context->use_post_process_key_event);
-+ return TRUE;
- }
-
- static gboolean
-@@ -1388,6 +1579,18 @@ bus_input_context_service_set_property (IBusService *service,
- GVariant *value,
- GError **error)
- {
-+ int i;
-+ static const struct {
-+ const char *property_name;
-+ gboolean (* property_callback) (BusInputContext *,
-+ GVariant *,
-+ GError **);
-+ } properties [] = {
-+ { "ContentType", _ic_set_content_type },
-+ { "ClientCommitPreedit", _ic_set_client_commit_preedit },
-+ { "EffectivePostProcessKeyEvent", _ic_set_use_post_process_key_event },
-+ };
-+
- if (error)
- *error = NULL;
- if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
-@@ -1418,14 +1621,12 @@ bus_input_context_service_set_property (IBusService *service,
- " ");
- return FALSE;
- }
--
-- if (g_strcmp0 (property_name, "ContentType") == 0) {
-- _ic_set_content_type (BUS_INPUT_CONTEXT (service), value);
-- return TRUE;
-- }
-- if (g_strcmp0 (property_name, "ClientCommitPreedit") == 0) {
-- _ic_set_client_commit_preedit (BUS_INPUT_CONTEXT (service), value);
-- return TRUE;
-+ for (i = 0; i < G_N_ELEMENTS (properties); i++) {
-+ if (g_strcmp0 (properties[i].property_name, property_name) == 0) {
-+ return properties[i].property_callback ((BusInputContext *) service,
-+ value,
-+ error);
-+ }
- }
-
- g_set_error (error,
-@@ -1465,15 +1666,23 @@ bus_input_context_focus_in (BusInputContext *context)
- ibus_service_get_object_path ((IBusService *)context);
- bus_engine_proxy_focus_in (context->engine, path, context->client);
- bus_engine_proxy_enable (context->engine);
-- bus_engine_proxy_set_capabilities (context->engine, context->capabilities);
-- bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
-- bus_engine_proxy_set_content_type (context->engine, context->purpose, context->hints);
-+ bus_engine_proxy_set_capabilities (context->engine,
-+ context->capabilities);
-+ bus_engine_proxy_set_cursor_location (context->engine,
-+ context->x,
-+ context->y,
-+ context->w,
-+ context->h);
-+ bus_engine_proxy_set_content_type (context->engine,
-+ context->purpose,
-+ context->hints);
- }
-
- if (context->capabilities & IBUS_CAP_FOCUS) {
- g_signal_emit (context, context_signals[FOCUS_IN], 0);
- if (context->engine) {
-- /* if necessary, emit glib signals to the context object to update panel status. see the comment for PREEDIT_CONDITION
-+ /* if necessary, emit glib signals to the context object to update
-+ * panel status. see the comment for PREEDIT_CONDITION
- * for details. */
- if (context->preedit_visible && !PREEDIT_CONDITION) {
- g_signal_emit (context,
-@@ -1483,14 +1692,16 @@ bus_input_context_focus_in (BusInputContext *context)
- context->preedit_cursor_pos,
- context->preedit_visible);
- }
-- if (context->auxiliary_visible && (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
-+ if (context->auxiliary_visible &&
-+ (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
- g_signal_emit (context,
- context_signals[UPDATE_AUXILIARY_TEXT],
- 0,
- context->auxiliary_text,
- context->auxiliary_visible);
- }
-- if (context->lookup_table_visible && (context->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
-+ if (context->lookup_table_visible &&
-+ (context->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
- g_signal_emit (context,
- context_signals[UPDATE_LOOKUP_TABLE],
- 0,
-@@ -1630,14 +1841,17 @@ bus_input_context_property_activate (BusInputContext *context,
- g_assert (BUS_IS_INPUT_CONTEXT (context));
-
- if (context->engine) {
-- bus_engine_proxy_property_activate (context->engine, prop_name, prop_state);
-+ bus_engine_proxy_property_activate (context->engine,
-+ prop_name,
-+ prop_state);
- }
+@@ -1465,15 +1507,23 @@ bus_input_context_focus_in (BusInputContext *context)
+ ibus_service_get_object_path ((IBusService *)context);
+ bus_engine_proxy_focus_in (context->engine, path, context->client);
+ bus_engine_proxy_enable (context->engine);
+- bus_engine_proxy_set_capabilities (context->engine, context->capabilities);
+- bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
+- bus_engine_proxy_set_content_type (context->engine, context->purpose, context->hints);
++ bus_engine_proxy_set_capabilities (context->engine,
++ context->capabilities);
++ bus_engine_proxy_set_cursor_location (context->engine,
++ context->x,
++ context->y,
++ context->w,
++ context->h);
++ bus_engine_proxy_set_content_type (context->engine,
++ context->purpose,
++ context->hints);
+ }
+
+ if (context->capabilities & IBUS_CAP_FOCUS) {
+ g_signal_emit (context, context_signals[FOCUS_IN], 0);
+ if (context->engine) {
+- /* if necessary, emit glib signals to the context object to update panel status. see the comment for PREEDIT_CONDITION
++ /* if necessary, emit glib signals to the context object to update
++ * panel status. see the comment for PREEDIT_CONDITION
+ * for details. */
+ if (context->preedit_visible && !PREEDIT_CONDITION) {
+ g_signal_emit (context,
+@@ -1483,14 +1533,16 @@ bus_input_context_focus_in (BusInputContext *context)
+ context->preedit_cursor_pos,
+ context->preedit_visible);
+ }
+- if (context->auxiliary_visible && (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
++ if (context->auxiliary_visible &&
++ (context->capabilities & IBUS_CAP_AUXILIARY_TEXT) == 0) {
+ g_signal_emit (context,
+ context_signals[UPDATE_AUXILIARY_TEXT],
+ 0,
+ context->auxiliary_text,
+ context->auxiliary_visible);
+ }
+- if (context->lookup_table_visible && (context->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
++ if (context->lookup_table_visible &&
++ (context->capabilities & IBUS_CAP_LOOKUP_TABLE) == 0) {
+ g_signal_emit (context,
+ context_signals[UPDATE_LOOKUP_TABLE],
+ 0,
+@@ -1630,14 +1682,17 @@ bus_input_context_property_activate (BusInputContext *context,
+ g_assert (BUS_IS_INPUT_CONTEXT (context));
+
+ if (context->engine) {
+- bus_engine_proxy_property_activate (context->engine, prop_name, prop_state);
++ bus_engine_proxy_property_activate (context->engine,
++ prop_name,
++ prop_state);
+ }
}
/**
@@ -3136,7 +2968,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_show_preedit_text (BusInputContext *context,
-@@ -1678,7 +1892,8 @@ bus_input_context_show_preedit_text (BusInputContext *context,
+@@ -1678,7 +1733,8 @@ bus_input_context_show_preedit_text (BusInputContext *context,
/**
* bus_input_context_hide_preedit_text:
*
@@ -3146,7 +2978,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_hide_preedit_text (BusInputContext *context,
-@@ -1717,7 +1932,8 @@ bus_input_context_hide_preedit_text (BusInputContext *context,
+@@ -1717,7 +1773,8 @@ bus_input_context_hide_preedit_text (BusInputContext *context,
/**
* bus_input_context_update_auxiliary_text:
*
@@ -3156,7 +2988,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_update_auxiliary_text (BusInputContext *context,
-@@ -1730,11 +1946,13 @@ bus_input_context_update_auxiliary_text (BusInputContext *context,
+@@ -1730,11 +1787,13 @@ bus_input_context_update_auxiliary_text (BusInputContext *context,
g_object_unref (context->auxiliary_text);
}
@@ -3172,7 +3004,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"UpdateAuxiliaryText",
g_variant_new ("(vb)", variant, visible),
-@@ -1752,7 +1970,8 @@ bus_input_context_update_auxiliary_text (BusInputContext *context,
+@@ -1752,7 +1811,8 @@ bus_input_context_update_auxiliary_text (BusInputContext *context,
/**
* bus_input_context_show_auxiliary_text:
*
@@ -3182,7 +3014,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_show_auxiliary_text (BusInputContext *context)
-@@ -1765,7 +1984,8 @@ bus_input_context_show_auxiliary_text (BusInputContext *context)
+@@ -1765,7 +1825,8 @@ bus_input_context_show_auxiliary_text (BusInputContext *context)
context->auxiliary_visible = TRUE;
@@ -3192,7 +3024,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"ShowAuxiliaryText",
NULL,
-@@ -1781,7 +2001,8 @@ bus_input_context_show_auxiliary_text (BusInputContext *context)
+@@ -1781,7 +1842,8 @@ bus_input_context_show_auxiliary_text (BusInputContext *context)
/**
* bus_input_context_hide_auxiliary_text:
*
@@ -3202,7 +3034,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_hide_auxiliary_text (BusInputContext *context)
-@@ -1794,7 +2015,8 @@ bus_input_context_hide_auxiliary_text (BusInputContext *context)
+@@ -1794,7 +1856,8 @@ bus_input_context_hide_auxiliary_text (BusInputContext *context)
context->auxiliary_visible = FALSE;
@@ -3212,7 +3044,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"HideAuxiliaryText",
NULL,
-@@ -1829,11 +2051,13 @@ bus_input_context_update_lookup_table (BusInputContext *context,
+@@ -1829,11 +1892,13 @@ bus_input_context_update_lookup_table (BusInputContext *context,
g_object_unref (context->lookup_table);
}
@@ -3228,7 +3060,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"UpdateLookupTable",
g_variant_new ("(vb)", variant, visible),
-@@ -1851,7 +2075,8 @@ bus_input_context_update_lookup_table (BusInputContext *context,
+@@ -1851,7 +1916,8 @@ bus_input_context_update_lookup_table (BusInputContext *context,
/**
* bus_input_context_show_lookup_table:
*
@@ -3238,7 +3070,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_show_lookup_table (BusInputContext *context)
-@@ -1864,7 +2089,8 @@ bus_input_context_show_lookup_table (BusInputContext *context)
+@@ -1864,7 +1930,8 @@ bus_input_context_show_lookup_table (BusInputContext *context)
context->lookup_table_visible = TRUE;
@@ -3248,7 +3080,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"ShowLookupTable",
NULL,
-@@ -1880,7 +2106,8 @@ bus_input_context_show_lookup_table (BusInputContext *context)
+@@ -1880,7 +1947,8 @@ bus_input_context_show_lookup_table (BusInputContext *context)
/**
* bus_input_context_hide_lookup_table:
*
@@ -3258,7 +3090,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_hide_lookup_table (BusInputContext *context)
-@@ -1893,7 +2120,8 @@ bus_input_context_hide_lookup_table (BusInputContext *context)
+@@ -1893,7 +1961,8 @@ bus_input_context_hide_lookup_table (BusInputContext *context)
context->lookup_table_visible = FALSE;
@@ -3268,7 +3100,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"HideLookupTable",
NULL,
-@@ -1909,7 +2137,8 @@ bus_input_context_hide_lookup_table (BusInputContext *context)
+@@ -1909,7 +1978,8 @@ bus_input_context_hide_lookup_table (BusInputContext *context)
/**
* bus_input_context_page_up_lookup_table:
*
@@ -3278,7 +3110,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_page_up_lookup_table (BusInputContext *context)
-@@ -1920,7 +2149,8 @@ bus_input_context_page_up_lookup_table (BusInputContext *context)
+@@ -1920,7 +1990,8 @@ bus_input_context_page_up_lookup_table (BusInputContext *context)
return;
}
@@ -3288,7 +3120,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"PageUpLookupTable",
NULL,
-@@ -1936,7 +2166,8 @@ bus_input_context_page_up_lookup_table (BusInputContext *context)
+@@ -1936,7 +2007,8 @@ bus_input_context_page_up_lookup_table (BusInputContext *context)
/**
* bus_input_context_page_down_lookup_table:
*
@@ -3298,7 +3130,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_page_down_lookup_table (BusInputContext *context)
-@@ -1947,7 +2178,8 @@ bus_input_context_page_down_lookup_table (BusInputContext *context)
+@@ -1947,7 +2019,8 @@ bus_input_context_page_down_lookup_table (BusInputContext *context)
return;
}
@@ -3308,7 +3140,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"PageDownLookupTable",
NULL,
-@@ -1963,7 +2195,8 @@ bus_input_context_page_down_lookup_table (BusInputContext *context)
+@@ -1963,7 +2036,8 @@ bus_input_context_page_down_lookup_table (BusInputContext *context)
/**
* bus_input_context_cursor_up_lookup_table:
*
@@ -3318,7 +3150,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_cursor_up_lookup_table (BusInputContext *context)
-@@ -1974,7 +2207,8 @@ bus_input_context_cursor_up_lookup_table (BusInputContext *context)
+@@ -1974,7 +2048,8 @@ bus_input_context_cursor_up_lookup_table (BusInputContext *context)
return;
}
@@ -3328,7 +3160,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"CursorUpLookupTable",
NULL,
-@@ -1990,7 +2224,8 @@ bus_input_context_cursor_up_lookup_table (BusInputContext *context)
+@@ -1990,7 +2065,8 @@ bus_input_context_cursor_up_lookup_table (BusInputContext *context)
/**
* bus_input_context_cursor_down_lookup_table:
*
@@ -3338,7 +3170,7 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_cursor_down_lookup_table (BusInputContext *context)
-@@ -2001,7 +2236,8 @@ bus_input_context_cursor_down_lookup_table (BusInputContext *context)
+@@ -2001,7 +2077,8 @@ bus_input_context_cursor_down_lookup_table (BusInputContext *context)
return;
}
@@ -3348,7 +3180,7 @@ index e76bbdfc..2110af87 100644
bus_input_context_emit_signal (context,
"CursorDownLookupTable",
NULL,
-@@ -2017,7 +2253,8 @@ bus_input_context_cursor_down_lookup_table (BusInputContext *context)
+@@ -2017,7 +2094,8 @@ bus_input_context_cursor_down_lookup_table (BusInputContext *context)
/**
* bus_input_context_register_properties:
*
@@ -3358,60 +3190,632 @@ index e76bbdfc..2110af87 100644
*/
static void
bus_input_context_register_properties (BusInputContext *context,
-@@ -2027,7 +2264,8 @@ bus_input_context_register_properties (BusInputContext *context,
+@@ -2027,7 +2105,8 @@ bus_input_context_register_properties (BusInputContext *context,
g_assert (IBUS_IS_PROP_LIST (props));
- if (context->capabilities & IBUS_CAP_PROPERTY) {
-- GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)props);
-+ GVariant *variant =
-+ ibus_serializable_serialize ((IBusSerializable *)props);
- bus_input_context_emit_signal (context,
- "RegisterProperties",
- g_variant_new ("(v)", variant),
-@@ -2044,7 +2282,8 @@ bus_input_context_register_properties (BusInputContext *context,
- /**
- * bus_input_context_update_property:
- *
-- * Update property. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
-+ * Update property. Send D-Bus signal to update status of client or send glib
-+ * signal to the panel, depending on capabilities of the client.
- */
- static void
- bus_input_context_update_property (BusInputContext *context,
-@@ -2054,7 +2293,8 @@ bus_input_context_update_property (BusInputContext *context,
- g_assert (IBUS_IS_PROPERTY (prop));
+ if (context->capabilities & IBUS_CAP_PROPERTY) {
+- GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)props);
++ GVariant *variant =
++ ibus_serializable_serialize ((IBusSerializable *)props);
+ bus_input_context_emit_signal (context,
+ "RegisterProperties",
+ g_variant_new ("(v)", variant),
+@@ -2044,7 +2123,8 @@ bus_input_context_register_properties (BusInputContext *context,
+ /**
+ * bus_input_context_update_property:
+ *
+- * Update property. Send D-Bus signal to update status of client or send glib signal to the panel, depending on capabilities of the client.
++ * Update property. Send D-Bus signal to update status of client or send glib
++ * signal to the panel, depending on capabilities of the client.
+ */
+ static void
+ bus_input_context_update_property (BusInputContext *context,
+@@ -2054,7 +2134,8 @@ bus_input_context_update_property (BusInputContext *context,
+ g_assert (IBUS_IS_PROPERTY (prop));
+
+ if (context->capabilities & IBUS_CAP_PROPERTY) {
+- GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)prop);
++ GVariant *variant =
++ ibus_serializable_serialize ((IBusSerializable *)prop);
+ bus_input_context_emit_signal (context,
+ "UpdateProperty",
+ g_variant_new ("(v)", variant),
+@@ -2089,7 +2170,8 @@ _engine_destroy_cb (BusEngineProxy *engine,
+ /**
+ * _engine_commit_text_cb:
+ *
+- * A function to be called when "commit-text" glib signal is sent to the engine object.
++ * A function to be called when "commit-text" glib signal is sent to the engine
++ * object.
+ */
+ static void
+ _engine_commit_text_cb (BusEngineProxy *engine,
+@@ -2108,7 +2190,8 @@ _engine_commit_text_cb (BusEngineProxy *engine,
+ /**
+ * _engine_forward_key_event_cb:
+ *
+- * A function to be called when "forward-key-event" glib signal is sent to the engine object.
++ * A function to be called when "forward-key-event" glib signal is sent to the
++ * engine object.
+ */
+ static void
+ _engine_forward_key_event_cb (BusEngineProxy *engine,
+@@ -2124,14 +2207,16 @@ _engine_forward_key_event_cb (BusEngineProxy *engine,
+
+ bus_input_context_emit_signal (context,
+ "ForwardKeyEvent",
+- g_variant_new ("(uuu)", keyval, keycode, state),
++ g_variant_new ("(uuu)",
++ keyval, keycode, state),
+ NULL);
+ }
+
+ /**
+ * _engine_delete_surrounding_text_cb:
+ *
+- * A function to be called when "delete-surrounding-text" glib signal is sent to the engine object.
++ * A function to be called when "delete-surrounding-text" glib signal is sent
++ * to the engine object.
+ */
+ static void
+ _engine_delete_surrounding_text_cb (BusEngineProxy *engine,
+@@ -2146,14 +2231,16 @@ _engine_delete_surrounding_text_cb (BusEngineProxy *engine,
+
+ bus_input_context_emit_signal (context,
+ "DeleteSurroundingText",
+- g_variant_new ("(iu)", offset_from_cursor, nchars),
++ g_variant_new ("(iu)",
++ offset_from_cursor, nchars),
+ NULL);
+ }
+
+ /**
+ * _engine_require_surrounding_text_cb:
+ *
+- * A function to be called when "require-surrounding-text" glib signal is sent to the engine object.
++ * A function to be called when "require-surrounding-text" glib signal is sent
++ * to the engine object.
+ */
+ static void
+ _engine_require_surrounding_text_cb (BusEngineProxy *engine,
+@@ -2173,7 +2260,8 @@ _engine_require_surrounding_text_cb (BusEngineProxy *engine,
+ /**
+ * _engine_update_preedit_text_cb:
+ *
+- * A function to be called when "update-preedit-text" glib signal is sent to the engine object.
++ * A function to be called when "update-preedit-text" glib signal is sent to
++ * the engine object.
+ */
+ static void
+ _engine_update_preedit_text_cb (BusEngineProxy *engine,
+@@ -2197,7 +2285,8 @@ _engine_update_preedit_text_cb (BusEngineProxy *engine,
+ /**
+ * _engine_update_auxiliary_text_cb:
+ *
+- * A function to be called when "update-auxiliary-text" glib signal is sent to the engine object.
++ * A function to be called when "update-auxiliary-text" glib signal is sent to
++ * the engine object.
+ */
+ static void
+ _engine_update_auxiliary_text_cb (BusEngineProxy *engine,
+@@ -2217,7 +2306,8 @@ _engine_update_auxiliary_text_cb (BusEngineProxy *engine,
+ /**
+ * _engine_update_lookup_table_cb:
+ *
+- * A function to be called when "update-lookup-table" glib signal is sent to the engine object.
++ * A function to be called when "update-lookup-table" glib signal is sent to
++ * the engine object.
+ */
+ static void
+ _engine_update_lookup_table_cb (BusEngineProxy *engine,
+@@ -2237,7 +2327,8 @@ _engine_update_lookup_table_cb (BusEngineProxy *engine,
+ /**
+ * _engine_register_properties_cb:
+ *
+- * A function to be called when "register-properties" glib signal is sent to the engine object.
++ * A function to be called when "register-properties" glib signal is sent to
++ * the engine object.
+ */
+ static void
+ _engine_register_properties_cb (BusEngineProxy *engine,
+@@ -2256,7 +2347,8 @@ _engine_register_properties_cb (BusEngineProxy *engine,
+ /**
+ * _engine_update_property_cb:
+ *
+- * A function to be called when "update-property" glib signal is sent to the engine object.
++ * A function to be called when "update-property" glib signal is sent to the
++ * engine object.
+ */
+ static void
+ _engine_update_property_cb (BusEngineProxy *engine,
+@@ -2346,10 +2438,11 @@ bus_input_context_new (BusConnection *connection,
+
+ BusInputContext *context = NULL;
+ if (connection) {
+- context = (BusInputContext *) g_object_new (BUS_TYPE_INPUT_CONTEXT,
+- "object-path", path,
+- "connection", bus_connection_get_dbus_connection (connection),
+- NULL);
++ context = (BusInputContext *) g_object_new (
++ BUS_TYPE_INPUT_CONTEXT,
++ "object-path", path,
++ "connection", bus_connection_get_dbus_connection (connection),
++ NULL);
+ }
+ else {
+ context = (BusInputContext *) g_object_new (BUS_TYPE_INPUT_CONTEXT,
+@@ -2439,28 +2532,37 @@ bus_input_context_disable (BusInputContext *context)
+ }
+ }
+
+-/* A list of signals (and their handler functions) that could be emit by the engine proxy object. */
++/* A list of signals (and their handler functions) that could be emit by the
++ * engine proxy object.
++ */
+ const static struct {
+ const gchar *name;
+ GCallback callback;
+ } engine_signals [] = {
+ { "commit-text", G_CALLBACK (_engine_commit_text_cb) },
+ { "forward-key-event", G_CALLBACK (_engine_forward_key_event_cb) },
+- { "delete-surrounding-text", G_CALLBACK (_engine_delete_surrounding_text_cb) },
+- { "require-surrounding-text", G_CALLBACK (_engine_require_surrounding_text_cb) },
++ { "delete-surrounding-text",
++ G_CALLBACK (_engine_delete_surrounding_text_cb) },
++ { "require-surrounding-text",
++ G_CALLBACK (_engine_require_surrounding_text_cb) },
+ { "update-preedit-text", G_CALLBACK (_engine_update_preedit_text_cb) },
+ { "show-preedit-text", G_CALLBACK (_engine_show_preedit_text_cb) },
+ { "hide-preedit-text", G_CALLBACK (_engine_hide_preedit_text_cb) },
+- { "update-auxiliary-text", G_CALLBACK (_engine_update_auxiliary_text_cb) },
++ { "update-auxiliary-text",
++ G_CALLBACK (_engine_update_auxiliary_text_cb) },
+ { "show-auxiliary-text", G_CALLBACK (_engine_show_auxiliary_text_cb) },
+ { "hide-auxiliary-text", G_CALLBACK (_engine_hide_auxiliary_text_cb) },
+ { "update-lookup-table", G_CALLBACK (_engine_update_lookup_table_cb) },
+ { "show-lookup-table", G_CALLBACK (_engine_show_lookup_table_cb) },
+ { "hide-lookup-table", G_CALLBACK (_engine_hide_lookup_table_cb) },
+- { "page-up-lookup-table", G_CALLBACK (_engine_page_up_lookup_table_cb) },
+- { "page-down-lookup-table", G_CALLBACK (_engine_page_down_lookup_table_cb) },
+- { "cursor-up-lookup-table", G_CALLBACK (_engine_cursor_up_lookup_table_cb) },
+- { "cursor-down-lookup-table", G_CALLBACK (_engine_cursor_down_lookup_table_cb) },
++ { "page-up-lookup-table",
++ G_CALLBACK (_engine_page_up_lookup_table_cb) },
++ { "page-down-lookup-table",
++ G_CALLBACK (_engine_page_down_lookup_table_cb) },
++ { "cursor-up-lookup-table",
++ G_CALLBACK (_engine_cursor_up_lookup_table_cb) },
++ { "cursor-down-lookup-table",
++ G_CALLBACK (_engine_cursor_down_lookup_table_cb) },
+ { "register-properties", G_CALLBACK (_engine_register_properties_cb) },
+ { "update-property", G_CALLBACK (_engine_update_property_cb) },
+ { "panel-extension", G_CALLBACK (_engine_panel_extension_cb) },
+@@ -2531,9 +2633,16 @@ bus_input_context_set_engine (BusInputContext *context,
+ ibus_service_get_object_path ((IBusService *)context);
+ bus_engine_proxy_focus_in (context->engine, path, context->client);
+ bus_engine_proxy_enable (context->engine);
+- bus_engine_proxy_set_capabilities (context->engine, context->capabilities);
+- bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
+- bus_engine_proxy_set_content_type (context->engine, context->purpose, context->hints);
++ bus_engine_proxy_set_capabilities (context->engine,
++ context->capabilities);
++ bus_engine_proxy_set_cursor_location (context->engine,
++ context->x,
++ context->y,
++ context->w,
++ context->h);
++ bus_engine_proxy_set_content_type (context->engine,
++ context->purpose,
++ context->hints);
+ }
+ }
+ g_signal_emit (context,
+@@ -2779,7 +2888,8 @@ bus_input_context_set_capabilities (BusInputContext *context,
+ {
+ g_assert (BUS_IS_INPUT_CONTEXT (context));
+
+- /* If the context does not support IBUS_CAP_FOCUS, then the client application have to handle all information such as
++ /* If the context does not support IBUS_CAP_FOCUS, then the client
++ * application have to handle all information such as
+ * preedit and auxiliary text. */
+ if ((capabilities & IBUS_CAP_FOCUS) == 0) {
+ capabilities |= (IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_AUXILIARY_TEXT | IBUS_CAP_LOOKUP_TABLE | IBUS_CAP_PROPERTY);
+--
+2.41.0
+
+From 3670faf74a7b4594ceda3b4a8c01515840cc1991 Mon Sep 17 00:00:00 2001
+From: fujiwarat <takao.fujiwara1@gmail.com>
+Date: Wed, 12 Jul 2023 07:50:22 +0900
+Subject: [PATCH 2/3] src: Fix sync ibus_input_context_process_key_event()
+
+The synchronous "ProcessKeyEvent" D-Bus method cannot receive
+"CommitText" and "ForwardKeyEvent" D-Bus signals during calling the method.
+To resolve the issue, now
+ibus_input_context_set_post_process_key_event() and
+ibus_input_context_post_process_key_event() are added newly.
+
+ibus_input_context_post_process_key_event() retries "CommitText" and
+"ForwardKeyEvent" D-Bus signals during calling the "ProcessKeyEvent" D-Bus
+method and ibus-daemon does not handle those signals.
+
+"Since: 1.5.00" is added in header files to available APIs before 1.5.29
+is released. Will think later how to convert the version comments together
+when the new version 1.5.29 is committed.
+
+BUG=https://github.com/ibus/ibus/issues/2486
+---
+ bus/inputcontext.c | 252 ++++++++++++++++++++++++++++++++----
+ client/gtk2/ibusimcontext.c | 225 ++++++++++++++++++++++----------
+ src/ibusinputcontext.c | 162 +++++++++++++++++++++--
+ src/ibusinputcontext.h | 36 +++++-
+ 4 files changed, 567 insertions(+), 108 deletions(-)
+
+diff --git a/bus/inputcontext.c b/bus/inputcontext.c
+index 8aded5d8..4d1fb041 100644
+--- a/bus/inputcontext.c
++++ b/bus/inputcontext.c
+@@ -31,6 +31,8 @@
+ #include "marshalers.h"
+ #include "types.h"
+
++#define MAX_SYNC_DATA 30
++
+ struct _SetEngineByDescData {
+ /* context related to the data */
+ BusInputContext *context;
+@@ -46,6 +48,11 @@ struct _SetEngineByDescData {
+ };
+ typedef struct _SetEngineByDescData SetEngineByDescData;
+
++typedef struct _SyncForwardingData {
++ gchar key;
++ IBusText *text;
++} SyncForwardingData;
++
+ struct _BusInputContext {
+ IBusService parent;
+
+@@ -99,6 +106,9 @@ struct _BusInputContext {
+
+ BusPanelProxy *emoji_extension;
+ gboolean is_extension_lookup_table;
++ GQueue *queue_during_process_key_event;
++ gboolean use_post_process_key_event;
++ gboolean processing_key_event;
+ };
+
+ struct _BusInputContextClass {
+@@ -156,6 +166,15 @@ static void bus_input_context_service_method_call
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation);
++static GVariant *
++ bus_input_context_service_get_property
++ (IBusService *service,
++ GDBusConnection *connection,
++ const gchar *sender,
++ const gchar *object_path,
++ const gchar *interface_name,
++ const gchar *property_name,
++ GError **error);
+ static gboolean bus_input_context_service_set_property
+ (IBusService *service,
+ GDBusConnection *connection,
+@@ -215,8 +234,21 @@ static const gchar introspection_xml[] =
+ "<node>\n"
+ " <interface name='org.freedesktop.IBus.InputContext'>\n"
+ /* properties */
++ " <property name='PostProcessKeyEvent' type='(a(yv))' access='read'>\n"
++ " <annotation name='org.gtk.GDBus.Since'\n"
++ " value='1.5.29' />\n"
++ " <annotation name='org.gtk.GDBus.DocString'\n"
++ " value='Stability: Unstable' />\n"
++ " </property>\n"
+ " <property name='ContentType' type='(uu)' access='write' />\n"
+ " <property name='ClientCommitPreedit' type='(b)' access='write' />\n"
++ " <property name='EffectivePostProcessKeyEvent' type='(b)' \n"
++ " access='write'>\n"
++ " <annotation name='org.gtk.GDBus.Since'\n"
++ " value='1.5.29' />\n"
++ " <annotation name='org.gtk.GDBus.DocString'\n"
++ " value='Stability: Unstable' />\n"
++ " </property>\n"
+ /* methods */
+ " <method name='ProcessKeyEvent'>\n"
+ " <arg direction='in' type='u' name='keyval' />\n"
+@@ -353,6 +385,8 @@ bus_input_context_class_init (BusInputContextClass *class)
+ /* override the parent class's implementation. */
+ IBUS_SERVICE_CLASS (class)->service_method_call =
+ bus_input_context_service_method_call;
++ IBUS_SERVICE_CLASS (class)->service_get_property =
++ bus_input_context_service_get_property;
+ IBUS_SERVICE_CLASS (class)->service_set_property =
+ bus_input_context_service_set_property;
+ /* register the xml so that bus_ibus_impl_service_method_call will be
+@@ -782,6 +816,11 @@ bus_input_context_property_changed (BusInputContext *context,
+ }
+
+
++typedef struct _PanelProcessKeyEventData {
++ GDBusMethodInvocation *invocation;
++ BusInputContext *context;
++} PanelProcessKeyEventData;
++
+ /**
+ * _panel_process_key_event_cb:
+ *
+@@ -789,14 +828,21 @@ bus_input_context_property_changed (BusInputContext *context,
+ * bus_panel_proxy_process_key_event() is finished.
+ */
+ static void
+-_panel_process_key_event_cb (GObject *source,
+- GAsyncResult *res,
+- GDBusMethodInvocation *invocation)
++_panel_process_key_event_cb (GObject *source,
++ GAsyncResult *res,
++ PanelProcessKeyEventData *data)
+ {
+ GError *error = NULL;
+ GVariant *value = g_dbus_proxy_call_finish ((GDBusProxy *)source,
+ res,
+ &error);
++ GDBusMethodInvocation *invocation;
++ BusInputContext *context;
++
++ g_assert (data);
++ invocation = data->invocation;
++ context = data->context;
++ g_slice_free (PanelProcessKeyEventData, data);
+ if (value != NULL) {
+ g_dbus_method_invocation_return_value (invocation, value);
+ g_variant_unref (value);
+@@ -805,6 +851,7 @@ _panel_process_key_event_cb (GObject *source,
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ g_error_free (error);
+ }
++ context->processing_key_event = FALSE;
+ }
+
+ typedef struct _ProcessKeyEventData ProcessKeyEventData;
+@@ -841,21 +888,27 @@ _ic_process_key_event_reply_cb (GObject *source,
+ gboolean retval = FALSE;
+ g_variant_get (value, "(b)", &retval);
+ if (context->emoji_extension && !retval) {
++ PanelProcessKeyEventData *pdata =
++ g_slice_new (PanelProcessKeyEventData);
++ pdata->invocation = invocation;
++ pdata->context = context;
+ bus_panel_proxy_process_key_event (context->emoji_extension,
+ keyval,
+ keycode,
+ modifiers,
+ (GAsyncReadyCallback)
+ _panel_process_key_event_cb,
+- invocation);
++ pdata);
+ } else {
+ g_dbus_method_invocation_return_value (invocation, value);
++ context->processing_key_event = FALSE;
+ }
+ g_variant_unref (value);
+ }
+ else {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ g_error_free (error);
++ context->processing_key_event = FALSE;
+ }
+
+ g_object_unref (context);
+@@ -877,6 +930,8 @@ _ic_process_key_event (BusInputContext *context,
+ guint keycode = 0;
+ guint modifiers = 0;
+
++ if (context->use_post_process_key_event)
++ context->processing_key_event = TRUE;
+ g_variant_get (parameters, "(uuu)", &keyval, &keycode, &modifiers);
+ if (G_UNLIKELY (!context->has_focus)) {
+ /* workaround: set focus if context does not have focus */
+@@ -1372,17 +1427,109 @@ bus_input_context_service_method_call (IBusService *service,
+ g_return_if_reached ();
+ }
+
+-static void
++/**
++ * _ic_get_post_process_key_event:
++ *
++ * Implement the "PostProcessKeyEvent" get property of the
++ * org.freedesktop.IBus.InputContext interface because currently the Gio
++ * D-Bus method calls don't support multiple nested tuples likes
++ * G_VARIANT_TYPE ("((ba(yv)))")) in "ProcessKeyEvent" D-Bus method
++ * So these post events are separated from the return value "b" of
++ * the "ProcessKeyEvent" D-Bus method call.
++ */
++static GVariant *
++_ic_get_post_process_key_event (BusInputContext *context,
++ GDBusConnection *connection,
++ GError **error)
++{
++ const char *error_message = NULL;
++ GVariantBuilder array;
++ SyncForwardingData *data;
++
++ do {
++ if (!BUS_IS_INPUT_CONTEXT (context)) {
++ error_message = "BusInputContext is freed";
++ break;
++ }
++ if (context->processing_key_event) {
++ error_message = "Another ProcessKeyEvent is called.";
++ break;
++ }
++ g_variant_builder_init (&array, G_VARIANT_TYPE ("a(yv)"));
++ while ((data =
++ g_queue_pop_head (context->queue_during_process_key_event))) {
++ GVariant *variant = ibus_serializable_serialize_object (
++ IBUS_SERIALIZABLE (data->text));
++ g_variant_builder_add (&array, "(yv)", data->key, variant);
++ g_object_unref (data->text);
++ g_slice_free (SyncForwardingData, data);
++ }
++ } while (FALSE);
++ if (error_message) {
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "%s", error_message);
++ return NULL;
++ }
++ return g_variant_builder_end (&array);
++}
++
++static GVariant *
++bus_input_context_service_get_property (IBusService *service,
++ GDBusConnection *connection,
++ const gchar *sender,
++ const gchar *object_path,
++ const gchar *interface_name,
++ const gchar *property_name,
++ GError **error)
++{
++ int i;
++ static const struct {
++ const char *property_name;
++ GVariant * (* property_callback) (BusInputContext *,
++ GDBusConnection *,
++ GError **);
++ } properties [] = {
++ { "PostProcessKeyEvent", _ic_get_post_process_key_event },
++ };
++
++ if (error)
++ *error = NULL;
++ if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
++ return IBUS_SERVICE_CLASS (bus_input_context_parent_class)->
++ service_get_property (
++ service, connection, sender, object_path,
++ interface_name, property_name,
++ error);
++ }
++ for (i = 0; i < G_N_ELEMENTS (properties); i++) {
++ if (g_strcmp0 (properties[i].property_name, property_name) == 0) {
++ return properties[i].property_callback ((BusInputContext *)service,
++ connection,
++ error);
++ }
++ }
++
++ g_set_error (error,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_FAILED,
++ "service_get_property received an unknown property: %s",
++ property_name ? property_name : "(null)");
++ g_return_val_if_reached (NULL);
++}
++
++static gboolean
+ _ic_set_content_type (BusInputContext *context,
+- GVariant *value)
++ GVariant *value,
++ GError **error)
+ {
+ guint purpose = 0;
+ guint hints = 0;
++ gboolean retval = TRUE;
+
+ g_variant_get (value, "(uu)", &purpose, &hints);
+ if (purpose != context->purpose || hints != context->hints) {
+- GError *error;
+- gboolean retval;
+
+ context->purpose = purpose;
+ context->hints = hints;
+@@ -1400,24 +1547,30 @@ _ic_set_content_type (BusInputContext *context,
+ context->hints);
+ }
+
+- error = NULL;
+ retval = bus_input_context_property_changed (context,
+ "ContentType",
+ value,
+- &error);
+- if (!retval) {
+- g_warning ("Failed to emit PropertiesChanged signal: %s",
+- error->message);
+- g_error_free (error);
+- }
++ error);
+ }
++ return retval;
+ }
+
+-static void
++static gboolean
+ _ic_set_client_commit_preedit (BusInputContext *context,
+- GVariant *value)
++ GVariant *value,
++ GError **error)
+ {
+ g_variant_get (value, "(b)", &context->client_commit_preedit);
++ return TRUE;
++}
++
++static gboolean
++_ic_set_use_post_process_key_event (BusInputContext *context,
++ GVariant *value,
++ GError **error)
++{
++ g_variant_get (value, "(b)", &context->use_post_process_key_event);
++ return TRUE;
+ }
+
+ static gboolean
+@@ -1430,6 +1583,18 @@ bus_input_context_service_set_property (IBusService *service,
+ GVariant *value,
+ GError **error)
+ {
++ int i;
++ static const struct {
++ const char *property_name;
++ gboolean (* property_callback) (BusInputContext *,
++ GVariant *,
++ GError **);
++ } properties [] = {
++ { "ContentType", _ic_set_content_type },
++ { "ClientCommitPreedit", _ic_set_client_commit_preedit },
++ { "EffectivePostProcessKeyEvent", _ic_set_use_post_process_key_event },
++ };
++
+ if (error)
+ *error = NULL;
+ if (g_strcmp0 (interface_name, IBUS_INTERFACE_INPUT_CONTEXT) != 0) {
+@@ -1460,14 +1625,12 @@ bus_input_context_service_set_property (IBusService *service,
+ " ");
+ return FALSE;
+ }
+-
+- if (g_strcmp0 (property_name, "ContentType") == 0) {
+- _ic_set_content_type (BUS_INPUT_CONTEXT (service), value);
+- return TRUE;
+- }
+- if (g_strcmp0 (property_name, "ClientCommitPreedit") == 0) {
+- _ic_set_client_commit_preedit (BUS_INPUT_CONTEXT (service), value);
+- return TRUE;
++ for (i = 0; i < G_N_ELEMENTS (properties); i++) {
++ if (g_strcmp0 (properties[i].property_name, property_name) == 0) {
++ return properties[i].property_callback ((BusInputContext *) service,
++ value,
++ error);
++ }
+ }
- if (context->capabilities & IBUS_CAP_PROPERTY) {
-- GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)prop);
-+ GVariant *variant =
-+ ibus_serializable_serialize ((IBusSerializable *)prop);
- bus_input_context_emit_signal (context,
- "UpdateProperty",
- g_variant_new ("(v)", variant),
-@@ -2089,7 +2329,8 @@ _engine_destroy_cb (BusEngineProxy *engine,
- /**
- * _engine_commit_text_cb:
- *
-- * A function to be called when "commit-text" glib signal is sent to the engine object.
-+ * A function to be called when "commit-text" glib signal is sent to the engine
-+ * object.
- */
- static void
- _engine_commit_text_cb (BusEngineProxy *engine,
-@@ -2108,7 +2349,8 @@ _engine_commit_text_cb (BusEngineProxy *engine,
- /**
- * _engine_forward_key_event_cb:
- *
-- * A function to be called when "forward-key-event" glib signal is sent to the engine object.
-+ * A function to be called when "forward-key-event" glib signal is sent to the
-+ * engine object.
- */
- static void
- _engine_forward_key_event_cb (BusEngineProxy *engine,
-@@ -2122,16 +2364,33 @@ _engine_forward_key_event_cb (BusEngineProxy *engine,
+ g_set_error (error,
+@@ -2204,7 +2367,23 @@ _engine_forward_key_event_cb (BusEngineProxy *engine,
+ g_assert (BUS_IS_INPUT_CONTEXT (context));
g_assert (context->engine == engine);
-
+-
++ g_assert (context->queue_during_process_key_event);
++
+ if (context->processing_key_event && g_queue_get_length (
+ context->queue_during_process_key_event) <= MAX_SYNC_DATA) {
+ SyncForwardingData *data;
@@ -3429,107 +3833,8 @@ index e76bbdfc..2110af87 100644
+ }
bus_input_context_emit_signal (context,
"ForwardKeyEvent",
-- g_variant_new ("(uuu)", keyval, keycode, state),
-+ g_variant_new ("(uuu)",
-+ keyval, keycode, state),
- NULL);
- }
-
- /**
- * _engine_delete_surrounding_text_cb:
- *
-- * A function to be called when "delete-surrounding-text" glib signal is sent to the engine object.
-+ * A function to be called when "delete-surrounding-text" glib signal is sent
-+ * to the engine object.
- */
- static void
- _engine_delete_surrounding_text_cb (BusEngineProxy *engine,
-@@ -2146,14 +2405,16 @@ _engine_delete_surrounding_text_cb (BusEngineProxy *engine,
-
- bus_input_context_emit_signal (context,
- "DeleteSurroundingText",
-- g_variant_new ("(iu)", offset_from_cursor, nchars),
-+ g_variant_new ("(iu)",
-+ offset_from_cursor, nchars),
- NULL);
- }
-
- /**
- * _engine_require_surrounding_text_cb:
- *
-- * A function to be called when "require-surrounding-text" glib signal is sent to the engine object.
-+ * A function to be called when "require-surrounding-text" glib signal is sent
-+ * to the engine object.
- */
- static void
- _engine_require_surrounding_text_cb (BusEngineProxy *engine,
-@@ -2173,7 +2434,8 @@ _engine_require_surrounding_text_cb (BusEngineProxy *engine,
- /**
- * _engine_update_preedit_text_cb:
- *
-- * A function to be called when "update-preedit-text" glib signal is sent to the engine object.
-+ * A function to be called when "update-preedit-text" glib signal is sent to
-+ * the engine object.
- */
- static void
- _engine_update_preedit_text_cb (BusEngineProxy *engine,
-@@ -2197,7 +2459,8 @@ _engine_update_preedit_text_cb (BusEngineProxy *engine,
- /**
- * _engine_update_auxiliary_text_cb:
- *
-- * A function to be called when "update-auxiliary-text" glib signal is sent to the engine object.
-+ * A function to be called when "update-auxiliary-text" glib signal is sent to
-+ * the engine object.
- */
- static void
- _engine_update_auxiliary_text_cb (BusEngineProxy *engine,
-@@ -2217,7 +2480,8 @@ _engine_update_auxiliary_text_cb (BusEngineProxy *engine,
- /**
- * _engine_update_lookup_table_cb:
- *
-- * A function to be called when "update-lookup-table" glib signal is sent to the engine object.
-+ * A function to be called when "update-lookup-table" glib signal is sent to
-+ * the engine object.
- */
- static void
- _engine_update_lookup_table_cb (BusEngineProxy *engine,
-@@ -2237,7 +2501,8 @@ _engine_update_lookup_table_cb (BusEngineProxy *engine,
- /**
- * _engine_register_properties_cb:
- *
-- * A function to be called when "register-properties" glib signal is sent to the engine object.
-+ * A function to be called when "register-properties" glib signal is sent to
-+ * the engine object.
- */
- static void
- _engine_register_properties_cb (BusEngineProxy *engine,
-@@ -2256,7 +2521,8 @@ _engine_register_properties_cb (BusEngineProxy *engine,
- /**
- * _engine_update_property_cb:
- *
-- * A function to be called when "update-property" glib signal is sent to the engine object.
-+ * A function to be called when "update-property" glib signal is sent to the
-+ * engine object.
- */
- static void
- _engine_update_property_cb (BusEngineProxy *engine,
-@@ -2346,10 +2612,11 @@ bus_input_context_new (BusConnection *connection,
-
- BusInputContext *context = NULL;
- if (connection) {
-- context = (BusInputContext *) g_object_new (BUS_TYPE_INPUT_CONTEXT,
-- "object-path", path,
-- "connection", bus_connection_get_dbus_connection (connection),
-- NULL);
-+ context = (BusInputContext *) g_object_new (
-+ BUS_TYPE_INPUT_CONTEXT,
-+ "object-path", path,
-+ "connection", bus_connection_get_dbus_connection (connection),
-+ NULL);
- }
- else {
- context = (BusInputContext *) g_object_new (BUS_TYPE_INPUT_CONTEXT,
-@@ -2362,6 +2629,7 @@ bus_input_context_new (BusConnection *connection,
+ g_variant_new ("(uuu)",
+@@ -2455,6 +2634,7 @@ bus_input_context_new (BusConnection *connection,
/* it is a fake input context, just need process hotkey */
context->fake = (strncmp (client, "fake", 4) == 0);
@@ -3537,83 +3842,7 @@ index e76bbdfc..2110af87 100644
if (connection) {
g_object_ref_sink (connection);
-@@ -2439,28 +2707,37 @@ bus_input_context_disable (BusInputContext *context)
- }
- }
-
--/* A list of signals (and their handler functions) that could be emit by the engine proxy object. */
-+/* A list of signals (and their handler functions) that could be emit by the
-+ * engine proxy object.
-+ */
- const static struct {
- const gchar *name;
- GCallback callback;
- } engine_signals [] = {
- { "commit-text", G_CALLBACK (_engine_commit_text_cb) },
- { "forward-key-event", G_CALLBACK (_engine_forward_key_event_cb) },
-- { "delete-surrounding-text", G_CALLBACK (_engine_delete_surrounding_text_cb) },
-- { "require-surrounding-text", G_CALLBACK (_engine_require_surrounding_text_cb) },
-+ { "delete-surrounding-text",
-+ G_CALLBACK (_engine_delete_surrounding_text_cb) },
-+ { "require-surrounding-text",
-+ G_CALLBACK (_engine_require_surrounding_text_cb) },
- { "update-preedit-text", G_CALLBACK (_engine_update_preedit_text_cb) },
- { "show-preedit-text", G_CALLBACK (_engine_show_preedit_text_cb) },
- { "hide-preedit-text", G_CALLBACK (_engine_hide_preedit_text_cb) },
-- { "update-auxiliary-text", G_CALLBACK (_engine_update_auxiliary_text_cb) },
-+ { "update-auxiliary-text",
-+ G_CALLBACK (_engine_update_auxiliary_text_cb) },
- { "show-auxiliary-text", G_CALLBACK (_engine_show_auxiliary_text_cb) },
- { "hide-auxiliary-text", G_CALLBACK (_engine_hide_auxiliary_text_cb) },
- { "update-lookup-table", G_CALLBACK (_engine_update_lookup_table_cb) },
- { "show-lookup-table", G_CALLBACK (_engine_show_lookup_table_cb) },
- { "hide-lookup-table", G_CALLBACK (_engine_hide_lookup_table_cb) },
-- { "page-up-lookup-table", G_CALLBACK (_engine_page_up_lookup_table_cb) },
-- { "page-down-lookup-table", G_CALLBACK (_engine_page_down_lookup_table_cb) },
-- { "cursor-up-lookup-table", G_CALLBACK (_engine_cursor_up_lookup_table_cb) },
-- { "cursor-down-lookup-table", G_CALLBACK (_engine_cursor_down_lookup_table_cb) },
-+ { "page-up-lookup-table",
-+ G_CALLBACK (_engine_page_up_lookup_table_cb) },
-+ { "page-down-lookup-table",
-+ G_CALLBACK (_engine_page_down_lookup_table_cb) },
-+ { "cursor-up-lookup-table",
-+ G_CALLBACK (_engine_cursor_up_lookup_table_cb) },
-+ { "cursor-down-lookup-table",
-+ G_CALLBACK (_engine_cursor_down_lookup_table_cb) },
- { "register-properties", G_CALLBACK (_engine_register_properties_cb) },
- { "update-property", G_CALLBACK (_engine_update_property_cb) },
- { "panel-extension", G_CALLBACK (_engine_panel_extension_cb) },
-@@ -2531,9 +2808,16 @@ bus_input_context_set_engine (BusInputContext *context,
- ibus_service_get_object_path ((IBusService *)context);
- bus_engine_proxy_focus_in (context->engine, path, context->client);
- bus_engine_proxy_enable (context->engine);
-- bus_engine_proxy_set_capabilities (context->engine, context->capabilities);
-- bus_engine_proxy_set_cursor_location (context->engine, context->x, context->y, context->w, context->h);
-- bus_engine_proxy_set_content_type (context->engine, context->purpose, context->hints);
-+ bus_engine_proxy_set_capabilities (context->engine,
-+ context->capabilities);
-+ bus_engine_proxy_set_cursor_location (context->engine,
-+ context->x,
-+ context->y,
-+ context->w,
-+ context->h);
-+ bus_engine_proxy_set_content_type (context->engine,
-+ context->purpose,
-+ context->hints);
- }
- }
- g_signal_emit (context,
-@@ -2779,7 +3063,8 @@ bus_input_context_set_capabilities (BusInputContext *context,
- {
- g_assert (BUS_IS_INPUT_CONTEXT (context));
-
-- /* If the context does not support IBUS_CAP_FOCUS, then the client application have to handle all information such as
-+ /* If the context does not support IBUS_CAP_FOCUS, then the client
-+ * application have to handle all information such as
- * preedit and auxiliary text. */
- if ((capabilities & IBUS_CAP_FOCUS) == 0) {
- capabilities |= (IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_AUXILIARY_TEXT | IBUS_CAP_LOOKUP_TABLE | IBUS_CAP_PROPERTY);
-@@ -2828,11 +3113,17 @@ bus_input_context_set_content_type (BusInputContext *context,
+@@ -2938,11 +3118,17 @@ bus_input_context_set_content_type (BusInputContext *context,
guint hints)
{
GVariant *value;
@@ -3632,7 +3861,7 @@ index e76bbdfc..2110af87 100644
g_variant_unref (value);
}
-@@ -2842,12 +3133,24 @@ bus_input_context_commit_text_use_extension (BusInputContext *context,
+@@ -2952,12 +3138,24 @@ bus_input_context_commit_text_use_extension (BusInputContext *context,
gboolean use_extension)
{
g_assert (BUS_IS_INPUT_CONTEXT (context));
@@ -3658,7 +3887,7 @@ index e76bbdfc..2110af87 100644
GVariant *variant = ibus_serializable_serialize (
(IBusSerializable *)text);
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
-index ea8270bb..d57575ce 100644
+index ea8270bb..7ccc129d 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -111,7 +111,7 @@ static guint _signal_delete_surrounding_id = 0;
@@ -3884,7 +4113,7 @@ index ea8270bb..d57575ce 100644
+ * IBus clients.
+ * Each GTK application, each QT application, Xorg server, Wayland
+ * comppsitor are called as IBus event owners here.
-+ *
++ *
+ * The IBus client processes the key events between the IBus event owner
+ * and the IBus daemon and the procedure step is to:
+ *
@@ -3919,7 +4148,7 @@ index ea8270bb..d57575ce 100644
+ * *asynchronously* with a GSource loop and forward the return value
+ * to the IBus event owner synchronously. So IBus clients perform
+ * virtually synchronously to cover problems of IBus synchronous APIs.
-+ *
++ *
+ * The purpose of the asynchronous process is that each IBus input
+ * method can process the key events without D-Bus timeout and also
+ * the IBus synchronous process has a problem that the IBus
@@ -4184,7 +4413,7 @@ index 28ae04ad..def23b25 100644
void \
ibus_input_context_##name (IBusInputContext *context) \
diff --git a/src/ibusinputcontext.h b/src/ibusinputcontext.h
-index 09992148..1cb5126a 100644
+index 09992148..ca604670 100644
--- a/src/ibusinputcontext.h
+++ b/src/ibusinputcontext.h
@@ -2,7 +2,7 @@
@@ -4204,7 +4433,7 @@ index 09992148..1cb5126a 100644
/**
* ibus_input_context_set_cursor_location:
* @context: An IBusInputContext.
-@@ -519,9 +518,32 @@ void ibus_input_context_set_content_type
+@@ -519,9 +518,38 @@ void ibus_input_context_set_content_type
*
* See also ibus_engine_update_preedit_text_with_mode().
*/
@@ -4220,6 +4449,9 @@ index 09992148..1cb5126a 100644
+ * @enable: Can use ibus_input_context_post_process_key_event() to retrieve
+ * commit-text and forwar-key-event signals during
+ * calling ibus_input_context_process_key_event() if it's %TRUE.
++ *
++ * Since: 1.5.00
++ * Stability: Unstable
+ */
+void ibus_input_context_set_post_process_key_event
+ (IBusInputContext *context,
@@ -4233,6 +4465,9 @@ index 09992148..1cb5126a 100644
+ * calling ibus_input_context_process_key_event().
+ *
+ * See also ibus_input_context_set_post_process_key_event().
++ *
++ * Since: 1.5.00
++ * Stability: Unstable
+ */
+void ibus_input_context_post_process_key_event
+ (IBusInputContext *context);
@@ -4242,15 +4477,15 @@ index 09992148..1cb5126a 100644
--
2.41.0
-From dd7e85890ced5e53d982f02f5b11ef5a36e2eab8 Mon Sep 17 00:00:00 2001
+From e495f8068380856c01fd22ceebb9398072fd65d8 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
-Date: Sun, 9 Jul 2023 18:48:21 +0900
-Subject: [PATCH 2/2] client/x11: Fix sync
+Date: Wed, 12 Jul 2023 07:52:21 +0900
+Subject: [PATCH 3/3] client/x11: Fix sync
ibus_input_context_process_key_event()
Fix the synchronous "ProcessKeyEvent" D-Bus method in ibus-x11 too.
-Fixes: https://github.com/ibus/ibus/commit/a73ea2c
+Fixes: https://github.com/ibus/ibus/commit/3670faf
BUG=https://github.com/ibus/ibus/issues/2486
---
diff --git a/ibus.spec b/ibus.spec
index 8b73f26..b2d61e8 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -50,7 +50,7 @@
Name: ibus
Version: 1.5.28
-Release: 12%{?dist}
+Release: 13%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.0-or-later
URL: https://github.com/ibus/%name/wiki
@@ -557,6 +557,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
+* Wed Jul 12 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.28-13
+- Fix sync ibus_input_context_process_key_event() #3
+
* Sun Jul 09 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.28-12
- Fix sync ibus_input_context_process_key_event() #2
reply other threads:[~2026-05-31 2:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178019329295.1.8516955552427891024.rpms-ibus-aa8a6c3f8a29@fedoraproject.org \
--to=tfujiwar@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox