summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-07-27 16:52:32 +0200
committerCarlos Garnacho <carlosg@gnome.org>2021-09-01 20:47:20 +0200
commit92963a01a57060263b5119380e70fe083cfa535e (patch)
tree490cf9e5438ed649ff2a3a866d1dce6f94ffb62a
parent757e766a111d2babb0a693e6a07b2d06ab0499ae (diff)
downloadgnome-shell-wip/carlosg/im-update-preedit-with-mode.tar.gz
inputMethod: Use update-preedit-with-mode signalwip/carlosg/im-update-preedit-with-mode
This signal announces the preferred commit mode of the preedit text when the input context is reset. Keep this mode around, and ensure to honor this mode (e.g. maybe commit the preedit string) whenever the input method would be reset. This is delegated to the internal layers, so propagate this mode via clutter_input_method_set_preedit_text().
-rw-r--r--js/misc/inputMethod.js28
-rw-r--r--meson.build2
2 files changed, 16 insertions, 14 deletions
diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index 0bc1462ef..25b02e35b 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -62,9 +62,10 @@ class InputMethod extends Clutter.InputMethod {
return;
}
+ this._context.set_client_commit_preedit(true);
this._context.connect('commit-text', this._onCommitText.bind(this));
this._context.connect('delete-surrounding-text', this._onDeleteSurroundingText.bind(this));
- this._context.connect('update-preedit-text', this._onUpdatePreeditText.bind(this));
+ this._context.connect('update-preedit-text-with-mode', this._onUpdatePreeditText.bind(this));
this._context.connect('show-preedit-text', this._onShowPreeditText.bind(this));
this._context.connect('hide-preedit-text', this._onHidePreeditText.bind(this));
this._context.connect('forward-key-event', this._onForwardKeyEvent.bind(this));
@@ -105,29 +106,30 @@ class InputMethod extends Clutter.InputMethod {
}
}
- _onUpdatePreeditText(_context, text, pos, visible) {
+ _onUpdatePreeditText(_context, text, pos, visible, mode) {
if (text == null)
return;
let preedit = text.get_text();
if (visible)
- this.set_preedit_text(preedit, pos);
+ this.set_preedit_text(preedit, pos, mode);
else if (this._preeditVisible)
- this.set_preedit_text(null, pos);
+ this.set_preedit_text(null, pos, mode);
this._preeditStr = preedit;
this._preeditPos = pos;
this._preeditVisible = visible;
+ this._preeditCommitMode = mode;
}
_onShowPreeditText() {
this._preeditVisible = true;
- this.set_preedit_text(this._preeditStr, this._preeditPos);
+ this.set_preedit_text(this._preeditStr, this._preeditPos, this._preeditCommitMode);
}
_onHidePreeditText() {
- this.set_preedit_text(null, this._preeditPos);
+ this.set_preedit_text(null, this._preeditPos, this._preeditCommitMode);
this._preeditVisible = false;
}
@@ -165,7 +167,7 @@ class InputMethod extends Clutter.InputMethod {
if (this._preeditStr) {
// Unset any preedit text
- this.set_preedit_text(null, 0);
+ this.set_preedit_text(null, 0, this._preeditCommitMode);
this._preeditStr = null;
}
@@ -177,16 +179,16 @@ class InputMethod extends Clutter.InputMethod {
}
vfunc_reset() {
+ if (this._preeditStr !== null) {
+ // Unset any preedit text
+ this.set_preedit_text(null, 0, Clutter.PreeditResetMode.CLEAR);
+ this._preeditStr = null;
+ }
+
if (this._context) {
this._context.reset();
this._emitRequestSurrounding();
}
-
- if (this._preeditStr) {
- // Unset any preedit text
- this.set_preedit_text(null, 0);
- this._preeditStr = null;
- }
}
vfunc_set_cursor_location(rect) {
diff --git a/meson.build b/meson.build
index 41f5b02a3..5c891a504 100644
--- a/meson.build
+++ b/meson.build
@@ -30,7 +30,7 @@ mutter_req = '>= 41.beta'
polkit_req = '>= 0.100'
schemas_req = '>= 41.alpha'
startup_req = '>= 0.11'
-ibus_req = '>= 1.5.2'
+ibus_req = '>= 1.5.19'
gnome_desktop_req = '>= 3.35.90'
bt_req = '>= 3.9.0'