Blob Blame History Raw
From 0d9c742127f4a79416478b46a9fa5273701d92e3 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 19 Jan 2018 10:45:50 +0100
Subject: [PATCH] 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
---
 js/ui/padOsd.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index 34ef96bb9..6e11ddfba 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -977,12 +977,12 @@ var PadOsdService = new Lang.Class({
         let padDevice = null;
 
         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;
         }));
 
-        if (padDevice == null ||
-            padDevice.get_device_type() != Clutter.InputDeviceType.PAD_DEVICE) {
+        if (padDevice == null) {
             invocation.return_error_literal(Gio.IOErrorEnum,
                                             Gio.IOErrorEnum.CANCELLED,
                                             "Invalid params");
-- 
2.16.1