Commit Graph

2473 Commits

Author SHA1 Message Date
Marius Vlad
b27961e48d release.sh: Don't push *all* tags
Rather than trying to push all possible tags just push the one
created for that release.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-16 10:03:54 +00:00
Fergus Dall
41aed7a38a scanner: Fix undefined behavior around qsort
According to clang, qsort cannot be passed a null pointer, even if the size is
specified to be zero. The scanner can hit this while trying to sort forward
declarations if it happens to be building a protocol file that doesn't require
any, either in the header or the source.

Signed-off-by: Fergus Dall <sidereal@google.com>
2023-01-03 11:05:35 +00:00
Simon Ser
7f1c51a556 protocol: add note about wl_buffer/wl_callback version
This is an exception which can be confusing. Add an explicit note
about it in the protocol text.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-12-07 10:04:49 +01:00
Kirill Primak
0dc23e380a protocol: add defunct_role_object error
This commit adds wl_surface.defunct_role_object error, which has
semantics similar to xdg_wm_base.defunct_surfaces error, and is sent
when a client destroys a surface while the corresponding role object
still exists.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2022-11-29 13:46:54 +00:00
Kirill Primak
68dfa1183f protocol: remove wl_subsurface lifetime contradiction
This statement assumes that a wl_surface can be destroyed before the
corresponding wl_subsurface, which is not true, as wl_surface
description explicitly states that the role object must be destroyed
before the wl_surface itself.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2022-11-29 13:46:54 +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
Simon Ser
b9632822b7 protocol: add wl_compositor.error.bad_parent
This forbids loops in sub-surface trees.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-21 10:17:57 +00:00
Simon Ser
c2c6ef9cbe protocol: mention protocol error name in wl_subcompositor.get_subsurface
Let's be explicit here.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-21 10:17:57 +00:00
Simon Ser
985ab55d59 ci: upgrade images
Upgrade Debian to bullseye and FreeBSD to 13.1. FreeBSD 13.0 is
not supported anymore, and this ensures we still build on fresh
images.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:46:46 +00:00
Simon Ser
e105360783 ci: set ASAN_OPTIONS=detect_odr_violation=0
Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/154
2022-09-13 18:46:46 +00:00
Simon Ser
2d5acfa5c3 cursor: make param names match with documentation
There was a mismatch here.

Use a good-looking function param name because that's what will
show up in docs. Use an abbreviation inside the function.

Fixes the following warnings:

    cursor/wayland-cursor.c:504: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time)
    cursor/wayland-cursor.c:504: warning: The following parameter of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:452: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration)
    cursor/wayland-cursor.c:452: warning: The following parameter of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:147: warning: argument 'image' of command @param is not found in the argument list of wl_cursor_image_get_buffer(struct wl_cursor_image *_img)
    cursor/wayland-cursor.c:147: warning: The following parameter of wl_cursor_image_get_buffer(struct wl_cursor_image *_img) is not documented:
      parameter '_img'
    cursor/wayland-cursor.c:504: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time)
    cursor/wayland-cursor.c:504: warning: The following parameter of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:452: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration)
    cursor/wayland-cursor.c:452: warning: The following parameter of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:147: warning: argument 'image' of command @param is not found in the argument list of wl_cursor_image_get_buffer(struct wl_cursor_image *_img)
    cursor/wayland-cursor.c:147: warning: The following parameter of wl_cursor_image_get_buffer(struct wl_cursor_image *_img) is not documented:
      parameter '_img'

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:01:57 +00:00
Simon Ser
7d78ea5628 server: don't document void return values
Fixes the following warnings:

    src/wayland-server.c:1152: warning: documented empty return type of wl_display::wl_display_destroy
    src/wayland-server.c:1193: warning: documented empty return type of wl_display::wl_display_set_global_filter

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:01:57 +00:00
Simon Ser
1db6153cc2 util: name function typedef arguments
Doxygen doesn't support documenting unnamed function arguments.

Fixes the following warnings:

    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'uint32_t' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'struct' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_message' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'union' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_argument' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:725: warning: argument 'const' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'char' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'va_list' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'uint32_t' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'struct' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_message' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'union' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_argument' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:725: warning: argument 'const' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'char' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'va_list' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:01:57 +00:00
Olivier Fourdan
68fef9922e build: Make release.sh generic
The "release.sh" script is a convenient and documented way to release
Wayland packages.

Unfortunately, the actual package name is hardcoded, meaning that to
reuse that script in other Wayland projects, one needs to duplicate the
script and amend it.

