[gnome-shell/wip/carlosg/clutter-seat: 58/64] keyboard: Update to ::last-device-changed parameter change



commit 01d2a37401d0a5d52ec45e82c91e46a3020c1274
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Oct 5 12:34:07 2019 +0200

    keyboard: Update to ::last-device-changed parameter change
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/760

 js/ui/keyboard.js | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index e12d83a968..9f509c9be5 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1084,13 +1084,10 @@ var KeyboardManager = class KeyBoardManager {
         this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA });
         this._a11yApplicationsSettings.connect('changed', this._syncEnabled.bind(this));
 
-        this._lastDeviceId = null;
-        Meta.get_backend().connect('last-device-changed', (backend, deviceId) => {
-            let manager = Clutter.DeviceManager.get_default();
-            let device = manager.get_device(deviceId);
-
+        this._lastDevice = null;
+        Meta.get_backend().connect('last-device-changed', (backend, device) => {
             if (device.get_device_name().indexOf('XTEST') < 0) {
-                this._lastDeviceId = deviceId;
+                this._lastDevice = device;
                 this._syncEnabled();
             }
         });
@@ -1098,16 +1095,11 @@ var KeyboardManager = class KeyBoardManager {
     }
 
     _lastDeviceIsTouchscreen() {
-        if (!this._lastDeviceId)
-            return false;
-
-        let manager = Clutter.DeviceManager.get_default();
-        let device = manager.get_device(this._lastDeviceId);
-
-        if (!device)
+        if (!this._lastDevice)
             return false;
 
-        return device.get_device_type() == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
+        let deviceType = this._lastDevice.get_device_type();
+        return deviceType == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
     }
 
     _syncEnabled() {


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