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



commit 6101bab1b6f30bda2f2871ed93f8e7fd6fd6b9d2
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 | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 45eb5ce82e..c52bc1a6c9 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1059,7 +1059,7 @@ var Keyboard = class Keyboard {
 
         this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA });
         this._a11yApplicationsSettings.connect('changed', this._syncEnabled.bind(this));
-        this._lastDeviceId = null;
+        this._lastDevice = null;
         this._suggestions = null;
         this._emojiKeyVisible = Meta.is_wayland_compositor();
 
@@ -1081,13 +1081,10 @@ var Keyboard = class Keyboard {
                 this.hide();
         });
 
-        Meta.get_backend().connect('last-device-changed',
-            (backend, deviceId) => {
-                let manager = Clutter.DeviceManager.get_default();
-                let device = manager.get_device(deviceId);
-
+        Meta.get_backend().connect('last-device-changed', 
+            (backend, device) => {
                 if (!device.get_device_name().includes('XTEST')) {
-                    this._lastDeviceId = deviceId;
+                    this._lastDevice = device;
                     this._syncEnabled();
                 }
             });
@@ -1115,16 +1112,10 @@ var Keyboard = class Keyboard {
     }
 
     _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;
+        return this._lastDevice.get_device_type() == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
     }
 
     _syncEnabled() {


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