vdagent-x11: ensure no events are pending before returning to the main loop
commit759d6d968a38dd48a1f29a8216cbe4ddc70509ca
authorHans de Goede <hdegoede@redhat.com>
Wed, 30 Mar 2011 10:20:57 +0000 (30 12:20 +0200)
committerHans de Goede <hdegoede@redhat.com>
Wed, 30 Mar 2011 10:20:57 +0000 (30 12:20 +0200)
tree78a08094409d115396b3ac437fbd8fadae462f44
parent3b0824ca83dc68b251a95ab120e5d97345f15f12
vdagent-x11: ensure no events are pending before returning to the main loop

Note: Our event loop is only called when there is data to be read from the
X11 socket. If events have arrived and have already been read by libX11 from
the socket triggered by other libX11 calls from this file, the select for
read in the main loop, won't see these and our event loop won't get called!

Thus we must make sure that all queued events have been consumed, whenever
we return to the main loop. IOW all (externally callable) functions in this
file must end with calling XPending and consuming all queued events.

Calling XPending when-ever we return to the mainloop also ensures any
pending writes are flushed.
vdagent-x11.c