[PATCH v2 xorg-gtest] xserver: Pass given timeout value
Peter Hutterer
peter.hutterer at who-t.net
Thu Jul 26 23:51:51 PDT 2012
From: Olivier Fourdan <ofourdan at redhat.com>
WaitForDevice() can take an optional timeout parameter
but that timeout should be passed down to WaitForEventOfType()
and in turn to WaitForEvent()
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- while (foo(), b) {} is valid code, but not what we want. so let's try
while (foo(b)) instead
well, that was fun to debug.
src/xserver.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/xserver.cpp b/src/xserver.cpp
index 6449954..2c551ff 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -125,7 +125,7 @@ bool xorg::testing::XServer::WaitForEvent(::Display *display, time_t timeout)
bool xorg::testing::XServer::WaitForEventOfType(::Display *display, int type, int extension,
int evtype, time_t timeout)
{
- while (WaitForEvent(display)) {
+ while (WaitForEvent(display, timeout)) {
XEvent event;
if (!XPeekEvent(display, &event))
throw std::runtime_error("Failed to peek X event");
@@ -169,7 +169,7 @@ bool xorg::testing::XServer::WaitForDevice(::Display *display, const std::string
throw std::runtime_error("Failed to query XInput extension");
while (WaitForEventOfType(display, GenericEvent, opcode,
- XI_HierarchyChanged)) {
+ XI_HierarchyChanged, timeout)) {
XEvent event;
if (XNextEvent(display, &event) != Success)
throw std::runtime_error("Failed to get X event");
--
1.7.10.4
More information about the xorg-devel
mailing list