Commit graph

10 commits

Author SHA1 Message Date
Thomas Lukaszewicz
a86fd86b5e wayland-server: Add wl_client_add_event_dispatch_listener
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>
2024-01-04 03:48:22 +00:00
Daniel Stone
86d73b2da2 tests: Ensure resource vs. client destroy handler order
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>
2022-10-20 11:26:22 +00:00
Daniel Stone
51d788de5b wayland-server: Add wl_client_add_destroy_late_listener
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
2022-10-20 11:26:22 +00:00
Daniel Stone
e886b456ab tests: Use bool for client test
A 0/1-only int is a bool.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-10-20 11:26:22 +00:00
Michael Forney
55d044810c Use wl_container_of internally
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>
2019-06-05 09:58:14 +00:00
Bryce Harrington
773babedfc tests: Update boilerplate from MIT X11 license to MIT Expat license
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:31:24 -07:00
Kristian Høgsberg
d94a8722cb server: Make wl_object and wl_resource opaque structs
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>
2013-07-02 15:52:47 -04:00
Kristian Høgsberg
c450b6e23b tests: Include wayland-private.h for container_of 2012-10-21 10:04:17 -04:00
Dylan Noblesmith
b486e3aba5 tests: fix make check for out-of-tree builds
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
2012-06-30 19:58:37 +00:00
Kristian Høgsberg
fa5f7b1191 server: Add client destroy signal 2012-04-13 09:53:15 -04:00