From a93858b862502759f55334f98f0d856fdb9d0c57 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 26 Jan 2024 12:02:30 +0100 Subject: [PATCH] keyboard: Simplify key width handling We do not need to store the key width in the Key object itself when constructing the layout, and can attach it to the grid from the model data right away. Part-of: --- js/ui/keyboard.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 38f1b8ee3..fb83db7e9 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -437,7 +437,6 @@ const Key = GObject.registerClass({ button.set_label(commitString); } - button.keyWidth = 1; button.connect('button-press-event', () => { this._press(button, commitString); button.add_style_pseudo_class('active'); @@ -505,10 +504,6 @@ const Key = GObject.registerClass({ return this._boxPointer; } - setWidth(width) { - this.keyButton.keyWidth = width; - } - setLatched(latched) { if (latched) this.keyButton.add_style_pseudo_class('latched'); @@ -1528,9 +1523,6 @@ export const Keyboard = GObject.registerClass({ keyval: key.keyval, }, strings); - if (key.width !== null) - button.setWidth(key.width); - if (key.action !== 'modifier') { button.connect('commit', (_actor, keyval, str) => { this._commitAction(keyval, str).then(() => { @@ -1590,7 +1582,7 @@ export const Keyboard = GObject.registerClass({ if (key.action || key.keyval) button.keyButton.add_style_class_name('default-key'); - layout.appendKey(button, button.keyButton.keyWidth); + layout.appendKey(button, key.width); } }