[gnome-shell/wip/carlosg/fix-issue-46: 5/8] keyboard: Avoid using key.label for anything else than presentation



commit 9cf2ec8bd2a3552afc622823cca7599bbcaa8926
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Feb 15 13:23:54 2018 +0100

    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

 js/ui/keyboard.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 37e86fdb7..a830fdd05 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -849,7 +849,8 @@ var Keyboard = new Lang.Class({
             }
 
             /* 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) {
                     /* Only hide the key actor, so the container still takes space */
                     extraButton.keyButton.hide();
@@ -859,7 +860,7 @@ var Keyboard = new Lang.Class({
                 extraButton.setWidth(1.5);
             } else if (key.right && numKeys > 8) {
                 extraButton.setWidth(2);
-            } else if (key.label == '⏎' && numKeys > 9) {
+            } else if (keyval == Clutter.KEY_Return && numKeys > 9) {
                 extraButton.setWidth(1.5);
             }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]