[gnome-shell/wip/carlosg/osk-cldr: 45/45] keyboard: Do not create widgetry for all keyboard groups at once
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-cldr: 45/45] keyboard: Do not create widgetry for all keyboard groups at once
- Date: Thu, 25 Jan 2018 21:31:21 +0000 (UTC)
commit f8384d41a004990a779c00c615a8bc70fc6095f7
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 23 17:03:02 2018 +0100
keyboard: Do not create widgetry for all keyboard groups at once
Instead do this on demand based on the current group. It is less
taxing at the time of initially creating the Keyboard object.
js/ui/keyboard.js | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 0a3b0f9c1..9c05338fe 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -683,7 +683,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
@@ -743,14 +744,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) {
@@ -910,6 +906,7 @@ var Keyboard = new Lang.Class({
},
_onGroupChanged: function () {
+ this._ensureKeysForGroup(this._keyboardController.getCurrentGroup());
this._setActiveLayer(0);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]