Blame SOURCES/0001-keyboardManager-Avoid-idempotent-calls-to-meta_backe.patch

c7fac9
From d9f64462b40125d5b1728c6d276811d6c4bbfb80 Mon Sep 17 00:00:00 2001
c7fac9
From: Carlos Garnacho <carlosg@gnome.org>
c7fac9
Date: Tue, 23 Oct 2018 00:06:36 +0200
c7fac9
Subject: [PATCH] keyboardManager: Avoid idempotent calls to
c7fac9
 meta_backend_set_keymap()
c7fac9
c7fac9
But still try to apply the keymap whenever the input sources changed. This
c7fac9
is a different approach to gnome-shell#240 that still avoid redundant
c7fac9
changes to the current keymap, but actually trigger one when input sources
c7fac9
are added.
c7fac9
c7fac9
https://bugzilla.redhat.com/show_bug.cgi?id=1637418
c7fac9
c7fac9
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/691
c7fac9
---
c7fac9
 js/misc/keyboardManager.js | 14 +++++++++-----
c7fac9
 1 file changed, 9 insertions(+), 5 deletions(-)
c7fac9
c7fac9
diff --git a/js/misc/keyboardManager.js b/js/misc/keyboardManager.js
c7fac9
index ae59f0014..f4001f130 100644
c7fac9
--- a/js/misc/keyboardManager.js
c7fac9
+++ b/js/misc/keyboardManager.js
c7fac9
@@ -52,11 +52,20 @@ var KeyboardManager = new Lang.Class({
c7fac9
         this._current = null;
c7fac9
         this._localeLayoutInfo = this._getLocaleLayout();
c7fac9
         this._layoutInfos = {};
c7fac9
+        this._currentKeymap = null;
c7fac9
     },
c7fac9
 
c7fac9
     _applyLayoutGroup(group) {
c7fac9
         let options = this._buildOptionsString();
c7fac9
         let [layouts, variants] = this._buildGroupStrings(group);
c7fac9
+
c7fac9
+        if (this._currentKeymap &&
c7fac9
+            this._currentKeymap.layouts == layouts &&
c7fac9
+            this._currentKeymap.variants == variants &&
c7fac9
+            this._currentKeymap.options == options)
c7fac9
+            return;
c7fac9
+
c7fac9
+        this._currentKeymap = {layouts, variants, options};
c7fac9
         Meta.get_backend().set_keymap(layouts, variants, options);
c7fac9
     },
c7fac9
 
c7fac9
@@ -89,8 +98,6 @@ var KeyboardManager = new Lang.Class({
c7fac9
     },
c7fac9
 
c7fac9
     setUserLayouts(ids) {
c7fac9
-        let currentId = this._current ? this._current.id : null;
c7fac9
-        let currentGroupIndex = this._current ? this._current.groupIndex : null;
c7fac9
         this._current = null;
c7fac9
         this._layoutInfos = {};
c7fac9
 
c7fac9
@@ -117,9 +124,6 @@ var KeyboardManager = new Lang.Class({
c7fac9
             info.group = group;
c7fac9
             info.groupIndex = groupIndex;
c7fac9
 
c7fac9
-            if (currentId == id && currentGroupIndex == groupIndex)
c7fac9
-                this._current = info;
c7fac9
-
c7fac9
             i += 1;
c7fac9
         }
c7fac9
     },
c7fac9
-- 
c7fac9
2.20.1
c7fac9