Use meson to determine the actual project name, so that the same script
can be invoked from any relevant Wayland project.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-09-06 15:15:56 +02:00
Carlos Garnacho
73468bab7d server: Extend display name string size
Typically this is a number between 0 and 32. Just that the compiler doesn't
know that well. Make the string buffer a bit larger, so that it fits the
longer integers. Fixes build warnings like:

../subprojects/wayland/src/wayland-server.c: In function ‘wl_display_add_socket_auto’:
../subprojects/wayland/src/wayland-server.c:1649:70: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Werror=format-truncation=]
 1649 |                 snprintf(display_name, sizeof display_name, "wayland-%d", displayno);
      |                                                                      ^~
../subprojects/wayland/src/wayland-server.c:1649:61: note: directive argument in the range [-2147483647, 32]
 1649 |                 snprintf(display_name, sizeof display_name, "wayland-%d", displayno);
      |                                                             ^~~~~~~~~~~~
../subprojects/wayland/src/wayland-server.c:1649:17: note: ‘snprintf’ output between 10 and 20 bytes into a destination of size 16
 1649 |                 snprintf(display_name, sizeof display_name, "wayland-%d", displayno);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Seen in GTK CI.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
2022-08-05 01:26:10 +02:00
Ian Douglas Scott
60827b862e Document which type are nullable, and wire format for null value
Signed-off-by: Ian Douglas Scott <idscott@system76.com>
2022-07-14 08:38:49 -07:00
Ian Douglas Scott
971f8e4ace Do not allow nullable new_id
The usefulness of this is limited, and `libwayland-client` doesn't
provide a way to pass a null `new_id` since the id is generated by the
library and given to the caller as the return value.

Signed-off-by: Ian Douglas Scott <idscott@system76.com>
2022-07-14 08:38:49 -07:00
Ian Douglas Scott
13b05c9ed1 Do not allow nullable arrays, which were not correctly implemented
Nullable arrays, which are not used anywhere, were marshalled the same
way as an empty non-null array. The demarshalling logic did not
recognize anything as a null array. Given this, it seems better to just
explicitly not support it.

Fixes https://gitlab.freedesktop.org/wayland/wayland/-/issues/306.

Signed-off-by: Ian Douglas Scott <idscott@system76.com>
2022-07-14 08:10:38 -07:00
Simon Ser
7cdc20cee6 Add release.sh
Replace xorg-util-modular's release script with our own, tailored
for Wayland only. Does the same thing but in 71 lines of code
instead of 1k. Creates a GitLab release via glab instead of trying
to upload to a web server via ssh.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-07-14 08:04:43 +00:00
Simon Ser
4f6c6e7c0f build: re-open main branch for regular development 2022-07-01 00:11:50 +02:00
Simon Ser
8135e856eb build: bump to version 1.21.0 for the official release 2022-06-30 23:59:11 +02:00
Peter Hutterer
68842b3403 protocol: minor clarification for axis_discrete events
Explicitly spell out that multiple axis_discrete events *for the same axis*
within the same wl_pointer.frame are not permitted.

References: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/911#note_1438099

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-06-30 09:12:08 +00:00
Simon Ser
c7fc1e79ca util: set errno when hitting WL_MAP_MAX_OBJECTS
Callers may check errno when wl_map_insert_* functions return an
error (since [1]). Make sure it's always set to a meaningful value
when returning an error, otherwise callers might end up checking an
errno coming from a completely different function.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/205

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: b19488c715 ("util: Limit size of wl_map")
2022-06-28 11:59:26 +02:00
Simon Ser
8e322a5a99 build: bump to version 1.20.93 for the RC1 release 2022-06-23 21:59:18 +02:00
Simon Ser
41b10c7458 server: warn about global filtering consistency
The filtering needs to be static given a client and a global,
otherwise libwayland will misbehave.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/241#note_1421888
2022-06-15 10:37:18 +02:00
Simon Ser
7eb00b070d server: add PID race condition disclaimer to wl_client_get_credentials
PIDs are re-used and cannot be used to reliably check the identity of
a Wayland client.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 07:57:12 +00:00
Simon Ser
2fb4cdebbe tests: add a test for dynamic filtered globals
Ensure dynamically created and destroyed globals which are filtered
don't trigger any global/global_remove event.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 07:53:19 +00:00
Simon Ser
1b00df864c server: check visibility before sending global/global_remove
See the previous discussion at [1]: libwayland incorrectly skips
the visibility checks when sending global/global_remove events.
The check is only performed when a client performs a
wl_display.get_registry request.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/148

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 07:53:19 +00:00
Olivier Fourdan
dd00220b1e cursor/os-compatibility: handle EINTR gracefully
If os_resize_anonymous_file() called from os_create_anonymous_file()
fails with EINTR (Interrupted system call), then the buffer allocation
fails.

