keyboard: Update to ::last-device-changed parameter change

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/760
This commit is contained in:
Carlos Garnacho 2019-10-05 12:34:07 +02:00 committed by Carlos Garnacho
parent b86ef8cde5
commit 8d88a9b9c4

View File

@ -1102,13 +1102,10 @@ var KeyboardManager = class KeyBoardManager {
this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA }); this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA });
this._a11yApplicationsSettings.connect('changed', this._syncEnabled.bind(this)); this._a11yApplicationsSettings.connect('changed', this._syncEnabled.bind(this));
this._lastDeviceId = null; this._lastDevice = null;
Meta.get_backend().connect('last-device-changed', (backend, deviceId) => { Meta.get_backend().connect('last-device-changed', (backend, device) => {
let manager = Clutter.DeviceManager.get_default();
let device = manager.get_device(deviceId);
if (device.get_device_name().indexOf('XTEST') < 0) { if (device.get_device_name().indexOf('XTEST') < 0) {
this._lastDeviceId = deviceId; this._lastDevice = device;
this._syncEnabled(); this._syncEnabled();
} }
}); });
@ -1116,16 +1113,11 @@ var KeyboardManager = class KeyBoardManager {
} }
_lastDeviceIsTouchscreen() { _lastDeviceIsTouchscreen() {
if (!this._lastDeviceId) if (!this._lastDevice)
return false; return false;
let manager = Clutter.DeviceManager.get_default(); let deviceType = this._lastDevice.get_device_type();
let device = manager.get_device(this._lastDeviceId); return deviceType == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
if (!device)
return false;
return device.get_device_type() == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
} }
_syncEnabled() { _syncEnabled() {