diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch index e69de29..798101a 100644 --- a/ibus-HEAD.patch +++ b/ibus-HEAD.patch @@ -0,0 +1,295 @@ +From babad7839ba6d72609c717d647bb2928724b4cc3 Mon Sep 17 00:00:00 2001 +From: Izumi Tsutsui +Date: Tue, 6 Sep 2022 17:08:43 +0900 +Subject: [PATCH] tools: Check libdl for dlclose() properly in configure + +BUG=https://github.com/ibus/ibus/pull/2442 +--- + configure.ac | 4 ++++ + tools/Makefile.am | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 0868d6c9..2344523a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -147,6 +147,10 @@ AC_CHECK_HEADERS([sys/prctl.h]) + # Check functions. + AC_CHECK_FUNCS(daemon) + ++# Check dlclose() in libc.so. ++AC_CHECK_LIB(c, dlclose, LIBDL="", [AC_CHECK_LIB(dl, dlclose, LIBDL="-ldl")]) ++AC_SUBST(LIBDL) ++ + # Check packages. + # Check glib2. + AM_PATH_GLIB_2_0 +diff --git a/tools/Makefile.am b/tools/Makefile.am +index b82395da..e300f9f3 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -63,7 +63,7 @@ AM_LDADD = \ + @GTHREAD2_LIBS@ \ + $(libibus) \ + $(libibusimmodule) \ +- -ldl \ ++ $(LIBDL) \ + $(NULL) + + AM_VALAFLAGS = \ +-- +2.37.3 + +From 39b69073ad34ab89a3e5aa012ff740c84f69eb8f Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Fri, 16 Sep 2022 14:30:35 +0900 +Subject: [PATCH] client/gtk2: Stop many warnings of surrounding text + +Surrounding text is requested by ibus_im_context_filter_keypress() +and the no supported warning could be output many times. +Now the warning is output one time by input context but +brower applicaations do not use GtkWidget for the input context +so the warning is output by instance but not input context. + +BUG=https://github.com/ibus/ibus/issues/2418 +--- + client/gtk2/ibusimcontext.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index bc14df00..3fc9c0f2 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -567,6 +567,7 @@ _process_key_event (IBusInputContext *context, + static void + _request_surrounding_text (IBusIMContext *context) + { ++ static gboolean warned = FALSE; + if (context && + (context->caps & IBUS_CAP_SURROUNDING_TEXT) != 0 && + context->ibuscontext != NULL && +@@ -580,8 +581,11 @@ _request_surrounding_text (IBusIMContext *context) + * fail with the first typing on firefox but it succeeds with + * the second typing. + */ +- g_warning ("%s has no capability of surrounding-text feature", +- g_get_prgname ()); ++ if (!warned) { ++ g_warning ("%s has no capability of surrounding-text feature", ++ g_get_prgname ()); ++ warned = TRUE; ++ } + } + } + } +-- +2.37.3 + +From 50f8d8b79bc8eac1bae80116fe669d7314a44663 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Fri, 16 Sep 2022 14:34:54 +0900 +Subject: [PATCH] client/gtk2: Update capabilities if "retrieve-surrounding" is + failed + +Some engine developers wish to update the capabilities if emitting +"retrieve-surrounding" signal is failed so that engines disable the +surrounding text feature but I had deleted the logic with #2054 since +the second typing could be succeeded. +Asking all applications the second typing would not be a good condition +and the special issue should be fixed in firefox. + +Fixes: https://github.com/ibus/ibus/commit/7b3b8c8b0c + +BUG=https://github.com/ibus/ibus/issues/2054 +BUG=https://github.com/ibus/ibus/issues/2354 +--- + client/gtk2/ibusimcontext.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index 3fc9c0f2..eaf7eb90 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -577,10 +577,14 @@ _request_surrounding_text (IBusIMContext *context) + g_signal_emit (context, _signal_retrieve_surrounding_id, 0, + &return_value); + if (!return_value) { +- /* #2054 firefox::IMContextWrapper::GetCurrentParagraph() could +- * fail with the first typing on firefox but it succeeds with +- * the second typing. ++ /* Engines can disable the surrounding text feature with ++ * the updated capabilities. + */ ++ if (context->caps & IBUS_CAP_SURROUNDING_TEXT) { ++ context->caps &= ~IBUS_CAP_SURROUNDING_TEXT; ++ ibus_input_context_set_capabilities (context->ibuscontext, ++ context->caps); ++ } + if (!warned) { + g_warning ("%s has no capability of surrounding-text feature", + g_get_prgname ()); +-- +2.37.3 + +From 483abb429fed4c51e214fa6c1efbb54ca73d5b28 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Fri, 16 Sep 2022 14:50:53 +0900 +Subject: [PATCH] client/gtk2: Update surrounding text properties by focus in + +ibus_input_context_set_surrounding_text() should be succeeded +if input contexts are different so that ibus engines can +update surrounding text properties with focus in event. + +When an input context is created newly, RequireSurroundingText D-Bus +signal could not be received yet and set_surrounding_text() is failed. +Now "require-surrounding-text" signal is added to IBusInputContext +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(-) + +diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c +index eaf7eb90..6e338157 100644 +--- a/client/gtk2/ibusimcontext.c ++++ b/client/gtk2/ibusimcontext.c +@@ -70,6 +70,7 @@ struct _IBusIMContext { + #endif + + IBusInputContext *ibuscontext; ++ IBusInputContext *ibuscontext_needs_surrounding; + + /* preedit status */ + gchar *preedit_string; +@@ -985,6 +986,7 @@ ibus_im_context_init (GObject *obj) + ibusimcontext->cursor_area.height = 0; + + ibusimcontext->ibuscontext = NULL; ++ ibusimcontext->ibuscontext_needs_surrounding = NULL; + ibusimcontext->has_focus = FALSE; + ibusimcontext->time = GDK_CURRENT_TIME; + #ifdef ENABLE_SURROUNDING +@@ -2183,6 +2185,18 @@ _ibus_context_hide_preedit_text_cb (IBusInputContext *ibuscontext, + g_signal_emit (ibusimcontext, _signal_preedit_end_id, 0); + } + ++static void ++_ibus_context_require_surrounding_text_cb (IBusInputContext *ibuscontext, ++ IBusIMContext *ibusimcontext) ++{ ++ IDEBUG ("%s", __FUNCTION__); ++ g_assert (ibusimcontext->ibuscontext == ibuscontext); ++ if (ibusimcontext->ibuscontext_needs_surrounding == ibuscontext) { ++ _request_surrounding_text (ibusimcontext); ++ ibusimcontext->ibuscontext_needs_surrounding = NULL; ++ } ++} ++ + static void + _ibus_context_destroy_cb (IBusInputContext *ibuscontext, + IBusIMContext *ibusimcontext) +@@ -2249,6 +2263,11 @@ _create_input_context_done (IBusBus *bus, + "hide-preedit-text", + G_CALLBACK (_ibus_context_hide_preedit_text_cb), + ibusimcontext); ++ g_signal_connect ( ++ ibusimcontext->ibuscontext, ++ "require-surrounding-text", ++ G_CALLBACK (_ibus_context_require_surrounding_text_cb), ++ ibusimcontext); + g_signal_connect (ibusimcontext->ibuscontext, "destroy", + G_CALLBACK (_ibus_context_destroy_cb), + ibusimcontext); +@@ -2265,6 +2284,12 @@ _create_input_context_done (IBusBus *bus, + + ibus_input_context_focus_in (ibusimcontext->ibuscontext); + _set_cursor_location_internal (ibusimcontext); ++ if (ibus_input_context_needs_surrounding_text ( ++ ibusimcontext->ibuscontext)) { ++ _request_surrounding_text (ibusimcontext); ++ } else { ++ ibusimcontext->ibuscontext_needs_surrounding = ibusimcontext->ibuscontext; ++ } + } + + if (!g_queue_is_empty (ibusimcontext->events_queue)) { +diff --git a/src/ibusinputcontext.c b/src/ibusinputcontext.c +index 7981de38..ed887dde 100644 +--- a/src/ibusinputcontext.c ++++ b/src/ibusinputcontext.c +@@ -2,7 +2,7 @@ + /* vim:set et sts=4: */ + /* ibus - The Input Bus + * Copyright (C) 2008-2013 Peng Huang +- * Copyright (C) 2018-2019 Takao Fujiwara ++ * Copyright (C) 2018-2022 Takao Fujiwara + * Copyright (C) 2008-2019 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or +@@ -55,6 +55,7 @@ enum { + CURSOR_DOWN_LOOKUP_TABLE, + REGISTER_PROPERTIES, + UPDATE_PROPERTY, ++ REQUIRE_SURROUNDING_TEXT, + LAST_SIGNAL, + }; + +@@ -488,6 +489,21 @@ ibus_input_context_class_init (IBusInputContextClass *class) + 1, + IBUS_TYPE_PROPERTY); + ++ /** ++ * IBusInputContext::require-surrounding-text: ++ * @context: An IBusInputContext. ++ * ++ * Emitted to receive the RequireSurroundingText signal from the daemon. ++ */ ++ context_signals[REQUIRE_SURROUNDING_TEXT] = ++ g_signal_new (I_("require-surrounding-text"), ++ G_TYPE_FROM_CLASS (class), ++ G_SIGNAL_RUN_LAST, ++ 0, ++ NULL, NULL, ++ _ibus_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ + text_empty = ibus_text_new_from_static_string (""); + g_object_ref_sink (text_empty); + } +@@ -735,6 +751,7 @@ ibus_input_context_g_signal (GDBusProxy *proxy, + + if (g_strcmp0 (signal_name, "RequireSurroundingText") == 0) { + priv->needs_surrounding_text = TRUE; ++ g_signal_emit (context, context_signals[REQUIRE_SURROUNDING_TEXT], 0); + 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; + + g_assert (IBUS_IS_INPUT_CONTEXT (context)); +@@ -1119,12 +1137,14 @@ ibus_input_context_set_surrounding_text (IBusInputContext *context, + 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) { + 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 + diff --git a/ibus.spec b/ibus.spec index d76ae83..3a7db6b 100644 --- a/ibus.spec +++ b/ibus.spec @@ -39,7 +39,7 @@ Name: ibus Version: 1.5.27 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ URL: https://github.com/ibus/%name/wiki @@ -47,6 +47,7 @@ Source0: https://github.com/ibus/%name/releases/download/%{version}/%{nam Source1: %{name}-xinput Source2: %{name}.conf.5 # Patch0: %%{name}-HEAD.patch +Patch0: %{name}-HEAD.patch # Under testing #1349148 #1385349 #1350291 #1406699 #1432252 #1601577 Patch1: %{name}-1385349-segv-bus-proxy.patch %if 0%{?fedora:0}%{?rhel:1} @@ -277,6 +278,8 @@ the functionality of the installed %{name} package. # cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c || : # cp client/gtk2/ibusim.c client/gtk3/ibusim.c || : # cp client/gtk2/ibusimcontext.c client/gtk4/ibusimcontext.c || : +cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c || : +cp client/gtk2/ibusimcontext.c client/gtk4/ibusimcontext.c || : # prep test @@ -518,6 +521,10 @@ dconf update || : %{_datadir}/installed-tests/ibus %changelog +* Fri Sep 16 2022 Takao Fujiwara - 1.5.27-2 +- Resolves: #2093313 Stop many warnings of surrounding text +- Fix other surrounding text issues + * Tue Aug 23 2022 Takao Fujiwara - 1.5.27-1 - Bump to 1.5.27