summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2022-09-21 21:08:31 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2022-09-21 21:08:31 +0900
commit781119be4f646f06197badb73398a41d5acca787 (patch)
tree6f604a8eb8143ea304051e9ddeb46c6dac1cd360
parent8d0abbcbcef9a4fda706c70f12f4f596728bf90b (diff)
downloadibus-781119be4f646f06197badb73398a41d5acca787.tar.gz
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
-rw-r--r--client/gtk2/ibusimcontext.c10
1 files 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 ());