[gnome-shell/wip/rstrode/rhel-8.0.0: 40/50] keyboardManager: Avoid idempotent calls to meta_backend_set_keymap()
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/rhel-8.0.0: 40/50] keyboardManager: Avoid idempotent calls to meta_backend_set_keymap()
- Date: Sun, 17 Feb 2019 17:32:12 +0000 (UTC)
commit 26589af1539f70c7bd932160d8afa0bca2c9d8f2
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Oct 23 00:06:36 2018 +0200
keyboardManager: Avoid idempotent calls to meta_backend_set_keymap()
But still try to apply the keymap whenever the input sources changed. This
is a different approach to gnome-shell#240 that still avoid redundant
changes to the current keymap, but actually trigger one when input sources
are added.
https://bugzilla.redhat.com/show_bug.cgi?id=1637418
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/691
js/misc/keyboardManager.js | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/js/misc/keyboardManager.js b/js/misc/keyboardManager.js
index ae59f0014..f4001f130 100644
--- a/js/misc/keyboardManager.js
+++ b/js/misc/keyboardManager.js
@@ -52,11 +52,20 @@ var KeyboardManager = new Lang.Class({
this._current = null;
this._localeLayoutInfo = this._getLocaleLayout();
this._layoutInfos = {};
+ this._currentKeymap = null;
},
_applyLayoutGroup(group) {
let options = this._buildOptionsString();
let [layouts, variants] = this._buildGroupStrings(group);
+
+ if (this._currentKeymap &&
+ this._currentKeymap.layouts == layouts &&
+ this._currentKeymap.variants == variants &&
+ this._currentKeymap.options == options)
+ return;
+
+ this._currentKeymap = {layouts, variants, options};
Meta.get_backend().set_keymap(layouts, variants, options);
},
@@ -89,8 +98,6 @@ var KeyboardManager = new Lang.Class({
},
setUserLayouts(ids) {
- let currentId = this._current ? this._current.id : null;
- let currentGroupIndex = this._current ? this._current.groupIndex : null;
this._current = null;
this._layoutInfos = {};
@@ -117,9 +124,6 @@ var KeyboardManager = new Lang.Class({
info.group = group;
info.groupIndex = groupIndex;
- if (currentId == id && currentGroupIndex == groupIndex)
- this._current = info;
-
i += 1;
}
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]