From 23d3b716c72d036ae7030fb8335acf168ea32685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 13 Oct 2017 17:46:58 +0200 Subject: [PATCH] keyboard: Minor cleanup _syncEnabled() will call _setupKeyboard() if necessary, so no need to call it explicitly before. https://bugzilla.gnome.org/show_bug.cgi?id=788188 --- js/ui/keyboard.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index da36c3615..87635ce83 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -324,10 +324,8 @@ var Keyboard = new Lang.Class({ _sync: function () { if (this._keyboard && - this._keyboard.keyboard_type != this._keyboardSettings.get_string(KEYBOARD_TYPE)) { + this._keyboard.keyboard_type != this._keyboardSettings.get_string(KEYBOARD_TYPE)) this._destroyKeyboard(); - this._setupKeyboard(); - } this._syncEnabled(); }, -- 2.14.2From f20a30e3a6b4cf305a64780295bd6483461763a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 9 Oct 2017 12:51:08 +0200 Subject: [PATCH] keyboard: Split enabled setting from enabled state We enable the keyboard when it is either enabled explicitly via a11y settings or when using a touch device. We'll soon want to special-case changes to the GSettings, so track its value in a dedicated property. https://bugzilla.gnome.org/show_bug.cgi?id=788188 --- js/ui/keyboard.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 87635ce83..771f23dc2 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -168,6 +168,9 @@ var Keyboard = new Lang.Class({ this._caretTrackingEnabled = false; this._updateCaretPositionId = 0; + this._enableKeyboard = false; // a11y settings value + this._enabled = false; // enabled state (by setting or device type) + 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 }); @@ -305,14 +308,14 @@ var Keyboard = new Lang.Class({ }, _syncEnabled: function () { - this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD) || - this._lastDeviceIsTouchscreen(); - if (!this._enableKeyboard && !this._keyboard) + this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD); + this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen(); + if (!this._enabled && !this._keyboard) return; - this._setCaretTrackerEnabled(this._enableKeyboard); + this._setCaretTrackerEnabled(this._enabled); - if (this._enableKeyboard) { + if (this._enabled) { if (!this._keyboard) this._setupKeyboard(); else @@ -509,7 +512,7 @@ var Keyboard = new Lang.Class({ }, _redraw: function () { - if (!this._enableKeyboard) + if (!this._enabled) return; let monitor = Main.layoutManager.keyboardMonitor; @@ -614,7 +617,7 @@ var Keyboard = new Lang.Class({ }, show: function (monitor) { - if (!this._enableKeyboard) + if (!this._enabled) return; this._clearShowIdle(); @@ -650,7 +653,7 @@ var Keyboard = new Lang.Class({ }, hide: function () { - if (!this._enableKeyboard) + if (!this._enabled) return; this._clearShowIdle(); @@ -713,14 +716,14 @@ var Keyboard = new Lang.Class({ }, setCursorLocation: function(x, y, w, h) { - if (!this._enableKeyboard) + if (!this._enabled) return; // this._setLocation(x, y); }, setEntryLocation: function(x, y, w, h) { - if (!this._enableKeyboard) + if (!this._enabled) return; // this._setLocation(x, y); -- 2.14.2From e73a0724bbc5f9aab3ce856324a8e6e83690173c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 9 Oct 2017 12:53:04 +0200 Subject: [PATCH] keyboard: Don't pop up on touch events We want touch events to enable the keyboard and focus tracking, but not to actually show it right away. Implement that behavior by only changing the visibility of the keyboard when triggered by a GSettings change. https://bugzilla.gnome.org/show_bug.cgi?id=788188 --- js/ui/keyboard.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 771f23dc2..9f1cb56c6 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -306,6 +306,7 @@ var Keyboard = new Lang.Class({ }, _syncEnabled: function () { + let wasEnabled = this._enableKeyboard; this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD); this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen(); if (!this._enabled && !this._keyboard) @@ -314,14 +315,15 @@ var Keyboard = new Lang.Class({ this._setCaretTrackerEnabled(this._enabled); - if (this._enabled) { - if (!this._keyboard) - this._setupKeyboard(); - else - Main.layoutManager.showKeyboard(); - } else { + if (this._enabled && !this._keyboard) { + this._setupKeyboard(); Main.layoutManager.hideKeyboard(true); } + + if (this._enableKeyboard && !wasEnabled) + Main.layoutManager.showKeyboard(); + else if (!this._enableKeyboard && wasEnabled) + Main.layoutManager.hideKeyboard(true); }, _sync: function () { -- 2.14.2