[gnome-shell] keyboard: Only rebuild keyboard actor on keyboard type changes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] keyboard: Only rebuild keyboard actor on keyboard type changes
- Date: Sun, 23 Jul 2017 14:30:00 +0000 (UTC)
commit 08ad345f234ae7af4798da9aa60c35f37208d02f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jul 23 13:51:11 2017 +0200
keyboard: Only rebuild keyboard actor on keyboard type changes
About every other situation can do with synchronizing keyboard visibility,
and keyboard layout changes are already handled internally in the Keyboard
object.
A downside of this approach is that once created, there will always be a
Keyboard instance and its full actor hierarchy. Seems reasonable to do that
since we can't tell it won't ever be needed.
https://bugzilla.gnome.org/show_bug.cgi?id=785309
js/ui/keyboard.js | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index a0732f5..da36c36 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -171,7 +171,7 @@ var Keyboard = new Lang.Class({
this._keyboardSettings = new Gio.Settings({ schema_id: KEYBOARD_SCHEMA });
this._keyboardSettings.connect('changed', Lang.bind(this, this._sync));
this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA });
- this._a11yApplicationsSettings.connect('changed', Lang.bind(this, this._sync));
+ this._a11yApplicationsSettings.connect('changed', Lang.bind(this, this._syncEnabled));
this._lastDeviceId = null;
Caribou.DisplayAdapter.set_default(new LocalAdapter());
@@ -183,7 +183,7 @@ var Keyboard = new Lang.Class({
if (device.get_device_name().indexOf('XTEST') < 0) {
this._lastDeviceId = deviceId;
- this._sync();
+ this._syncEnabled();
}
}));
this._sync();
@@ -304,24 +304,32 @@ var Keyboard = new Lang.Class({
return device.get_device_type() == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
},
- _sync: function () {
+ _syncEnabled: function () {
this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD) ||
this._lastDeviceIsTouchscreen();
if (!this._enableKeyboard && !this._keyboard)
return;
- if (this._enableKeyboard && this._keyboard &&
- this._keyboard.keyboard_type == this._keyboardSettings.get_string(KEYBOARD_TYPE))
- return;
this._setCaretTrackerEnabled(this._enableKeyboard);
- if (this._keyboard)
- this._destroyKeyboard();
+ if (this._enableKeyboard) {
+ if (!this._keyboard)
+ this._setupKeyboard();
+ else
+ Main.layoutManager.showKeyboard();
+ } else {
+ Main.layoutManager.hideKeyboard(true);
+ }
+ },
- if (this._enableKeyboard)
+ _sync: function () {
+ if (this._keyboard &&
+ this._keyboard.keyboard_type != this._keyboardSettings.get_string(KEYBOARD_TYPE)) {
+ this._destroyKeyboard();
this._setupKeyboard();
- else
- Main.layoutManager.hideKeyboard(true);
+ }
+
+ this._syncEnabled();
},
_destroyKeyboard: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]