keyboard: Forward input purpose from KeyboardController

Instead of adding more emoji/keypad signals, forward the input
purpose, so that in future commits the Keyboard object can figure
out the right layout from the purpose hint.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3162>
This commit is contained in:
Carlos Garnacho 2024-01-26 16:20:30 +01:00
parent 8673758336
commit 173d70dc70

View File

@ -1421,6 +1421,7 @@ export const Keyboard = GObject.registerClass({
'active-group', this._onGroupChanged.bind(this),
'groups-changed', this._onKeyboardGroupsChanged.bind(this),
'panel-state', this._onKeyboardStateChanged.bind(this),
'purpose-changed', this._onPurposeChanged.bind(this),
'keypad-visible', this._onKeypadVisible.bind(this),
this);
global.stage.connectObject('notify::key-focus',
@ -1434,6 +1435,11 @@ export const Keyboard = GObject.registerClass({
this._relayout();
}
_onPurposeChanged(controller, purpose) {
this._purpose = purpose;
this._updateKeys();
}
_onKeyFocusChanged() {
let focus = global.stage.key_focus;
@ -2198,6 +2204,7 @@ class KeyboardController extends Signals.EventEmitter {
this.emit('emoji-visible', emojiVisible);
this.emit('keypad-visible', keypadVisible);
this.emit('purpose-changed', purpose);
}
getGroups() {