From 173d70dc7064f424c9ccf67690a4b283e51b218b Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 26 Jan 2024 16:20:30 +0100 Subject: [PATCH] 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: --- js/ui/keyboard.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 0c68a5971..224e74f97 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -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() {