padOsd: Ensure to pick pad devices only

If the underlying X11 input driver creates multiple devices from a single
device node, we may end up picking up the wrong device. So, instead of
picking the first device based on node and bailing out if it's not a pad,
pick the first pad that has that device node, and bail out if there is
none.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/10

Closes: #10
This commit is contained in:
Carlos Garnacho 2018-01-19 10:45:50 +01:00
parent cb2e26ff10
commit 0d9c742127

View File

@ -977,12 +977,12 @@ var PadOsdService = new Lang.Class({
let padDevice = null; let padDevice = null;
devices.forEach(Lang.bind(this, function(device) { devices.forEach(Lang.bind(this, function(device) {
if (deviceNode == device.get_device_node()) if (deviceNode == device.get_device_node() &&
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE)
padDevice = device; padDevice = device;
})); }));
if (padDevice == null || if (padDevice == null) {
padDevice.get_device_type() != Clutter.InputDeviceType.PAD_DEVICE) {
invocation.return_error_literal(Gio.IOErrorEnum, invocation.return_error_literal(Gio.IOErrorEnum,
Gio.IOErrorEnum.CANCELLED, Gio.IOErrorEnum.CANCELLED,
"Invalid params"); "Invalid params");