From d7322e61a9882edc722ac64da80804e75f832155 Mon Sep 17 00:00:00 2001
From: Takao Fujiwara <tfujiwar@redhat.com>
Date: Fri, 3 Mar 2023 17:50:10 +0900
Subject: [PATCH] inputMethod: Try to connect require-surrounding-text signal

require-surrounding-text signal has been added since IBus 1.5.28.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6405
---
 js/misc/inputMethod.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index e008e6411..aa610b3bf 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -76,7 +76,11 @@ var InputMethod = GObject.registerClass({
 
         this._context.set_client_commit_preedit(true);
         this._context.connect('commit-text', this._onCommitText.bind(this));
-        this._context.connect('require-surrounding-text', this._onRequireSurroundingText.bind(this));
+        try {
+            // Require ibus 1.5.28 or later.
+            this._context.connect('require-surrounding-text', this._onRequireSurroundingText.bind(this));
+        } catch (e) {
+        }
         this._context.connect('delete-surrounding-text', this._onDeleteSurroundingText.bind(this));
         this._context.connect('update-preedit-text-with-mode', this._onUpdatePreeditText.bind(this));
         this._context.connect('show-preedit-text', this._onShowPreeditText.bind(this));
-- 
GitLab

