diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-10-12 12:50:06 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-10-16 14:09:30 +1000 |
commit | 7361f8b29b89bb80f384054bc5cce1dea35f376b (patch) | |
tree | 8ec3168eabf24422c81f70732d10f25384cc7e5a | |
parent | 3053e8d8e09971c70c16735f9d43fa248cd9901d (diff) |
xserver: query device list before waiting
If the device has initialised before we call WaitForDevice(), we still need
to return true.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/xserver.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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)) { |