keyboard: Avoid using key.label for anything else than presentation

Do the finicky checks to adjust key widths and whatnot based on other
values than the label. This makes the label exclusively used for
presentation (i.e. setting up a St.Label).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/46
This commit is contained in:
Carlos Garnacho 2018-02-15 13:23:54 +01:00
parent 5f6745cad0
commit 9cf2ec8bd2

View File

@ -849,7 +849,8 @@ var Keyboard = new Lang.Class({
} }
/* Fixup default keys based on the number of levels/keys */ /* Fixup default keys based on the number of levels/keys */
if (key.label == '⇧' && numLevels == 3) { if (switchToLevel == 1 && numLevels == 3) {
// Hide shift key if the keymap has no uppercase level
if (key.right) { if (key.right) {
/* Only hide the key actor, so the container still takes space */ /* Only hide the key actor, so the container still takes space */
extraButton.keyButton.hide(); extraButton.keyButton.hide();
@ -859,7 +860,7 @@ var Keyboard = new Lang.Class({
extraButton.setWidth(1.5); extraButton.setWidth(1.5);
} else if (key.right && numKeys > 8) { } else if (key.right && numKeys > 8) {
extraButton.setWidth(2); extraButton.setWidth(2);
} else if (key.label == '⏎' && numKeys > 9) { } else if (keyval == Clutter.KEY_Return && numKeys > 9) {
extraButton.setWidth(1.5); extraButton.setWidth(1.5);
} }