Commit Graph

2499 Commits

Author SHA1 Message Date
Simon Ser
b2649cb3ee build: bump to version 1.22.0 for the official release 2023-04-04 09:58:31 +02:00
Simon Ser
cd036bb7b8 build: bump to version 1.21.93 for the RC1 release 2023-03-28 20:03:14 +02:00
Faith Ekstrand
eb19f99a5b Add a .mailmap file
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>
2023-03-25 11:17:32 -05:00
Simon Ser
002e1f1d3a build: bump version to 1.21.92 for the beta release 2023-03-16 01:08:44 +01:00
Simon Ser
3956948fac client: fix wl_display_disconnect() documentation
Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/361
2023-03-07 13:22:43 +00:00
Alexandros Frantzis
b01a85dfd5 client: Do not warn about attached proxies on default queue destruction.
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>
2023-03-01 15:50:02 +02:00
Simon Ser
344d31f871 build: bump version to 1.21.91 for the alpha release 2023-02-28 17:15:31 +01:00
Alexandros Frantzis
d72f9007c3 client: Abort when trying to add an event to a destroyed queue
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>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
e09010f470 tests: Support tests that check for client failure
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>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
0ba650202e client: Warn when a queue is destroyed with attached proxies
Log a warning if the queue is destroyed while proxies are still
attached, to help developers debug and fix potential memory errors.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
d4d3228853 tests: Capture the test client log
Capture the test client log to a temporary fd, so that is accessible by both
the test server process and the test client process.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
674145dc3f client: Track the proxies attached to a queue
Maintain a list of all wl_proxy objects that are attached to a
wl_event_queue. We will use this information in upcoming commits to warn
about improper object destruction order that can lead to memory errors.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Simon Ser
ab526f8d7c shm: fix segfault when accessing destroyed pool resource
With wl_shm_buffer_ref_pool(), it's possible for a wl_shm_pool
to outlive its wl_resource. We need to be careful not to access
wl_shm_pool.resource if it's been destroyed.

Reset resource to NULL in the resource destroy handler, and add
NULL checks.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-27 21:00:10 +00:00
Mikhail Gusarov
6cdeae1bec protocol: Clarify meaning of input region for cursors, DnD icons
Input region is ignored for cursors, DnD icons. Current wording
implies that this state is temporary, but surfaces never lose the
role once assigned, so reword to make it clearer.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2023-02-27 20:51:51 +00:00
Vlad Zahorodnii
3815803633 protocol: reorder wl_data_offer.source_actions and wl_data_device.enter
Most compositors send the wl_data_offer.source_actions event before the
wl_data_device.enter event, i.e. after creation of the data offer. This
contradicts to the wayland spec.

On the other hand, it's reasonable to send all the information useful to
the client before the enter event, rather than send mime types before the
enter event and source actions (that don't depend on drop target) after
the enter event.

On the client side, toolkits such as Qt and GTK already expect to see the
source actions before receiving the enter event.

Given all of that, this change adjusts the spec to match the behavior
observed in the compositors in the wild.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2023-02-27 20:43:41 +00:00
Sebastian Wick
2aec8f59e9 protocol: do not change pending x and y when attaching a buffer
Attaching a buffer with interface version 5 requires clients to pass
zero to x and y but it still affects the pending surface state.
Attaching a buffer after a request to offset therefore sets the pending
x and y to zero. The intent of version 5 was to allow exactly this
sequence of requests to work so let's just make sure the protocol
actually spells it out.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-02-27 20:39:41 +00:00
Peter Hutterer
1ef773be76 protocol: add wl_pointer's axis relative physical direction
This event adds the physical direction of the axis motion, relative to the
axis event we get. Right now, when natural scrolling is enabled things like
virtual volume sliders move the wrong way round.

By adding the axis motion direction, we can have toolkits swap the scroll
direction for applicable widgets, getting the right behavior on all widgets.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2023-02-21 15:32:03 +00:00
Simon Ser
a782152de0 readme: convert to Markdown
Gives us nice links and code blocks.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-13 19:57:15 +01:00
Simon Ser
20498d9ea1 readme: reword website description
The website is most useful for docs. Build instructions have been
mostly dropped from it: they're better described in downstream
projects' READMEs.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-13 19:55:42 +01:00
Simon Ser
8ffd7db24f readme: drop paragraph about Weston
There are many Wayland compositors nowadays.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-13 19:54:13 +01:00
Andri Yngvason
d16d39f74a wayland-server: Add method to get global name
This is useful for protocol designs where globals need to be referenced
in some manner.

Signed-off-by: Andri Yngvason <andri@yngvason.is>
2023-02-11 12:19:56 +00:00
Simon Ser
d443241635 protocol: add wl_surface.preferred_buffer_transform
Same as the new wl_surface.preferred_buffer_scale event but for
transform.

No version bump needed since the previous commit did that.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-07 14:33:09 +01:00
Simon Ser
9afab91d21 protocol: add wl_surface.preferred_buffer_scale
Right now, clients need to bind to wl_output globals, listen to wl_output.scale,
listen to wl_surface.enter/leave, pick the highest scale factor.

This is an issue because it breaks Wayland's "policy, not mechanism" motto.
Clients take the decision of which scale to use depending on the outputs they're
on, compositors have no say in this (apart from faking output events, which
isn't great).

This commit introduces a new wl_surface.preferred_buffer_scale event to allow
compositors to directly indicate the preferred scale factor for each surface.

This unlocks features which require dynamically changing the scale such as:

- Accessibility features such as screen magnifier
- In a VR environment, render surfaces close to the eye at a higher scale
- HiDPI screenshots on LoDPI screens

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/271
2023-02-07 14:33:09 +01:00
Simon Ser
83e9c9e117 server: rename wl_display.id to next_global_name
This is much more descriptive. This value is a counter incremented
each time a new global is created.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-25 11:14:10 +01:00
Simon Ser
be31c5a8c8 server: fail on global name overflow
display->id is initialized to 1, making 0 a convenient value to
indicate an invalid global name. Make sure to not return a zero
global name on overflow. Moreover, if we wrap around, we might
cycle back to a global name which is already in-use.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-25 11:12:59 +01:00
Mikhail Gusarov
9700155eda protocol: wl_subsurface::destroy does not remove the role
Role assigned to wl_surface cannot be removed.
Delete contradicting text from wl_subsurface::destroy documentation.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2023-01-16 10:09:32 +00:00
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