keyboard: Restore intended OSK visibility behavior

Getting the necessary "setting enabled, or input from touchscreen"
conditions to have the OSK shown are not enough on the lack of a
current focus. As we are setting up the caret tracker here, wait for
the focus in event before showing the keyboard.

This fixes 2 issues, with the setting disabled it became really hard
to get the OSK hidden on eg. touchscreen->pointer device switches,
as visibility only depended on the a11y setting here. And secondly,
enabling the setting would always end up with the OSK being shown
regardless of focus, while it should stay hidden if there's no text
edition.

https://bugzilla.gnome.org/show_bug.cgi?id=788188
This commit is contained in:
Carlos Garnacho 2018-01-18 18:56:10 +01:00
parent 2d79ab6c5c
commit 7544bba0c1

View File

@ -308,7 +308,7 @@ var Keyboard = new Lang.Class({
}, },
_syncEnabled: function () { _syncEnabled: function () {
let wasEnabled = this._enableKeyboard; let wasEnabled = this._enabled;
this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD); this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen(); this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen();
if (!this._enabled && !this._keyboard) if (!this._enabled && !this._keyboard)
@ -319,9 +319,7 @@ var Keyboard = new Lang.Class({
if (this._enabled && !this._keyboard) if (this._enabled && !this._keyboard)
this._setupKeyboard(); this._setupKeyboard();
if (this._enableKeyboard && !wasEnabled) if (!this._enabled && wasEnabled)
Main.layoutManager.showKeyboard();
else if (!this._enableKeyboard && wasEnabled)
Main.layoutManager.hideKeyboard(true); Main.layoutManager.hideKeyboard(true);
}, },