Allows clients to cleanly release wl_shm objects. Useful for clients
using multiple wl_registry objects (e.g. via libraries).
Signed-off-by: Simon Ser <contact@emersion.fr>
This was hardcoded to 1 regardless of the version passed to the
callback or the version of the parent resource.
Signed-off-by: Simon Ser <contact@emersion.fr>
Since the positivity of zero is debatable, and, in some cases scale was simply
underspecified, clarify the situation.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
The cursor name spec [1] describes how cursors should be named,
and is widely used. Add aliases so that users can pass these
names to libwayland-cursor without having to add fallbacks for
X11 cursor names.
[1]: https://www.freedesktop.org/wiki/Specifications/cursor-spec/
Signed-off-by: Simon Ser <contact@emersion.fr>
This adds a command to re-generate the test data. This needs to be
done when either an XML source file or the scanner's output is
changed.
Signed-off-by: Simon Ser <contact@emersion.fr>
The spec does not describe which actions cause the compositor to assign
keyboard focus to a surface, leaving this up to the compositor.
Compositors differ in their behavior when the user clicks on a
sub-surface. Some will move the keyboard focus to the subsurface whereas
others will only ever assign the keyboard focus to toplevel surfaces.
Some applications (e.g. firefox) seem to require the second behavior.
This patch specifies that sub-surfaces never get the keyboard focus.
Signed-off-by: Julian Orth <ju.orth@gmail.com>
Don't mention when the parent surface state is applied; the parent
surface isn't necessarily a sub-surface.
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
This should be sufficient for clients to not decide to fallback to
output based logic to determine scaling/transform when compositor
doesn't send any of the v6 events.
Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
The issue template is hard to notice because it's not the default.
Users have to explicitly select it from the easy-to-miss dropdown
to get the warning.
Make the template the default one, so that new users are less likely
to miss it.
Signed-off-by: Simon Ser <contact@emersion.fr>
Due to what is arguably a mistake in the C language specification,
passing NULL to memcpy and friends is undefined behavior (UB) even when
the count is 0. C additionally mistakenly leaves NULL + 0 and NULL -
NULL undefined. (C++ fixes this mistake.) These are very problematic
because (NULL, 0) is a natural representation of the empty slice.
Some details:
https://github.com/llvm/llvm-project/issues/49459https://www.imperialviolet.org/2016/06/26/nonnull.html
Unfortunately, despite how clearly this is a mistake, glibc headers and
GCC now try to exploit this specification mistake and will miscompile
code, so C projects need to workaround this. In particular, UBSan from
Clang will flag this as a bug (although Clang itself has the good sense
to never lean on this bug). We've run into a few UBSan errors in
Chromium stemming from Wayland's memcpy calls. Add runtime guards as
needed to avoid these cases.
Note: Chromium's copy of wayland has
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/188
applied. It is possible the ring_buffer_copy UB cases are only reachable
with that MR applied, I'm not sure. But it seemed simplest to just add
the fix to wayland as-is. Then when/if that MR lands, it will pick this
up.
Signed-off-by: David Benjamin <davidben@google.com>
This can be useful for additional validation purposes when handling
proxies. This is similar to existing server side API
wl_global_get_display.
Signed-off-by: David Edmundson <david@davidedmundson.co.uk>
Newer ci-templates contains bugfixes.
While at it, stop using a GitLab YAML reference, because we only
use this value in one spot.
Signed-off-by: Simon Ser <contact@emersion.fr>
Wayland debug logs resemble email addresses. This is a problem when
anonymizing logs from users. For example:
[2512874.343] xdg_surface@700.configure(333)
In the above log line, the substring "surface@700.config" can be
mistaken for an email address and redacted during anonymization.
Signed-off-by: Alex Yang <aycyang@google.com>
The way we're wrapping libc functions via dlsym() is pretty fragile
and breaks on FreeBSD. The failures happen in our CI and are pretty
random, see e.g. [1].
Use a more manual way to wrap via a function pointer.
[1]: https://gitlab.freedesktop.org/wayland/wayland/-/jobs/44204010
Signed-off-by: Simon Ser <contact@emersion.fr>
Use bool instead of int for boolean values, to make it more
explicit what the field contains. For instance "error" is not to
be confused with an error code.
This is all private API.
Signed-off-by: Simon Ser <contact@emersion.fr>
The offset in wl_surface.attach has been superseded by
wl_surface.offset. Refer to the new request instead of using the
deprecated one.
Signed-off-by: Simon Ser <contact@emersion.fr>
There are two ways to do pre-multiplication of the alpha channel into
the color channels: on optical values or on electrical values. While
pre-multiplication with optical values is arguably more correct, because
operations like blending or scaling require pre-multiplied, optical
color channels, wayland and compositors by default work with
pre-multiplied electrical values. This is most likely a convention that
Wayland took from Cairo.
This commit makes sure that the expectation of pre-multiplied electrical
values is properly documented.
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
If wl_event_loop_dispatch() fails, we could enter an infinite loop,
repeatedly calling a failing wl_event_loop_dispatch() forever.
Signed-off-by: Simon Ser <contact@emersion.fr>
the 'has_timers' flag can be returned directly without having to track all the ready events
when a timer is found ready.
Signed-off-by: Yang Wang <KevinYang.Wang@amd.com>
Because this benchmark performed wl_fixed_to_double conversions
on a long sequence of consecutive integers, the compiler could
optimize away the addition performed in wl_fixed_to_double, merging
it with the loop iteration code. This made tests/fixed-benchmark.c
significantly underestimate the actual cost of the current
wl_fixed_to_double implementation.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
This fixes an issue where it was not possible to start Gamescope under GDB on some setups.
https://github.com/ValveSoftware/gamescope/issues/743
Any signals would cause epoll_wait to return -1 and set errno to EINTR.
This also handles the EAGAIN case like the other polling loops in libwayland.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
The compositor must not send any key events while a surface is not focused,
but in order to allow for common actions like ctrl+scroll for zooming to work
with unfocused surfaces it may do so with modifiers.
Signed-off-by: Xaver Hugl <xaver.hugl@gmail.com>
As pointed out in [1], re-using a wl_data_source for multiple start_drag or
set_selection requests has bad consequences, because this object has events
that allo tracking the state of a selection/drag-and-drop operation. Tracking
two operations at the same time isn't possible with this interface.
[1]: https://lists.freedesktop.org/archives/wayland-devel/2019-January/039936.html
Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Daniel Stone <daniels@collabora.com>
This will let command-line Git tools re-map my name and e-mail address properly.
I'm using my personal e-mail address and not my Collabora address because I'm
not actively contributing to Wayland anymore and this is mostly for letting
people find me should they dig me up in the project history.
Signed-off-by: Faith Ekstrand <faith@gfxstrand.net>
If the default queue is being destroyed, the client is disconnecting
from the wl_display, so there is no possibility of subsequent events
being queued to the destroyed default queue, which is what this warning
is about.
Note that interacting with (e.g., destroying) a wl_proxy after its
wl_display is destroyed is a certain memory error, and this warning will
indirectly warn about this issue. However, this memory error should be
detected and warned about through a more deliberate mechanism.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Detect when we are trying to add an event to a destroyed queue,
and abort instead of causing a use-after-free memory error.
This situation can occur when an wl_event_queue is destroyed before
its attached wl_proxy objects.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Add the display_destroy_expect_signal() function to check that test
clients exit due to a particular signal. This is useful for checking
that clients fail in an expected way.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>