The patch adds a listener called after an event has been dispatched
by the server.
Wayland servers that incorporate the Wayland display into their own
event loops may dispatch multiple Wayland events to clients as they
work through their task queues.
For e.g. if system display state changes the Wayland server may
emit several output / surface Wayland events to connected clients.
Currently an explicit flush is performd immediately after each
individual Wayland event is dispatched to make sure these are
propagated to clients in a deterministic / reliable manner.
This results in hard to maintain / easy to break code. Contributors
must make sure to explicitly flush when dispatching Wayland events
to clients - or otherwise wait for some other server event to flush
the client buffer later on. In the latter case behavior is not
deterministic and makes testing the server code much harder.
The client event_dispatch_listener added in this patch allows the
server to track if the processing of a server event has resulted in
the dispatch of one or more Wayland events to clients - and ensure
the buffer is appropriately flushed.
This eliminates the need to flush in many different areas of the
codebase, making the server easier to maintain and test.
Signed-off-by: Thomas Lukaszewicz <thomaslukaszewicz@gmail.com>
Make sure that the client destroy handler runs strictly before the
resource destroy handler, which runs strictly before the client
late-destroy handler.
Signed-off-by: Daniel Stone <daniels@collabora.com>
A late-destroy listener for a client is called after all the client's
resources have been destroyed and the destroy callbacks emitted. This
lives in parallel to the existing client destroy listener, called
immediately before the client's objects get destroyed.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: wayland/wayland#207
Rather than have two versions of the macro with slightly different
interfaces, just use wl_container_of internally.
This also removes use of statement expressions, a GNU C extension.
Signed-off-by: Michael Forney <mforney@mforney.org>
With the work to add wl_resource accessors and port weston to use them,
we're ready to make wl_resource and wl_object opaque structs. We keep
wl_buffer in the header for EGL stacks to use, but don't expose it by
default. In time we'll remove it completely, but for now it provides a
transition paths for code that still uses wl_buffer.
Reviewed-by: Jason Ekstrand<jason@jlekstrand.net>
It was failing with missing include files.
While here, destroy the ugly "../src/..." include
paths used in the tests that was just hacking around
this problem in the Makefile:
sed -i s/..\\/src\\/// tests/*.c