On 07/26/2012 11:51 PM, Peter Hutterer wrote:
From: Olivier Fourdan <ofour...@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 <ofour...@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutte...@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");
Heh, sly little bug.
Reviewed-by: Chase Douglas <chase.doug...@canonical.com>
And pushed as commit 5111348863d6f2992f1ac727d0a6cc4d52cee0e5.
Thanks!
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel