ibusManager: Simplify code and logic for setEngine()
Reword names, functions and refactor code to make code execution logic simpler to understand. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3439>
This commit is contained in:
parent
961ca226bd
commit
39a3da654d
@ -294,18 +294,23 @@ class IBusManager extends Signals.EventEmitter {
|
|||||||
|
|
||||||
async setEngine(id) {
|
async setEngine(id) {
|
||||||
if (this._oskCompletion)
|
if (this._oskCompletion)
|
||||||
this._preOskEngine = id;
|
await this._maybeUpdateCompletion(id);
|
||||||
|
|
||||||
const isXkb = id.startsWith('xkb:');
|
|
||||||
if (this._oskCompletion && isXkb)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (this._oskCompletion)
|
|
||||||
await this.setCompletionEnabled(false);
|
|
||||||
else
|
else
|
||||||
await this._setEngine(id);
|
await this._setEngine(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async _maybeUpdateCompletion(id) {
|
||||||
|
if (!this._oskCompletion)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._preOskEngine = id;
|
||||||
|
const isXkb = id.startsWith('xkb:');
|
||||||
|
|
||||||
|
/* Non xkb engines conflict with completion */
|
||||||
|
if (!isXkb)
|
||||||
|
await this.setCompletionEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
preloadEngines(ids) {
|
preloadEngines(ids) {
|
||||||
if (!this._ibus || !this._ready)
|
if (!this._ibus || !this._ready)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user