[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.
This commit is contained in:
Martin Gräßlin 2015-02-16 14:30:01 +01:00
parent 2b133eccfd
commit 97756ff872

View file

@ -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);