diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2018-01-23 17:03:02 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-02-05 14:21:22 +0100 |
commit | 217679d49f437d83cc013dc49e925d3d07f60f16 (patch) | |
tree | b1311589511a88ae99e5829c9b9ffd2cec803ffb | |
parent | b552dbd6ae713843e09fd3b83effdaca9da9f370 (diff) | |
download | gnome-shell-wip/carlosg/osk-cldr.tar.gz |
keyboard: Do not create widgetry for all keyboard groups at oncewip/carlosg/osk-cldr
Instead do this on demand based on the current group. It is less
taxing at the time of initially creating the Keyboard object.
-rw-r--r-- | js/ui/keyboard.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 8fe392f0a..605af3b56 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -680,7 +680,8 @@ var Keyboard = new Lang.Class({ { x_align: St.Align.MIDDLE, x_fill: false }); - this._addKeys(); + this._ensureKeysForGroup(this._keyboardController.getCurrentGroup()); + this._setActiveLayer(0); // Keyboard models are defined in LTR, we must override // the locale setting in order to avoid flipping the @@ -744,14 +745,9 @@ var Keyboard = new Lang.Class({ return layers; }, - _addKeys: function () { - let groups = this._keyboardController.getGroups(); - for (let i = 0; i < groups.length; ++i) { - let gname = groups[i]; - this._groups[gname] = this._createLayersForGroup(gname); - } - - this._setActiveLayer(0); + _ensureKeysForGroup: function(group) { + if (!this._groups[group]) + this._groups[group] = this._createLayersForGroup(group); }, _addRowKeys : function (keys, layout) { @@ -911,6 +907,7 @@ var Keyboard = new Lang.Class({ }, _onGroupChanged: function () { + this._ensureKeysForGroup(this._keyboardController.getCurrentGroup()); this._setActiveLayer(0); }, |