[gnome-shell/gnome-3-28] keyboardManager: Preserve current keymap across reloads



commit 702338bc7d9e1715a965694508a39c9bb7bbaa22
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Apr 29 16:28:04 2018 +0200

    keyboardManager: Preserve current keymap across reloads
    
    The IM can pretty much update the input sources anytime (even if
    to set the same ones). That ends up triggering rebuilding all user
    defined keymaps, and losing modifier state if we are unfortunate
    enough that this caught us while pressing one.
    
    One common situation seems to be password entries, resulting in
    the wrong character being printed if the first character happens
    to require the shift key.
    
    If the current keymap is not found in the newly loaded list,
    this._current will end up null, with the same behavior as we get
    currently (immediate keymap reload).
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1569211
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/240
    
    Closes: #240

 js/misc/keyboardManager.js | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/js/misc/keyboardManager.js b/js/misc/keyboardManager.js
index b8984fe98..3f0bad282 100644
--- a/js/misc/keyboardManager.js
+++ b/js/misc/keyboardManager.js
@@ -89,6 +89,7 @@ var KeyboardManager = new Lang.Class({
     },
 
     setUserLayouts(ids) {
+        let currentId = this._current ? this._current.id : null;
         this._current = null;
         this._layoutInfos = {};
 
@@ -115,6 +116,9 @@ var KeyboardManager = new Lang.Class({
             info.group = group;
             info.groupIndex = groupIndex;
 
+            if (id == currentId)
+                this._current = info;
+
             i += 1;
         }
     },


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