To avoid that, retry posix_fallocate() on EINTR.

However, in the presence of an alarm, the interrupt may trigger
repeatedly and prevent a large posix_fallocate() to ever complete
successfully, so we need to first block SIGALRM to prevent this.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-06-09 19:18:47 +00:00
Simon Ser
07c8f41576 build: bump to version 1.20.92 for the beta release
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-09 20:52:32 +02:00
Alexandros Frantzis
444d0ff338 client: Lock display when setting a proxy event queue
Assignments to a wl_proxy's queue member are currently not synchronized
with potential reads of that member during event reading/queuing.
Assuming atomic pointer value reads and writes (which is a reasonable
assumption), and using the documented best practices to handle event
queue changes, a queue change should still be safe to perform.

That being said, such implicitly atomic accesses are difficult to assess
for correctness, especially since they do not introduce memory barriers.

To make the code more obviously correct, and handle any potential races
we are not currently aware of, this commit updates wl_proxy_set_queue()
to set the proxy's event queue under the display lock (all other
proxy queue accesses are already done under the display lock).

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-09 18:38:53 +00:00
Alexandros Frantzis
a8246a9f0f client: Document best practices for event queue changes
Document the proper way to deal with event queue changes, in order to
guarantee proper handing of all events which were queued before the
queue change takes effect, especially in multi-threaded setups.

Make a special note about queue changes of newly created proxies,
which require the use of a proxy wrapper for thread safety.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-09 18:38:53 +00:00
Antonin Décimo
9434e8d69f Check that XDG base directories paths are absolute
The [spec][1] reads:

> All paths set in these environment variables must be absolute. If an
> implementation encounters a relative path in any of these variables it should
> consider the path invalid and ignore it.

and

> If $XDG_DATA_HOME is either not set or empty, a default equal to
> $HOME/.local/share should be used.

Testing that the path is absolute also entails that is is non-empty.

[1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2022-06-09 18:34:17 +00:00
Simon Ser
f710d01663 cursor/os-compatibility: fix trailing space
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-04 22:58:50 +02:00
Simon Ser
0297c2c47a cursor/os-compatibility: remove strcpy/strcat usage
These functions don't perform bounds checking, so they are easy to
misuse and complicate audits.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-04 22:58:47 +02:00
Simon Ser
355c8e885c cursor: move xcursor_theme_inherits declarations at the top
Per code style, declarations need to be at the start of the block.

And make l const while at it.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
dfe820efce cursor: drop xcursor_add_path_elt
Just use snprintf instead. It doesn't really matter if we have
some duplicate slashes in filenames.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
ccca002691 cursor: drop unused XCursor comment declarations
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
1cb728246b cursor: fix indentation of xcursor_load_theme declaration
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
7a399383fc cursor: simplify xcursor_library_path
- Use early returns
- De-duplicate XDG_DATA_HOME code-paths
- Don't crash on allocation failure
- Use size_t when appropriate
- Fix indentation

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
f33356742e cursor: remove unnecessary ifs in xcursor_load_theme
load_all_cursors_from_dir and xcursor_theme_inherits already have
the NULL checks we want.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
6c49a8f7e5 cursor: drop xcursor_images_set_name
We don't ever need to set the name multiple times for a single
struct xcursor_images, so we can just set the field directly. Also
replace the hand-rolled logic with strdup.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
6cf5e8f932 cursor: use getline instead of fgets
This avoids storing 8KiB on the stack, and removes the line length
limit.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
0b8793ab0c cursor: remove unnecessary parentheses in load_all_cursors_from_dir
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:10 +02:00
Simon Ser
c2a150f7c2 cursor: remove xcursor_file_load_images wrapper
It's just calling xcursor_xc_file_load_images.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 16:01:42 +02:00
Simon Ser
73d4d2410e build: bump to version 1.20.91 for the alpha release
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-26 20:15:35 +02:00
Xavier Claessens
24244f26bf Meson: Override wayland-scanner if it can be run
This allows projects to use Wayland as a Meson subproject and get the
wayland-scanner executable when doing find_program('wayland-scanner').

Signed-off-by: Xavier Claessens <xavier.claessens@collabora.com>
2022-05-24 14:09:33 +00:00
Simon Ser
5e4253ed50 util: fix code block language in docs
Without {.xml}, Doxygen interprets the code as C. See [1] for
details.

[1]: https://www.doxygen.nl/manual/commands.html#cmdcode

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 10:13:46 +00:00