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
Part-of:
<https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2668>
(cherry picked from commit 1cfaa2379d)
This commit is contained in:
Takao Fujiwara 2023-03-03 17:50:10 +09:00 committed by Florian Müllner
parent 0ea25ebb95
commit 6ae2c2f2b4

View file

@ -12,6 +12,8 @@ Gio._promisify(IBus.InputContext.prototype,
var HIDE_PANEL_TIME = 50;
const HAVE_REQUIRE_SURROUNDING_TEXT = GObject.signal_lookup('require-surrounding-text', IBus.InputContext);
var InputMethod = GObject.registerClass({
Signals: {
'surrounding-text-set': {},
@ -76,7 +78,6 @@ 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));
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));
@ -84,6 +85,9 @@ var InputMethod = GObject.registerClass({
this._context.connect('forward-key-event', this._onForwardKeyEvent.bind(this));
this._context.connect('destroy', this._clear.bind(this));
if (HAVE_REQUIRE_SURROUNDING_TEXT)
this._context.connect('require-surrounding-text', this._onRequireSurroundingText.bind(this));
Main.keyboard.connectObject('visibility-changed', () => this._updateCapabilities());
this._updateCapabilities();