[gnome-shell/wip/carlosg/osk-updates: 25/33] inputMethod: Add signal/getter for surrounding text updates
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-updates: 25/33] inputMethod: Add signal/getter for surrounding text updates
- Date: Tue, 26 Apr 2022 12:17:52 +0000 (UTC)
commit 17411b9e48688e222314672c24833062725fd5c2
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Apr 20 23:16:38 2022 +0200
inputMethod: Add signal/getter for surrounding text updates
We need to keep track of those at places, add a signal and getter
so that this information can be accessed from the OSK.
js/misc/inputMethod.js | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index 8c3cd61aeb..361c08b6a8 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -9,8 +9,11 @@ Gio._promisify(IBus.Bus.prototype,
var HIDE_PANEL_TIME = 50;
-var InputMethod = GObject.registerClass(
-class InputMethod extends Clutter.InputMethod {
+var InputMethod = GObject.registerClass({
+ Signals: {
+ 'surrounding-text-updated': {},
+ },
+}, class InputMethod extends Clutter.InputMethod {
_init() {
super._init();
this._hints = 0;
@@ -186,6 +189,8 @@ class InputMethod extends Clutter.InputMethod {
this._emitRequestSurrounding();
}
+ this._surroundingText = null;
+ this._surroundingTextCursor = null;
this._preeditStr = null;
}
@@ -198,6 +203,10 @@ class InputMethod extends Clutter.InputMethod {
}
vfunc_set_surrounding(text, cursor, anchor) {
+ this._surroundingText = text;
+ this._surroundingTextCursor = cursor;
+ this.emit('surrounding-text-updated');
+
if (!this._context || !text)
return;
@@ -282,4 +291,8 @@ class InputMethod extends Clutter.InputMethod {
});
return true;
}
+
+ getSurroundingText() {
+ return [this._surroundingText, this._surroundingTextCursor];
+ }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]