Update ibus_input_context_set_surrounding_text for a global IC

Also fix CI
This commit is contained in:
Takao Fujiwara 2022-09-19 14:02:53 +09:00
parent 1d4783734c
commit 3e0a79049c
2 changed files with 24 additions and 24 deletions

View File

@ -131,9 +131,9 @@ index 3fc9c0f2..eaf7eb90 100644
--
2.37.3
From 483abb429fed4c51e214fa6c1efbb54ca73d5b28 Mon Sep 17 00:00:00 2001
From 7bbcce66e1ca694b7a62553327161290bf4ee283 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 16 Sep 2022 14:50:53 +0900
Date: Mon, 19 Sep 2022 11:52:14 +0900
Subject: [PATCH] client/gtk2: Update surrounding text properties by focus in
ibus_input_context_set_surrounding_text() should be succeeded
@ -148,8 +148,8 @@ and clients can call set_surrounding_text() later.
BUG=https://github.com/ibus/ibus/issues/2423
---
client/gtk2/ibusimcontext.c | 25 +++++++++++++++++++++++++
src/ibusinputcontext.c | 24 ++++++++++++++++++++++--
2 files changed, 47 insertions(+), 2 deletions(-)
src/ibusinputcontext.c | 29 ++++++++++++++++++++++++++++-
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index eaf7eb90..6e338157 100644
@ -216,7 +216,7 @@ index eaf7eb90..6e338157 100644
if (!g_queue_is_empty (ibusimcontext->events_queue)) {
diff --git a/src/ibusinputcontext.c b/src/ibusinputcontext.c
index 7981de38..ed887dde 100644
index 7981de38..28ae04ad 100644
--- a/src/ibusinputcontext.c
+++ b/src/ibusinputcontext.c
@@ -2,7 +2,7 @@
@ -266,30 +266,26 @@ index 7981de38..ed887dde 100644
return;
}
@@ -1109,6 +1126,7 @@ ibus_input_context_set_surrounding_text (IBusInputContext *context,
guint32 cursor_pos,
guint32 anchor_pos)
{
+ static IBusInputContext *prev_context = NULL;
IBusInputContextPrivate *priv;
@@ -1116,9 +1133,19 @@ ibus_input_context_set_surrounding_text (IBusInputContext *context,
g_assert (IBUS_IS_INPUT_CONTEXT (context));
@@ -1119,12 +1137,14 @@ ibus_input_context_set_surrounding_text (IBusInputContext *context,
priv = IBUS_INPUT_CONTEXT_GET_PRIVATE (context);
+ /* This API should send "SetSurroundingText" D-Bus method when
+ * input contexts are switched between tabs in a text application
+ * so that engines can receive the updated surrounding texts after
+ * focus-in events happen.
+ *
+ * GNOME shell uses a single input context and the address of the input
+ * contexts are always same. So check the address of texts if the input
+ * contexts on applications are switched.
+ */
if (cursor_pos != priv->surrounding_cursor_pos ||
anchor_pos != priv->selection_anchor_pos ||
priv->surrounding_text == NULL ||
- g_strcmp0 (text->text, priv->surrounding_text->text) != 0) {
+ g_strcmp0 (text->text, priv->surrounding_text->text) != 0 ||
+ context != prev_context) {
+ text != priv->surrounding_text ||
g_strcmp0 (text->text, priv->surrounding_text->text) != 0) {
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;
priv->selection_anchor_pos = anchor_pos;
+ prev_context = context;
if (priv->needs_surrounding_text) {
GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)text);
--
2.37.3

View File

@ -39,7 +39,7 @@
Name: ibus
Version: 1.5.27
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -521,6 +521,10 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Mon Sep 19 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.27-3
- Update ibus_input_context_set_surrounding_text for a global IC
- Fix CI
* Fri Sep 16 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.27-2
- Resolves: #2093313 Stop many warnings of surrounding text
- Fix other surrounding text issues