summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* build: bump version to 1.23.931.23.93Simon Ser2025-06-211-1/+1
| | | | Signed-off-by: Simon Ser <contact@emersion.fr>
* connection: Do not busy-loop if a message exceeds the buffer sizeDemi Marie Obenour2025-06-214-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the length of a message exceeds the maximum length of the buffer, the buffer size will reach its maximum value and stay there forever, with no message ever being successfully processed. Since libwayland uses level-triggered epoll, this will cause the compositor to loop forever and consume CPU time. In libwayland 1.22 and below, there was an explicit check that caused messages exceeding 4096 bytes to result in an EOVERFLOW error, preventing the loop. However, this check was removed between d074d5290263 ("connection: Dynamically resize connection buffers"). To prevent this problem, always limit the size of messages to 4096 bytes. Since the default and minimum buffer size is 4096 bytes, this ensures that a single message will always fit in the buffer. It would be possible to allow larger messages if the buffer size was larger, but the maximum size of a message should not depend on the buffer size chosen by the compositor. Rejecting messages that exceed 4092 bytes seems to have the advantage of reserving 4 bits, not 3, in the size field for future use. However, message sizes in the range [0x0, 0x7] are invalid, so one can obtain a fourth bit by negating the meaning of bit 12 if bits 0 through 11 (inclusive) are 0. Allowing 4096-byte messages provides the far more important advantage that regressions compared to 1.22 are impossible and regressions compared to 1.23 are extremely unlikely. The only case where a regression is possible is: - The receiving side is using libwayland 1.23. - The sending side is either using libwayland 1.23 or is not using libwayland. - The sender sends a message exceeding 4096 bytes. - If the sender of the large message is the client, the server has increased the buffer size from the default value. This combination is considered extremely unlikely, as libwayland 1.22 and below would disconnect upon receiving such a large message. 4096-byte messages, however, have always worked, so there was no reason to avoid sending them. Fixes: d074d5290263 ("connection: Dynamically resize connection buffers"). Fixes: #494 Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com> (cherry picked from commit adf84614ca6189fa4efc522408ffbbc4b27ae497)
* build: bump version to 1.23.92Simon Ser2025-06-081-1/+1
| | | | Signed-off-by: Simon Ser <contact@emersion.fr>
* egl: Make `wayland-egl symbols check` depend on `wayland_egl`Matt Turner2025-06-081-0/+1
| | | | | | Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/515 Signed-off-by: Matt Turner <mattst88@gmail.com> (cherry picked from commit 53fbc2b0c1dc70b3a96740ab0ceff6a9fe09b940)
* tests: Depend on exec-fd-leak-checkerMatt Turner2025-06-081-2/+5
| | | | | | Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/514 Signed-off-by: Matt Turner <mattst88@gmail.com> (cherry picked from commit fdac631d1744d50e6e470bb78bf5057664967e32)
* tests: Add support for specifying runtime dependenciesMatt Turner2025-06-081-0/+2
| | | | | Signed-off-by: Matt Turner <mattst88@gmail.com> (cherry picked from commit 6c1da920185955f7c86af38787c8889203ec3fcb)
* tests: Make `tests` dict elements dicts themselvesMatt Turner2025-06-081-64/+97
| | | | | | | | Previously each value was a list of extra sources. The next commit will add an additional field to each test, so they need to be dicts themselves. Signed-off-by: Matt Turner <mattst88@gmail.com> (cherry picked from commit ca83185e8a28017ff3a2f9edccaa5d35bb86f1d7)
* cursor: Properly check realloc for errorsTobias Stoeckmann2025-06-081-6/+7
| | | | | | | | Do not override realloc's input pointer before checking for errors, otherwise it's not possible to keep old value, as intended. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> (cherry picked from commit 0de833da296e59e2495738afc450d1d3cb0314b3)
* cursor: Ignore invalid cursor filesTobias Stoeckmann2025-06-081-0/+2
| | | | | | | | The header offset must not be smaller than file header length. Ignore such invalid files. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> (cherry picked from commit 2978fd701a6987668a4ff41f9434f6c0da705596)
* cursor: Gracefully handle huge cursor filesTobias Stoeckmann2025-06-081-2/+12
| | | | | | | | | | | If cursor files require more than INT_MAX bytes, it is possible to trigger out of boundary writes. Since these sizes are most likely not desired anyway, gracefully handle these situations like out of memory errors. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> (cherry picked from commit 5c2f31d8d6e5f24962300f4608a0d6f887ca3bea)
* cursor: Gracefully handle out of memory conditionTobias Stoeckmann2025-06-081-1/+5
| | | | | | | | If the full path could not be constructed, avoid calling opendir(NULL) which, depending on library, might trigger undefined behavior. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> (cherry picked from commit ce0ac4f29e720688ea94fbe412a0b332304d8ee6)
* cursor: Fix undefined behavior with huge namesTobias Stoeckmann2025-06-081-1/+1
| | | | | | | | | | | | If an index.theme contains a theme name which gets close to INT_MAX, then creation of full path can lead to a signed integer overflow, which is undefined behavior. Fix this by turning one of the values to size_t. Easy solution for a probably never occurring issue. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> (cherry picked from commit 1bee7aa4a7d6590f882a61a29da16316ba27c600)
* client: fix conversion specifier in the discarded event log messageKirill Primak2025-06-081-1/+1
| | | | | Signed-off-by: Kirill Primak <vyivel@eclair.cafe> (cherry picked from commit 6281ccbd3d98ef0a6503425e3e7d705e3075e265)
* connection: fix segfault in wl_closure_invoke()Caitlyn Stewart2025-06-081-0/+5
| | | | | Signed-off-by: Caitlyn Stewart <caitlynrosestewart@gmail.com> (cherry picked from commit 827d0c30adc4519fafa7a9c725ff355b1d4fa3bd)
* build: bump version to 1.23.90 for the RC1 release1.23.91Simon Ser2025-05-221-1/+1
| | | | Signed-off-by: Simon Ser <contact@emersion.fr>
* protocol: drop reference to linux-explicit-synchronizationSimon Ser2025-05-201-1/+2
| | | | | | | | This protocol has been superseded. Replace this outdated reference with a generic hint that protocol extensions may provide this functionality. Signed-off-by: Simon Ser <contact@emersion.fr>
* Fix typosTobias Stoeckmann2025-05-204-6/+6
| | | | | | Typos found with codespell and during code audit. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* server: add wl_resource_get_interface()Isaac Freund2025-05-202-0/+17
| | | | | | | This is useful for the wayland bindings/scanner I'm working on for a dynamically typed language. Signed-off-by: Isaac Freund <mail@isaacfreund.com>
* client: add wl_proxy_get_interface()Isaac Freund2025-05-202-0/+17
| | | | | | | This is useful for the wayland bindings/scanner I'm working on for a dynamically typed language. Signed-off-by: Isaac Freund <mail@isaacfreund.com>
* protocol: Clarify sending of wl_seat.capabilitiesDavid Edmundson2025-05-201-6/+7
| | | | | | | | | | | It wasn't explicitly stated that wl_seat.capabilities should also be sent on bind. Everyone did because it was obviously sensible. This also clarifies that static seat name should be sent before announcing capabilities so clients can associate these devices with the right seat name. Signed-off-by: David Edmundson <davidedmundson@kde.org>
* shm: linkify function references in docsSimon Ser2025-05-201-8/+8
| | | | | | | Parentheses make it so the generated HTML documentation contains links, which makes navigation easier. Signed-off-by: Simon Ser <contact@emersion.fr>
* shm: fix comment about wl_shm_buffer_begin_access() safetySimon Ser2025-05-201-1/+1
| | | | | | | The paragraph later says that accessing different buffers is allowed. The function checks whether the same pool is accessed. Signed-off-by: Simon Ser <contact@emersion.fr>
* shm: Generate an error when shm access failed even without a resourceSebastian Wick2025-05-201-0/+26
| | | | Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* shm: Add wl_shm_buffer ref and unref functionsSebastian Wick2025-05-202-5/+79
| | | | | | | | | | | | | | | Shared memory buffers are currently tied to the lifetime of their underlying wl_buffer resource. This becomes problematic when the client destroys the resource after committing new state which references the wl_buffer because a compositor might have to defer applying the commit. This commit adds methods to keep the wl_shm_buffer alive longer than the underlying resource. This implicitly also keeps the buffer pool alive and because the wl_shm_buffer uses offsets into the pool, it even works when the underlying storage gets remapped somewhere else, which can happen when the client resizes the pool. Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* shm: Remove refcount check which cannot be triggeredSebastian Wick2025-05-201-7/+2
| | | | | | | | | If the pool refcount reaches zero, it is freed, so accessing its members is UB which ASan would catch. Also simplify check for negative refcounts. Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* shm: Linkify wl_shm_pool_unref in the ref_pool documentationSebastian Wick2025-05-201-1/+1
| | | | Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* protocol: Clarify wl_buffer.release descriptionMichel Dänzer2025-03-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Sebastian pointed out that the existing text could be read as wl_buffer.destroy not being allowed before the wl_buffer.release event arrives, contrary to what the wl_surface.attach description says. Clarify to be consistent with the latter. This is a follow-up for https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/141 . Signed-off-by: Michel Dänzer <mdaenzer@redhat.com> v2: * Simplify clarification, don't talk about callbacks. (Julian Orth) * Add reference to details in the description of wl_surface.attach. (Daniel Stone) v3: * Tweak clarification again. (Sebastian Wick) v4: * Make clarification even less ambiguous. (Simon Ser, Julian Orth) v5: * Just refer to the description of wl_surface.attach instead of trying to clarify anything here. (Sebastian Wick)
* client: document get_listener behavior for dispatchersJulian Orth2025-03-151-0/+3
| | | | | | | | | | | This seems to have been the case since 2013. This is useful for wrappers that need two pointers to identify proxies. One pointer (stored in the user data) pointing to a singleton object to identify that the proxy has a known structure. And one pointer (stored in the dispatcher data) pointing to per-proxy data. Signed-off-by: Julian Orth <ju.orth@gmail.com>
* scanner: use separate guards for validator functionsSimon Ser2025-02-234-31/+151
| | | | | | | | | | | | | | Generated XXX_is_valid() functions for enums are guarded behind the same #define as the enum itself. This worked fine until recently, but since fbd7460737c9 ("scanner: add new enum-header mode") we're also generating enum-only headers. When including the enum-only header first, and then the server header, the validator functions are missing. Define a separate guard to fix this. Signed-off-by: Simon Ser <contact@emersion.fr>
* Forward declarate timespec structVlad Zahorodnii2025-02-061-1/+2
| | | | | | | The `timespec` struct is defined in `time.h` header but only if `_POSIX_C_SOURCE` is set or when using the C11 standard. Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
* Also use [[deprecated]] when compiling with at least C++14David Redondo2025-02-051-1/+1
| | | | Signed-off-by: David Redondo <kde@david-redondo.de>
* Make wayland-util.h -Wundef safe when compiled by a C++ compilerDavid Redondo2025-02-051-2/+2
| | | | | Fixes #522 Signed-off-by: David Redondo <kde@david-redondo.de>
* build: Add -lm to pkg-config dependenciesDaniel Stone2025-02-051-0/+2
| | | | | | | | | Now that wl_fixed_from_double() calls round() from a function declared in a header, our users need to explicitly pick that dependency up in order to avoid build errors. Signed-off-by: Daniel Stone <daniels@collabora.com> Closes: wayland/weston#991
* tests: Add dispatch timeout testsSebastian Wick2025-02-041-0/+87
| | | | | | | | | | | Add tests which verify that... * wl_display_dispatch_timeout with a big enough timeout behaves the same as wl_display_dispatch * wl_display_dispatch_timeout will time out when there are no messages to dispatch Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* client: Add wl_display_dispatch_timeoutSebastian Wick2025-02-042-0/+13
| | | | | | A variant of wl_display_dispatch_queue_timeout for the default queue. Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* client: Add wl_display_dispatch_queue_timeoutSebastian Wick2025-02-042-34/+127
| | | | | | | | | | | For dispatching messages on a queue with a timeout. This slightly changes the samantics of wl_display_dispatch. Previously it was possible for it to return even though there wasn't a single dispatched event. The function correctly returned 0 in this case but it is now used to indicate a timeout. Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* event-loop: Use timespec utils instead of hand-rolling our ownSebastian Wick2025-02-041-54/+7
| | | | Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* timespec: Implement saturating timespec substractionSebastian Wick2025-02-041-0/+18
| | | | Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* timespec: Pull in timespec_after and timespec_add from mesaSebastian Wick2025-02-041-0/+34
| | | | Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* timespec: Pull in timespec.h from westonSebastian Wick2025-02-041-0/+259
| | | | Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* server: add const qualifier to function arguments where possibleSebastian Wick2025-01-223-18/+19
| | | | | | | Makes it possible to e.g. `call wl_client_get_credentials` with a `const struct wl_client *` from a global filter callback. Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
* ci: Update ci-templatesDaniel Stone2025-01-211-3/+3
| | | | | | | This includes an explicit way to specify the container architecture, which fixes our rebuilds on ARMv7. Signed-off-by: Daniel Stone <daniels@collabora.com>
* util: reduce error of wl_fixed_from_double()Haihua Hu2025-01-091-1/+1
| | | | | | | | when cast double to fixed pointer, there will be big error, eg 1919.9998 to 1919. Call round before cast to get nearest value 1920 of 1919.9998 Signed-off-by: Haihua Hu <jared.hu@nxp.com>
* connection: Fix wrong format stringDemi Marie Obenour2024-11-301-1/+1
| | | | | | | Prevents undefined behavior if there is not enough space in the buffer for a queued message. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
* tests: Avoid calling function with wrong typeDemi Marie Obenour2024-11-303-11/+23
| | | | | | | | | Calling a function with the wrong type is immediate undefined behavior, even if the ABI says it should be harmless. UBSAN picks it up immediately, and any decent control-flow integrity mechanism will as well. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
* connection: Avoid undefined pointer arithmeticDemi Marie Obenour2024-11-291-4/+4
| | | | | | | | | | Creating a pointer that is more than one element past the end of an array is undefined behavior, even if the pointer is not dereferenced. Avoid this undefined behavior by using `p >= end` instead of `p + 1 > end` and `SOMETHING > end - p` instead of `p + SOMETHING > end`. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
* protocol: add wl_fixes interfaceJulian Orth2024-11-181-0/+27
| | | | | | | | | | | | | | | | | This commit describes a new wl_fixes interface that can be used to destroy wl_registry objects. Users of libwayland-client should use it as follows: - call wl_fixes_destroy_registry(registry) - call wl_registry_destroy(registry) Users of libwayland-server should, in their implementation of the request, call wl_resource_destroy(registry). It should be similar in other protocol implementations. Signed-off-by: Julian Orth <ju.orth@gmail.com>
* cursor: add check to ensure wl_shm_create_pool succeededYaoBing Xiao2024-10-181-0/+5
| | | | Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
* protocol: document that wl_surface.offset is role-specificSimon Ser2024-10-051-0/+3
| | | | | | | | This request doesn't make sense for all surface roles. For instance, for maximized/tiled/fullscreen xdg_toplevel, for xdg_popup, for layer-shell surfaces, etc. Signed-off-by: Simon Ser <contact@emersion.fr>
* Add wl_keyboard key repeat eventsAndri Yngvason2024-09-231-4/+18
| | | | | | | This allows the compositor to take over the responsibility of repeating keys. Signed-off-by: Andri Yngvason <andri@yngvason.is>