[PATCH xorg-gtest 2/2] xserver: query device list before waiting

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 16 20:16:24 PDT 2012


If the device has initialised before we call WaitForDevice(), we still need
to return true.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/xserver.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/xserver.cpp b/src/xserver.cpp
index a774ad5..9803e1f 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -264,6 +264,15 @@ bool xorg::testing::XServer::WaitForDevice(::Display *display, const std::string
     bool mask_set, mask_created;
     masks = set_hierarchy_mask(display, &nmasks, &mask_set, &mask_created);
 
+    XIDeviceInfo *info;
+    int ndevices;
+
+    info = XIQueryDevice(display, XIAllDevices, &ndevices);
+    for (int i = 0; !device_found && i < ndevices; i++) {
+      device_found = (name.compare(info[i].name) == 0);
+    }
+    XIFreeDeviceInfo(info);
+
     while (!device_found &&
            WaitForEventOfType(display, GenericEvent, opcode,
                               XI_HierarchyChanged, timeout)) {
-- 
1.7.11.4



More information about the xorg-devel mailing list