[gnome-shell/wip/rstrode/login-screen-extensions: 126/134] keyboard: Only enable keyboard if ClutterDeviceManager::touch-mode is enabled




commit 3512e70e19952a44ab712939aa01d00a4599bb45
Author: rpm-build <rpm-build>
Date:   Wed Oct 21 21:32:03 2020 +0200

    keyboard: Only enable keyboard if ClutterDeviceManager::touch-mode is enabled

 js/ui/keyboard.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 94b53250b2..b1ee27044e 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1051,6 +1051,9 @@ var Keyboard = class Keyboard {
         this._suggestions = null;
         this._emojiKeyVisible = true;
 
+        let manager = Clutter.DeviceManager.get_default();
+        manager.connect('notify::touch-mode', this._syncEnabled.bind(this));
+
         this._focusTracker = new FocusTracker();
         this._focusTracker.connect('position-changed', this._onFocusPositionChanged.bind(this));
         this._focusTracker.connect('reset', () => {
@@ -1120,8 +1123,10 @@ var Keyboard = class Keyboard {
 
     _syncEnabled() {
         let wasEnabled = this._enabled;
+        let manager = Clutter.DeviceManager.get_default();
+        let autoEnabled = manager.get_touch_mode() && this._lastDeviceIsTouchscreen();
         this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
-        this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen();
+        this._enabled = this._enableKeyboard || autoEnabled;
         if (!this._enabled && !this._keyboardController)
             return;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]