Commit 97756ff8 authored by Martin Flöser's avatar Martin Flöser
Browse files

[tests] Improve startup of Xwayland server

Instead of performing dispatchEvents for a hard coded number of
expected events from Xwayland, we use select on the pipe to figure
out whether Xwayland has started writing the display number. As long
as select does not indicate that the pipe is ready we need to dispatch
further events.
parent 2b133ecc
......@@ -99,10 +99,15 @@ int main(int argc, char **argv)
exit(1);
}
// need four roundtrips to dispatch events
for (int i = 0; i < 5; i++) {
fd_set rfds;
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
do {
display.dispatchEvents(1000);
}
FD_ZERO(&rfds);
FD_SET(pipe, &rfds);
} while (select(pipe + 1, &rfds, NULL, NULL, &tv) == 0);
// now Xwayland is ready and we can read the pipe to get the display
readDisplayFromPipe(pipe);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment