client: Add wl_display_dispatch_pending() for dispatching without reading
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 11 Oct 2012 21:15:08 +0000 (17:15 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 15 Oct 2012 14:52:53 +0000 (10:52 -0400)
commit78cfa967681c965d23f6cbf76e080bbb0b564ff6
tree91642db1cba35ecdea52c8ecdc1fe7b4681fdbc1
parent1849534736dea14b97d9e91cd90e75a8a1e5de9f
client: Add wl_display_dispatch_pending() for dispatching without reading

If the main thread ends up dispatching a non-main queue, and not in
a wl_display_dispatch() callback, we may queue up main queue events and read
all data from the socket fd.  When we get back to the main loop, the
socket fd is no longer readable and nothing will trigger dispatching of
the queued up events.

The new function wl_display_dispatch_pending() will dispatch any pending
events, but not attempt to read from the socket.  Clients that integrate
the wayland socket fd into a main loop should call
wl_display_dispatch_pending() and then wl_display_flush()
before going back to blocking in poll(2) or similar mechanism.
src/wayland-client.c
src/wayland-client.h