Skip to content

Commit e51fb79

Browse files
committed
keyboardManager.js: Remove 'interactive' concept and update the
KeyboardManager when the layout list changes, not when a layout gets activated.
1 parent cbd5bd1 commit e51fb79

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

js/ui/keyboardManager.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ var InputSource = class {
203203
this.emit('changed');
204204
}
205205

206-
activate(interactive) {
207-
this.emit('activate', !!interactive);
206+
activate() {
207+
this.emit('activate');
208208
}
209209

210210
_getXkbId() {
@@ -568,7 +568,7 @@ var InputSourceManager = class {
568568
}
569569

570570
is = this._inputSources[nextIndex];
571-
is.activate(true);
571+
is.activate();
572572
return true;
573573
}
574574

@@ -602,13 +602,13 @@ var InputSourceManager = class {
602602

603603
try {
604604
let is = this._inputSources[index];
605-
this.activateInputSource(is, true);
605+
this.activateInputSource(is);
606606
} catch (e) {
607607
global.logError(`Could not activate input source index: ${index}`);
608608
}
609609
}
610610

611-
activateInputSource(is, interactive) {
611+
activateInputSource(is) {
612612
// The focus changes during holdKeyboard/releaseKeyboard may trick
613613
// the client into hiding UI containing the currently focused entry.
614614
// So holdKeyboard/releaseKeyboard are not called when
@@ -637,15 +637,6 @@ var InputSourceManager = class {
637637
else
638638
this._ibusManager.setEngine(engine);
639639
this._currentInputSourceChanged(is);
640-
641-
if (interactive) {
642-
global.log("INTERACTIVE");
643-
let sourcesList = [];
644-
for (let i in this._inputSources)
645-
sourcesList.push(this._inputSources[i]);
646-
647-
this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));
648-
}
649640
}
650641

651642
_inputSourcesChanged() {
@@ -762,9 +753,14 @@ var InputSourceManager = class {
762753
}
763754
}
764755

756+
let sourcesList = [];
757+
for (let i in this._inputSources)
758+
sourcesList.push(this._inputSources[i]);
759+
this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));
760+
765761
this.emit('sources-changed');
766762

767-
this._inputSources[0].activate(false);
763+
this._inputSources[0].activate();
768764

769765
// All ibus engines are preloaded here to reduce the launching time
770766
// when users switch the input sources.
@@ -874,7 +870,7 @@ var InputSourceManager = class {
874870
}
875871

876872
if (window._currentSource)
877-
window._currentSource.activate(false);
873+
window._currentSource.activate();
878874
}
879875

880876
_sourcesPerWindowChanged() {

0 commit comments

Comments
 (0)