Fixed a race condition between the X server and a 3D application during replicate.
Fixed a race condition between the X server and a 3D application during replicate.

To replicate properly, the replicate SPU must receive an XVncConnected event,
followed by an XVncChromiumConnected event.  Both are checked for in a loop
in replicatespuCheckForVncEvents() that exits when no more X events are pending.

If the XVncChromiumConnected event isn't quite pending yet (perhaps because the
X server hasn't had a chance to run), the application loop can be exited before
the XVncChromiumConnected event arrives, which means that the
application will *not* replicate until the *next* time it has a chance to
check for VNC events.  In the case of a static application (i.e. one that
is not rendering continuously, but rather just waits for an Expose), that can
be never.  (In the case of a dynamic application, VNC events are also checked
for at glClear() and at buffer flushes, so the problem isn't noticeable.)

The fix is to wait in the replicatespuCheckForVncEvents() loop for
the XVncChromiumConnected event to appear, once we see an XVncConnected
event.  The loop is designed to wait for at most 1000 milliseconds, just
in case something unexpected happens and the second event never comes; in
this case, when it leaves the loop, it prints a warning.

rpavlik/chromium,rpavlik/chromium,rpavlik/chromium,rpavlik/chromium,rpavlik/chromium