[gnome-shell] keyboard: Fix display keyboard layout crash with some input methods
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] keyboard: Fix display keyboard layout crash with some input methods
- Date: Mon, 29 Mar 2021 09:37:09 +0000 (UTC)
commit f563424417c2c77c8483efb795da48b43ab30abb
Author: Peng Wu <pwu redhat com>
Date: Mon Mar 15 14:50:31 2021 +0800
keyboard: Fix display keyboard layout crash with some input methods
Some ibus input method will use the current keyboard layout,
and return "default" as the keyboard layout.
When this happens, display the current keyboard layout instead.
Fixes #3863.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1756>
js/misc/keyboardManager.js | 4 ++++
js/ui/status/keyboard.js | 12 ++++++++++++
2 files changed, 16 insertions(+)
---
diff --git a/js/misc/keyboardManager.js b/js/misc/keyboardManager.js
index 29fc3b7615..142e2f4198 100644
--- a/js/misc/keyboardManager.js
+++ b/js/misc/keyboardManager.js
@@ -156,4 +156,8 @@ var KeyboardManager = class {
let options = this._xkbOptions.join(',');
return options;
}
+
+ get currentLayout() {
+ return this._current;
+ }
};
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index e34b603134..bc50f3d376 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -772,6 +772,10 @@ var InputSourceManager = class {
get inputSources() {
return this._inputSources;
}
+
+ get keyboardManager() {
+ return this._keyboardManager;
+ }
};
Signals.addSignalMethods(InputSourceManager.prototype);
@@ -1059,6 +1063,14 @@ class InputSourceIndicator extends PanelMenu.Button {
xkbLayout = engineDesc.get_layout();
xkbVariant = engineDesc.get_layout_variant();
}
+
+ // The `default` layout from ibus engine means to
+ // use the current keyboard layout.
+ if (xkbLayout === 'default') {
+ const current = this._inputSourceManager.keyboardManager.currentLayout;
+ xkbLayout = current.layout;
+ xkbVariant = current.variant;
+ }
}
if (!xkbLayout || xkbLayout.length == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]