platform/upstream/wayland.git
3 years agoos-wrappers-test.c: Correctly forward arguments to fcntl
Alex Richardson [Thu, 18 Mar 2021 10:45:50 +0000 (10:45 +0000)]
os-wrappers-test.c: Correctly forward arguments to fcntl

We can't just unconditionally read the optional arguments (and also read
it as a void* despite actually being an int).
While this happens to work on most architectures because the first few
variadic arguments are passed in registers, this is non-portable and
causes a crash on architectures that set bounds on variadic function
arguments (for example CHERI-enabled architectures). It could also cause
problems on big-endian architectures that pass variadic arguments on the
stack rather than in registers.

For CHERI-MIPS, reading sizeof(void*) causes a read of 16 bytes from the
bounded varargs capability. This always crashes since even calls with the
optional argument only have 4 bytes available.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agomeson: Only require expat when building wayland-scanner
Michael Weiss [Fri, 2 Apr 2021 17:26:57 +0000 (19:26 +0200)]
meson: Only require expat when building wayland-scanner

This code is only required for building wayland-scanner so it should be
scoped accordingly. libxml-2.0 will only be required if both "scanner"
and "dtd_validation" are set to true.

Signed-off-by: Michael Weiss <dev.primeos@gmail.com>
3 years agoci: Use ci-fairy to check for Signed-off-by
Jonas Ådahl [Fri, 26 Mar 2021 16:21:07 +0000 (17:21 +0100)]
ci: Use ci-fairy to check for Signed-off-by

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
3 years agoUse MAP_FAILED instead of (void *) -1
Alex Richardson [Fri, 19 Mar 2021 11:24:05 +0000 (11:24 +0000)]
Use MAP_FAILED instead of (void *) -1

While MAP_FAILED is generally defined to that value, we should not be
relying on implementation details of system headers.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agobuild: drop autotools
Simon Ser [Mon, 14 Dec 2020 13:46:46 +0000 (14:46 +0100)]
build: drop autotools

Meson now replaces autotools.

Signed-off-by: Simon Ser <contact@emersion.fr>
3 years agoserver: add wl_display getter for wl_global
Vlad Zahorodnii [Wed, 24 Feb 2021 14:02:54 +0000 (16:02 +0200)]
server: add wl_display getter for wl_global

This can be useful if the compositor wants to call wl_global_destroy() with some
delay but it doesn't have the wl_display object associated with the global,
which is needed to get access to the event loop.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3 years agoclient: assert queue display matches proxy
Simon Ser [Thu, 25 Feb 2021 22:49:00 +0000 (23:49 +0100)]
client: assert queue display matches proxy

In wl_proxy_set_queue, passing a wl_event_queue from a completely
unrelated wl_display could lead to object IDs mismatches.

Add an assertion to catch this case. It's always a user bug if this
happens.

Signed-off-by: Simon Ser <contact@emersion.fr>
3 years agoserver: remove duplicate include
sheepwall [Mon, 22 Feb 2021 17:19:13 +0000 (18:19 +0100)]
server: remove duplicate include

Signed-off-by: August Svensson <a.sve@live.se>
3 years agoprotocol: Specify wl_callback::done to be a destructor event
Tadeo Kondrak [Thu, 11 Jun 2020 19:41:09 +0000 (13:41 -0600)]
protocol: Specify wl_callback::done to be a destructor event

It's the only destructor event in the core protocol, and destructor
events were previously unannotated.

Signed-off-by: Tadeo Kondrak <me@tadeo.ca>
3 years agoprotocol: Add type attribute to events
Tadeo Kondrak [Thu, 11 Jun 2020 19:39:56 +0000 (13:39 -0600)]
protocol: Add type attribute to events

This allows specifying events to be destructors, which is useful for
non-C language bindings. It is unused in wayland-scanner.

Signed-off-by: Tadeo Kondrak <me@tadeo.ca>
3 years agobuild: re-open master for regular development
Simon Ser [Wed, 27 Jan 2021 17:45:57 +0000 (18:45 +0100)]
build: re-open master for regular development

3 years agobuild: bump to version 1.19.0 for the official release 1.19.0
Simon Ser [Wed, 27 Jan 2021 16:48:01 +0000 (17:48 +0100)]
build: bump to version 1.19.0 for the official release

3 years agobuild: bump to 1.18.93 for the RC1 release 1.18.93
Simon Ser [Wed, 20 Jan 2021 21:35:34 +0000 (22:35 +0100)]
build: bump to 1.18.93 for the RC1 release

3 years agoprotocol: sync wl_shm.format with libdrm 2.4.104
Simon Ser [Sun, 17 Jan 2021 10:51:39 +0000 (11:51 +0100)]
protocol: sync wl_shm.format with libdrm 2.4.104

This adds 4 new formats.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
3 years agoserver: Allow absolute paths in WAYLAND_DISPLAY
Loïc Yhuel [Thu, 14 Nov 2019 13:13:17 +0000 (14:13 +0100)]
server: Allow absolute paths in WAYLAND_DISPLAY

The compositor should handle absolute paths in WAYLAND_DISPLAY like the clients, ie not
adding the XDG_RUNTIME_DIR prefix if it's an absolute path.

This allows to create the wayland socket in a separate directory for system compositors if
desired. Clients could then directly inherit the environment variable.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
3 years agobuild: bump to version 1.18.92 for the beta release upstream_bkup_20220121 upstream_bkup_20220124 upstream_bkup_20220208 1.18.92 upstream/1.18.92
Simon Ser [Wed, 6 Jan 2021 19:18:58 +0000 (20:18 +0100)]
build: bump to version 1.18.92 for the beta release

3 years agoRemove TODO
Simon Ser [Mon, 14 Dec 2020 16:27:45 +0000 (17:27 +0100)]
Remove TODO

These TODO items are outdated (either done or not applicable anymore). Let's
migrate items that we want to keep to GitLab issues.

Signed-off-by: Simon Ser <contact@emersion.fr>
3 years agomeson: link with -lrt if needed for clock_gettime
Loïc Yhuel [Thu, 2 Apr 2020 16:25:54 +0000 (18:25 +0200)]
meson: link with -lrt if needed for clock_gettime

This is already done in autotools, and fixes the build with glibc < 2.17.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
3 years agobuild: bump to version 1.18.91 for the alpha release 1.18.91
Simon Ser [Mon, 21 Dec 2020 10:16:05 +0000 (11:16 +0100)]
build: bump to version 1.18.91 for the alpha release

3 years agoserver: fix typos
Maxime Roussin-Bélanger [Thu, 17 Dec 2020 20:42:10 +0000 (15:42 -0500)]
server: fix typos

3 years agoegl: fix typo "Backards"
Maxime Roussin-Bélanger [Thu, 17 Dec 2020 20:41:13 +0000 (15:41 -0500)]
egl: fix typo "Backards"

3 years agocursor: fix typo "insufficent"
Maxime Roussin-Bélanger [Thu, 17 Dec 2020 20:40:58 +0000 (15:40 -0500)]
cursor: fix typo "insufficent"

3 years agoCONTRIBUTING: fix typo "excercising"
Maxime Roussin-Bélanger [Thu, 17 Dec 2020 20:40:38 +0000 (15:40 -0500)]
CONTRIBUTING: fix typo "excercising"

3 years agotests: fix typos
Maxime Roussin-Bélanger [Thu, 17 Dec 2020 20:40:04 +0000 (15:40 -0500)]
tests: fix typos

3 years agodoc: fix typos
Maxime Roussin-Bélanger [Thu, 17 Dec 2020 20:39:46 +0000 (15:39 -0500)]
doc: fix typos

3 years agoprotocol: deprecate non-current wl_output.mode
Simon Ser [Thu, 16 Apr 2020 17:08:53 +0000 (19:08 +0200)]
protocol: deprecate non-current wl_output.mode

The current wl_output.mode event has several issues when used to advertise
modes that aren't current:

- It's not possible to remove some modes. This is an issue for virtual
  outputs and when the kernel prunes some modes because of link limitations.
- wl_output.mode fails to carry metadata such as aspect ratio, which results
  in duplicated or missing modes.
- It's not clear, given the current set of protocols, how non-current modes
  are useful to clients. Xwayland ignores non-current modes.

GNOME and wlroots already only advertise the current mode because of these
issues.

If a protocol needs the clients to know about all available modes, it should
advertise these modes itself instead of relying on wl_output.mode.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/92

3 years agoprotocol: make it clear wl_surface.enter/leave are not for frame throttling
Simon Ser [Wed, 15 Jul 2020 07:39:25 +0000 (09:39 +0200)]
protocol: make it clear wl_surface.enter/leave are not for frame throttling

Some clients rely on wl_surface.enter/leave to start/stop their rendering
loop.

There are cases where this doesn't work:

- Some compositors don't send wl_surface.leave when a toplevel is hidden.
  For instance Sway doesn't send this event when a toplevel is on an inactive
  workspace (but doesn't send wl_surface.frame events).
- Some compositors might still want applications to continue to render even if
  away from outputs. For instance a compositor that allows to screen record
  individual toplevels might not send a wl_surface.enter event for hidden
  toplevels.

Signed-off-by: Simon Ser <contact@emersion.fr>
3 years agocursor/convert_font.c: malloc cannot guarantee that the memory allocated is always...
ganjing [Mon, 27 Jul 2020 03:22:40 +0000 (11:22 +0800)]
cursor/convert_font.c: malloc cannot guarantee that the memory allocated is always successful

3 years agodoc: make reproducible
Alyssa Ross [Thu, 29 Oct 2020 12:06:36 +0000 (12:06 +0000)]
doc: make reproducible

This setting makes Docbook section IDs consistent, and should allow
Wayland builds that include documentation to be fully reproducible.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
3 years agoprotocol: Clarify how clients can cancel a drag operation
Nick Diego Yamane [Wed, 8 Jul 2020 14:48:19 +0000 (10:48 -0400)]
protocol: Clarify how clients can cancel a drag operation

Explicitly say that destroying a wl_data_source previously used in a
wl_data_device::start_drag request will cancel the DND session. This
is currently the only way to do it from client side (besides those
"indirect" ones already documented) and all compositors work like that
but it is not clear spec-wise it is the expected behaviour.

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
3 years agoFix undefined behavior
Valentin [Fri, 4 Sep 2020 10:15:03 +0000 (12:15 +0200)]
Fix undefined behavior

Without the casts the bytes accesses get converted to int. but int is
not guaranteed to be 4 bytes large. Even when it is 4 bytes large
`bytes[3] << 24` does not fit because int is signed.

Signed-off-by: Valentin Kettner <vakevk@gmail.com>
3 years agoUse fixed size integer type
Valentin [Fri, 4 Sep 2020 10:12:56 +0000 (12:12 +0200)]
Use fixed size integer type

This type is meant to be 4 bytes large as seen in _XcursorReadUInt which
always reads 4 bytes. An unsigned int is often 4 bytes large but this
isnt' guaranteed so it is cleaner to use the exact type we want.

Signed-off-by: Valentin Kettner <vakevk@gmail.com>
3 years agoAdd a basic gitlab issue template
Peter Hutterer [Thu, 9 Jul 2020 04:44:04 +0000 (14:44 +1000)]
Add a basic gitlab issue template

This makes the Bug template available in the new issues form. Ideally a majority
of users will select this template and then realize that they're in the wrong
repo.

Making this a default is a feature of the enterprise gitlab version only, see
https://docs.gitlab.com/ce/user/project/description_templates.html#overview

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoprotocol: Minor gramatical fix.
Christopher James Halse Rogers [Fri, 14 Aug 2020 00:24:02 +0000 (10:24 +1000)]
protocol: Minor gramatical fix.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
4 years agoprotocol: disambiguate key codes in wl_keyboard.key
Simon Ser [Mon, 3 Feb 2020 14:45:58 +0000 (15:45 +0100)]
protocol: disambiguate key codes in wl_keyboard.key

Explain that wl_keyboard.key yields platform-specific key codes.
Some compositors use Linux key codes (defined in the
linux/input-event-codes.h header file, e.g. KEY_ESC), however
clients should not assume that this is always the case. The only
reliable way for clients to interpret key codes is to feed them
into a keyboard mapping.

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agoClarify clients behavior on wl_keyboard.leave
Kirill Chibisov [Sun, 24 May 2020 11:12:44 +0000 (14:12 +0300)]
Clarify clients behavior on wl_keyboard.leave

Clients must assume that every key, including modifiers, are lifted
after getting wl_keyboard.leave event, not doing so could lead to key repeat
keep going after the user changes focus, or stuck modifiers, when the user
interacts with client without keyboard focus.

Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
4 years agoClarify the order of wl_keyboard.modifiers
Kirill Chibisov [Sat, 23 May 2020 23:28:31 +0000 (02:28 +0300)]
Clarify the order of wl_keyboard.modifiers

Consider that we set the modifier for the modifier key as well, and that
you have the option to change your layout when both shifts pressed. This
realized by making the shift keys produce 'Group_switch' when you press
the shift key and the shift modifier is already active. So sending modifier
before the key event will result in 'Group_switch' each time you press
shift.

That being said, the order of modifiers should be updated after the
key/enter event, so it'll only affect future keypresses, not the current one.

See: https://lists.x.org/archives/xorg-devel/2014-July/043110.html

Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
4 years agodoc: Document libwayland-cursor with meson
Emmanuel Gil Peyrot [Wed, 22 Jan 2020 12:26:47 +0000 (13:26 +0100)]
doc: Document libwayland-cursor with meson

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 years agodoc: Document libwayland-cursor with autotools
Emmanuel Gil Peyrot [Wed, 13 Nov 2019 21:53:49 +0000 (22:53 +0100)]
doc: Document libwayland-cursor with autotools

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 years agocursor: Properly document wl_cursor_image and wl_cursor
Emmanuel Gil Peyrot [Wed, 13 Nov 2019 21:53:21 +0000 (22:53 +0100)]
cursor: Properly document wl_cursor_image and wl_cursor

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 years agocursor: Use spaces for alignment in the header
Emmanuel Gil Peyrot [Wed, 13 Nov 2019 19:39:01 +0000 (20:39 +0100)]
cursor: Use spaces for alignment in the header

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 years agoprotocol: add seat missing_capability error
Simon Ser [Thu, 28 May 2020 08:00:12 +0000 (10:00 +0200)]
protocol: add seat missing_capability error

The protocol says:

> It is a protocol violation to issue this request on a seat that
> has never had the pointer capability.

But never defines an error code.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/165

4 years agogitlab CI: update to use the fdo ci templates
Peter Hutterer [Thu, 4 Jun 2020 05:40:49 +0000 (15:40 +1000)]
gitlab CI: update to use the fdo ci templates

Instead of building a new debian image every time we build the repo, let's build
it once and re-use it. This way we're more  likely to spot actual bugs vs issues
with the distribution (or mirrors). This is the same approach mesa, gstreamer,
libinput, etc. already use.

The pipeline consists of two parts: container-build and distribution-image. Both
use the FDO_DISTRIBUTION_... variables to do their thing, the former to build an
image, the latter to use that image. The container-build step is a noop if an
image with that tag already exists in the registry, the templates take care of
all that.

The .debian.buster section groups the variables needed to easily extend all jobs
requiring buster. Not all variables are used by all jobs but meh.

The grouping is slightly odd because some debian-specific variables are in
the global variables and others in the .debian.buster section. This grouping
will make things easier if we extend to build on other distributions - then we
have all packages and tags in one place.

Because buster doesn't have a recent-enough version of meson, we install that
from pip.

Fixes #79

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agoeditorconfig: add settings for the .gitlab-ci.yml file
Peter Hutterer [Thu, 4 Jun 2020 05:40:08 +0000 (15:40 +1000)]
editorconfig: add settings for the .gitlab-ci.yml file

Different indentation and we don't want a fixed line length here, wrapping yaml
is prone to introduce bugs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agodoc: fix and clarify pointer image behaviour
Yann Dirson [Mon, 30 Mar 2020 16:29:08 +0000 (18:29 +0200)]
doc: fix and clarify pointer image behaviour

Signed-off-by: Yann Dirson <ydirson@free.fr>
4 years agoReplace initial 8 spaces with a tab for all xml files
Peter Hutterer [Thu, 16 Apr 2020 05:57:07 +0000 (15:57 +1000)]
Replace initial 8 spaces with a tab for all xml files

This is the style used in wayland.xml which is the only file we really
care about for git blame information. So let's adjust all others to that
style for consistency and fix editorconfig to avoid messing this up in
the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
4 years agoscanner: Guard interface declarations
Guido Günther [Tue, 21 Apr 2020 10:47:56 +0000 (12:47 +0200)]
scanner: Guard interface declarations

This allows to include client and server headers in the same file
fixing warnings like

In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16,
                 from ../src/desktop.h:16,
                 from ../src/server.h:13,
                 from ../tests/testlib.c:8:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:80:34: warning: redundant redeclaration of ‘zwlr_layer_shell_v1_interface’ [-Wredundant-decls]
   80 | extern const struct wl_interface zwlr_layer_shell_v1_interface;
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../tests/testlib.h:8,
                 from ../tests/testlib.c:7:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:77:34: note: previous declaration of ‘zwlr_layer_shell_v1_interface’ was here
   77 | extern const struct wl_interface zwlr_layer_shell_v1_interface;
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16,
                 from ../src/desktop.h:16,
                 from ../src/server.h:13,
                 from ../tests/testlib.c:8:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:106:34: warning: redundant redeclaration of ‘zwlr_layer_surface_v1_interface’ [-Wredundant-decls]
  106 | extern const struct wl_interface zwlr_layer_surface_v1_interface;
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../tests/testlib.h:8,
                 from ../tests/testlib.c:7:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:103:34: note: previous declaration of ‘zwlr_layer_surface_v1_interface’ was here
  103 | extern const struct wl_interface zwlr_layer_surface_v1_interface;

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Closes: #158

4 years agodoc/man: remove manually written man pages
Simon Ser [Thu, 16 Apr 2020 17:50:52 +0000 (19:50 +0200)]
doc/man: remove manually written man pages

There is only one page written. Having manually-written man pages duplicates
information with doc comments. Besides, man pages are already generated by
Doxygen.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/156

4 years agoclient: improve wl_display_connect docs
Simon Ser [Thu, 16 Apr 2020 17:49:12 +0000 (19:49 +0200)]
client: improve wl_display_connect docs

Add a paragraph about WAYLAND_SOCKET and describe what happens when the display
name is a relative path.

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agoREADME with upadated compile instructions
Ricardo Quesada [Tue, 7 Apr 2020 17:06:19 +0000 (10:06 -0700)]
README with upadated compile instructions

This commit updates the README build & install instructions.
It replaces that obsolete "autogen && make" with "meson && ninja"

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
4 years agomeson: Deduplicate generation of wayland-version.h
Matt Turner [Mon, 16 Mar 2020 23:47:05 +0000 (16:47 -0700)]
meson: Deduplicate generation of wayland-version.h

Signed-off-by: Matt Turner <mattst88@gmail.com>
4 years agomeson: Raise requirement to meson >= 0.52.1
Matt Turner [Mon, 16 Mar 2020 23:46:00 +0000 (16:46 -0700)]
meson: Raise requirement to meson >= 0.52.1

Many new and valuable features were added between Meson 0.49 and 0.52.1.
We would like to use some of them.

Signed-off-by: Matt Turner <mattst88@gmail.com>
4 years ago.gitlab-ci.yml: Switch from Stretch to Buster
Matt Turner [Mon, 16 Mar 2020 23:43:57 +0000 (16:43 -0700)]
.gitlab-ci.yml: Switch from Stretch to Buster

Stretch is old-stable and will reach end of life this year.

buster-backports has newer Meson available, so switching to Buster will
allow us to bump the Meson requirements.

Signed-off-by: Matt Turner <mattst88@gmail.com>
4 years agomeson: Add option to control building wayland-scanner
Matt Turner [Thu, 5 Mar 2020 20:04:36 +0000 (12:04 -0800)]
meson: Add option to control building wayland-scanner

Wayland requires a binary, wayland-scanner, to be run during the build
process. For any configuration other than native builds (including
cross compiling and even 32-bit x86 builds on an x86-64 build machine)
Wayland's build process builds and uses its own wayland-scanner.

For any builds using a cross file, wayland-scanner is built for the host
machine and therefore cannot be executed during the build of the Wayland
libraries. Instead builds using a cross file must execute the build
machine's wayland-scanner (typically /usr/bin/wayland-scanner).

As such, to build Wayland's libraries for a non-native ABI a package
manager must build and install /usr/bin/wayland-scanner first. But then
the build for the native ABI then rebuilds wayland-scanner itself and
doesn't use the system's, and worse, wants to install its own, which
conflicts with the /usr/bin/wayland-scanner already installed!

So, add the -Dscanner=... option to control whether to install
wayland-scanner.

Signed-off-by: Matt Turner <mattst88@gmail.com>
4 years agomeson: Require wayland-scanner of a matching version
Matt Turner [Fri, 6 Mar 2020 18:04:53 +0000 (10:04 -0800)]
meson: Require wayland-scanner of a matching version

We have always built libwayland with the scanner from the same build so
that the generated code and installed headers are exactly up-to-date
with the libwayland version. If libwayland was to use a scanner later
than itself, the scanner might do things that are not available in the
libwayland at hand, leading to a broken build or a broken library
(headers).

Signed-off-by: Matt Turner <mattst88@gmail.com>
4 years agoprotocol: add invalid_size error to wl_surface
Simon Ser [Wed, 26 Feb 2020 17:30:57 +0000 (18:30 +0100)]
protocol: add invalid_size error to wl_surface

This allows the compositor to send an error when the client submits a buffer
whose size is not divisible by the buffer scale. Previously, the protocol said
it was a client error but didn't specify any error code.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/issues/145

4 years agoutil: fix compiler warning
Tomek Bury [Mon, 24 Feb 2020 11:02:44 +0000 (11:02 +0000)]
util: fix compiler warning

conversion to 'wl_fixed_t {aka int}' from 'int64_t {aka long int}'
may alter its value [-Werror=conversion]

4 years agocursor/os-compatibility: move resizing into a separate function
Jan Beich [Sun, 16 Feb 2020 05:54:33 +0000 (05:54 +0000)]
cursor/os-compatibility: move resizing into a separate function

Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
4 years agocursor: ignore posix_fallocate in shm_pool_resize if not supported by FS
Jan Beich [Sat, 15 Feb 2020 15:16:51 +0000 (15:16 +0000)]
cursor: ignore posix_fallocate in shm_pool_resize if not supported by FS

Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
4 years agocursor: posix_fallocate may fail with EINVAL if not supported
Jan Beich [Sat, 15 Feb 2020 15:15:00 +0000 (15:15 +0000)]
cursor: posix_fallocate may fail with EINVAL if not supported

ZFS on FreeBSD >= 12.0 returns EINVAL, see
https://svnweb.freebsd.org/changeset/base/325320

Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
4 years agomeson/tests: add missing dependencies on protocol headers
Jan Beich [Sat, 15 Feb 2020 02:03:45 +0000 (02:03 +0000)]
meson/tests: add missing dependencies on protocol headers

In file included from ../tests/connection-test.c:43:
In file included from ../tests/test-compositor.h:30:
../src/wayland-client.h:40:10: fatal error: 'wayland-client-protocol.h' file not found
 #include "wayland-client-protocol.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../tests/display-test.c:45:
In file included from ../src/wayland-server.h:104:
src/wayland-server-protocol.h:4454:2: error: unterminated /* comment
        /**
        ^
In file included from ../tests/cpp-compile-test.cpp:2:
In file included from src/wayland-server-protocol.h:8:
In file included from ../src/wayland-server.h:104:
src/wayland-server-protocol.h:3:2: error: unterminated conditional directive
 #ifndef WAYLAND_SERVER_PROTOCOL_H
  ^
../tests/headers-protocol-test.c:33:2: error: including wayland-server-protocol.h did not include wayland-server.h!
 #error including wayland-server-protocol.h did not include wayland-server.h!
  ^
In file included from ../tests/headers-protocol-test.c:26:
In file included from src/wayland-client-protocol.h:8:
In file included from ../src/wayland-client.h:40:
src/wayland-client-protocol.h:1358:2: error: unterminated conditional directive
 #ifndef WL_SHM_FORMAT_ENUM
  ^
In file included from ../tests/protocol-logger-test.c:34:
In file included from ../src/wayland-client.h:40:
src/wayland-client-protocol.h:2613:1: error: unterminated /* comment
/**
^
../tests/resources-test.c:49:36: error: use of undeclared identifier 'wl_seat_interface'
        res = wl_resource_create(client, &wl_seat_interface, 4, 0);
                                          ^

4 years agobuild: re-open master for regular development
Simon Ser [Tue, 11 Feb 2020 23:55:32 +0000 (00:55 +0100)]
build: re-open master for regular development

4 years agobuild: bump to version 1.18.0 for the official release 1.18.0 upstream/1.18.0
Simon Ser [Tue, 11 Feb 2020 23:45:15 +0000 (00:45 +0100)]
build: bump to version 1.18.0 for the official release

4 years agobuild: bump to version 1.17.93 for the RC1 release 1.17.93
Simon Ser [Tue, 4 Feb 2020 23:32:03 +0000 (00:32 +0100)]
build: bump to version 1.17.93 for the RC1 release

4 years agoautotools: add Meson files to EXTRA_DIST
Simon Ser [Tue, 4 Feb 2020 14:15:20 +0000 (15:15 +0100)]
autotools: add Meson files to EXTRA_DIST

This allows users to build Wayland with Meson from an autotools-generated
release tarball.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/issues/141

4 years agobuild: bump to version 1.17.92 for the beta release 1.17.92
Simon Ser [Tue, 28 Jan 2020 21:02:25 +0000 (22:02 +0100)]
build: bump to version 1.17.92 for the beta release

4 years agotests: fix memory leak in proxy-test
Simon Ser [Tue, 10 Sep 2019 08:10:15 +0000 (11:10 +0300)]
tests: fix memory leak in proxy-test

When running tests with ASan, proxy-test fails at the proxy_tag test:

    ==27843==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x7f65a732dada in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:144
        #1 0x7f65a71cb3ea in wl_display_add_protocol_logger src/wayland-server.c:1813
        #2 0x557c640c0980 in proxy_tag tests/proxy-test.c:104
        #3 0x557c640c1159 in run_test tests/test-runner.c:153
        #4 0x557c640c1e2e in main tests/test-runner.c:337
        #5 0x7f65a6ea0ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)

    SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).

Destroying the logger fixes the leak.

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 493ab79bd2cd ("proxy: Add API to tag proxy objects")

4 years agoos: fallback for unsupported posix_fallocate
Ihor Antonov [Sat, 18 Jan 2020 05:13:12 +0000 (21:13 -0800)]
os: fallback for unsupported posix_fallocate

Some filesystems do not support fallocate and return EOPNOTSUPP.

On musl-based distros libwayland-cursor exits abruptly which causes the
application to crash. Unlike glibc, musl does not provide a fallback
mechanism for handling unsupported fallocate. Instead, musl developers
argue that application should handle the case of unsupported system
call.

This commit allows falback to ftruncate in case when EOPNOTSUPP
was recieved.

Signed-off-by: Ihor Antonov <ihor@antonovs.family>
4 years agoRemove unused HAVE_CONFIG_H define in meson
Emmanuel Gil Peyrot [Wed, 22 Jan 2020 12:40:42 +0000 (13:40 +0100)]
Remove unused HAVE_CONFIG_H define in meson

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 years agobuild: bump to version 1.17.91 for the alpha release 1.17.91
Simon Ser [Tue, 21 Jan 2020 14:18:48 +0000 (15:18 +0100)]
build: bump to version 1.17.91 for the alpha release

4 years agoprotocol: add missing enums for wl_data_device_manager.dnd_action
Simon Ser [Mon, 13 Jan 2020 18:00:33 +0000 (19:00 +0100)]
protocol: add missing enums for wl_data_device_manager.dnd_action

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agoevent-loop-test: Add test to verify timer ordering
Manuel Stoeckl [Thu, 26 Dec 2019 01:35:14 +0000 (20:35 -0500)]
event-loop-test: Add test to verify timer ordering

The new test verifies that, for a set of timers and a short sequence
of timer update calls, when the event loop is run the timer callbacks
are run in the expected order.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
4 years agoevent-loop: Track timer event sources in userspace
Manuel Stoeckl [Sat, 21 Dec 2019 15:15:56 +0000 (10:15 -0500)]
event-loop: Track timer event sources in userspace

libwayland now uses only one file descriptor to keep track of all
the timer event sources associated with an event loop. An array-based
binary heap is used to determine which event source has the earliest
deadline.

(Previously, each timer event source had its own timerfd, making it easy
for the a process using many timer event sources to run out of file
descriptors.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
4 years agoevent-loop-test: Confirm distant timers do not fire
Manuel Stoeckl [Thu, 16 Jan 2020 13:07:41 +0000 (08:07 -0500)]
event-loop-test: Confirm distant timers do not fire

This change expands the `event_loop_timer` test to use two different
timers with different timeouts; it now implicitly checks that e.g.
both timers do not expire at the same time, and that the first timer
expiring does not prevent the second from doing so. (While such failure
modes are unlikely with timer event sources based on individual
timerfds, they are possible when multiple timers share a common timerfd.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
4 years agoevent-loop-test: Verify proper timer cancellation
Manuel Stoeckl [Fri, 3 Jan 2020 19:25:04 +0000 (14:25 -0500)]
event-loop-test: Verify proper timer cancellation

The implementation of timer event sources based on timerfds ensured
specific edge-case behavior with regards to removing and updating timers:

Calls to `wl_event_loop_dispatch` will dispatch all timer event sources
that have expired up to that point, with one exception. When multiple
timer event sources are due to be dispatched in a single call of
`wl_event_loop_dispatch`, calling wl_event_source_remove` from within a
timer event source callback will prevent the removed event source's
callback from being called. Note that disarming or updating one of the
later timers that is due to be dispatched, from within a timer callback,
will NOT prevent that timer's callback from being invoked by
`wl_event_loop_dispatch`.

This commit adds a test that verifies the above behavior. (Because
epoll_wait is not documented to return timerfds in chronological order,
(although it does, in practice), the test code does not depend on the
order in which timers are dispatched.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
4 years agobuild: check wayland-scanner version
Simon Ser [Mon, 13 Jan 2020 18:27:19 +0000 (19:27 +0100)]
build: check wayland-scanner version

We need the --strict flag, released in wayland 1.14.0.

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agoautotools: use strict wayland-scanner mode
Simon Ser [Mon, 13 Jan 2020 18:18:13 +0000 (19:18 +0100)]
autotools: use strict wayland-scanner mode

Otherwise an invalid protocol will print warnings to stdout but won't
make the build fail.

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agomeson: use strict wayland-scanner mode
Simon Ser [Mon, 13 Jan 2020 17:56:35 +0000 (18:56 +0100)]
meson: use strict wayland-scanner mode

Otherwise an invalid protocol will print warnings to stdout but won't
make the build fail.

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agotests: Ensure that overflow test always overflows
Manuel Stoeckl [Sat, 11 Jan 2020 17:38:46 +0000 (12:38 -0500)]
tests: Ensure that overflow test always overflows

While the default Unix socket buffer size on Linux is relatively
small, on some computers the default size may be configured to
be huge, making the overflow test never actually overflow the
Wayland display socket.

The changed code now explicitly sets the display socket send buffer
size to be small enough to guarantee an overflow.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
4 years agotests: Fix race condition in send overflow test
Manuel Stoeckl [Wed, 25 Dec 2019 04:57:29 +0000 (23:57 -0500)]
tests: Fix race condition in send overflow test

This change ensures that the compositor process is not able to respond
to any of the noop requests sent by the client process, by using the
test compositor's `stop_display` mechanism to coordinate when the
compositor should stop processing messages.

(Before this change, it was possible that one of the calls of
wl_event_loop_dispatch in the compositor process could respond to all
the client's noop requests before returning.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
4 years agoRevert "build: check wayland-scanner version"
Simon Ser [Mon, 13 Jan 2020 18:32:44 +0000 (19:32 +0100)]
Revert "build: check wayland-scanner version"

This reverts commit c2ce50b9d7bd470c2fe8faa4b0d996fca0fcbbaa.

Pushed by mistake. Sorry about that.

4 years agobuild: check wayland-scanner version
Simon Ser [Mon, 13 Jan 2020 18:27:19 +0000 (19:27 +0100)]
build: check wayland-scanner version

We need the --strict flag, released in wayland 1.14.0.

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agodisplay-test: Remove unused variables
Daniel Stone [Mon, 13 Jan 2020 13:51:43 +0000 (13:51 +0000)]
display-test: Remove unused variables

At higher warning levels, GCC complains about unused variables.

Remove two completely unused, and one set-but-not-used, variables from
display-test to make it happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
4 years agoAdd Meson build
Emmanuele Bassi [Mon, 23 Apr 2018 13:29:16 +0000 (14:29 +0100)]
Add Meson build

Meson is a next generation build system, simpler than Autotools and also faster
and more portable. Most importantly, it will make integrating ASan easier in
CI.

The goal is to maintain feature parity of the Meson build with the
Autotools build, until such time when we can drop the latter.

Add a script which generates the desired Doxygen configuration for our various
output formats and executes it using that configuration. This is not something
Meson can or should do.

Fixes: https://gitlab.freedesktop.org/wayland/wayland/issues/80

[daniels: Changed to bump version, use GitLab issues URL, remove header
          checks not used in any code, remove pre-pkg-config Expat
  support, added missing include paths to wayland-egl and
  cpp-compile-test, added GitLab CI.
  Bumped version, removed unnecessary pkg-config paths.]

[daniels: Properly install into mandir/man3 via some gross
          paramaterisation, generate real stamp files.]

Pekka:
- squashed patches
- removed MAKEFLAGS from meson CI
- remove unused PACKAGE* defines
- fix up scanner dependency handling
- instead of host_scanner option, build wayland-scanner twice when cross-compiling
- changed .pc files to match more closely the autotools versions
- reorder doxygen man sources to reduce diff to autotools
- fix pkgconfig.generate syntax warnings (new in Meson)
- bump meson version to 0.47 for configure_file(copy) and run_command(check)
- move doc tool checks into doc/meson.build, needed in more places
- make all doc tools mandatory if building docs
- check dot and doxygen versions
- add build files under doc/publican
- reindent to match Weston Meson style

Simon:
- Remove install arg from configure_file
- Don't build wayland-scanner twice during cross-build
- Fix naming of the threads dependency
- Store tests in dict
- Add missing HAVE_* decls for functions
- Remove unused cc_native variable
- Make doxygen targets a dict
- Make dot_gv a dict
- Use dicts in man_pages
- Make decls use dicts
- Make generated_headers use dicts
- Align Meson version number with autotool's

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agoscanner: include config.h from command line
Pekka Paalanen [Mon, 11 Mar 2019 15:05:33 +0000 (17:05 +0200)]
scanner: include config.h from command line

Meson will need to build wayland-scanner twice with different config.h files,
once for build and another for host machine. It will be easier to include the
right config.h from compiler command line than playing with files.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agoSupport running tests from different build directories
Emmanuele Bassi [Mon, 23 Apr 2018 13:29:15 +0000 (14:29 +0100)]
Support running tests from different build directories

The tests that run exec-fd-leak-checker expect the binary to be located
in the current directory. This is not always the case; for instance, the
binaries could be built under `tests`, but be invoked under the
top-level build directory.

We can use an environment variable to control what's the location of the
test binaries, and fall back to the current directory if the variable is
unset.

Reviewed-by: Daniel Stone <daniels@collabora.com>
4 years agobuild/doc: Ensure destination dir exists despite VPATH
Daniel Stone [Sun, 22 Jul 2018 09:00:26 +0000 (10:00 +0100)]
build/doc: Ensure destination dir exists despite VPATH

Make considers a variable called VPATH when trying to satisfy
dependencies, e.g. for a target 'foo', it will consider the target
extant if VPATH is '../../bar' and '../../bar/foo' exists.

Part of the doc build, the '$(alldirs)' target, exists to create the
target directories if they do not exist. For example, before generating
xml/wayland-architecture.png, it will ensure the 'xml' target is
considered up-to-date thanks to the target dependency.

Creating $(srcdir)/doc/doxygen/xml thus means that the 'xml' dependency
will be satisfied, so we'll never create the output directory, and the
doc build will fail.

Change the alldirs target list to be absolute paths, so VPATH will not
be consulted and defeat the entire point of what we're trying to do.
This fixes the Meson build, where we later create
doc/doxygen/xml/meson.build.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
4 years agodoc: Expand the abbreviation "hw" to "hardware".
asynts [Sat, 4 Jan 2020 13:40:09 +0000 (14:40 +0100)]
doc: Expand the abbreviation "hw" to "hardware".

Out of the context it is reasonably clear that "hw" is indeed an abbreviation
for "hardware".

The use of "hw" in this place doesn't seem to be a stylistic choice, but rather
an oversight.

Signed-off-by: Paul Scharnofske <asynts@gmail.com>
4 years agoprotocol: fix typo in wl_data_offer.set_actions description
Michael Forney [Fri, 3 Jan 2020 05:06:51 +0000 (21:06 -0800)]
protocol: fix typo in wl_data_offer.set_actions description

Signed-off-by: Michael Forney <mforney@mforney.org>
4 years agoMove wl_priv_signal to wayland-server-private.h
Joshua Watt [Tue, 5 Nov 2019 15:09:50 +0000 (09:09 -0600)]
Move wl_priv_signal to wayland-server-private.h

Including wayland-server-core.h in wayland-private.h is problematic
because wayland-private.h is included by wayland-scanner which should be
able to build against non-POSIX platforms (e.g. MinGW). The only reason
that wayland-server-core.h was included in wayland-private.h was for the
wl_private_signal definitions, so move those to a
wayland-server-private.h file that can be included by both
wayland-server.c and the tests.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
4 years agoscanner: Add configure check for strndup
Joshua Watt [Sat, 26 Oct 2019 02:03:23 +0000 (21:03 -0500)]
scanner: Add configure check for strndup

Some platforms may not have strndup() (e.g. MinGW), so provide a
equivalent implementation if it's not found.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
4 years agoadding O_RDWR flag in the open()
Jiayuan Ren [Thu, 24 Oct 2019 22:31:56 +0000 (22:31 +0000)]
adding O_RDWR flag in the open()

According to the manual of open:
"The argument flags must include one of the following access modes:
O_RDONLY, O_WRONLY, or O_RDWR."

4 years agotests: add a test for wl_global_remove
Simon Ser [Tue, 10 Sep 2019 14:12:03 +0000 (17:12 +0300)]
tests: add a test for wl_global_remove

This test makes sure that after wl_global_remove:

* The global_remove event is sent to existing clients
* Binding to the removed global still works
* A new client will not see the removed global advertised

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agoserver: add wl_global_remove
Simon Ser [Sat, 20 Jul 2019 20:36:29 +0000 (23:36 +0300)]
server: add wl_global_remove

This commit adds a new wl_global_remove function that just sends a global
remove event without destroying it. See [1] for details.

Removing a global is racy, because clients have no way to acknowledge they
received the removal event.

It's possible to mitigate the issue by sending the removal event, waiting a
little and then destructing the global for real. The "wait a little" part is
compositor policy.

[1]: https://gitlab.freedesktop.org/wayland/wayland/issues/10

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agowayland-shm: Don’t set SIGBUS handlers on unshrinkable fd
Emmanuel Gil Peyrot [Mon, 22 Jul 2019 13:58:49 +0000 (15:58 +0200)]
wayland-shm: Don’t set SIGBUS handlers on unshrinkable fd

If a client set the F_SEAL_SHRINK seal on the fd before passing it to
the compositor, the kernel will ensure this fd won’t be able to shrink,
ever.  This allows us to avoid setting up the SIGBUS handlers on such
file descriptors.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 years agoserver: add wl_global_set_user_data
Simon Ser [Mon, 22 Jul 2019 16:41:22 +0000 (19:41 +0300)]
server: add wl_global_set_user_data

When implementing a workaround for [1], one needs to accept a global to be
bound even though it has become stale.

Often, a global's user data is free'd when the global needs to be destroyed.
Being able to set the global's user data (e.g. to NULL) can help preventing a
use-after-free.

(The alternative is to make the compositor responsible for keeping track of
stale user data objects via e.g. refcounting.)

[1]: https://gitlab.freedesktop.org/wayland/wayland/issues/10

Signed-off-by: Simon Ser <contact@emersion.fr>
4 years agoAdd $(RT_LIBS) to fixed-benchmark LD dependencies
Mosè Giordano [Mon, 16 Sep 2019 00:02:30 +0000 (01:02 +0100)]
Add $(RT_LIBS) to fixed-benchmark LD dependencies

`tests/fixed-benchmark.c` calls `clock_gettime`.

4 years agoscanner: prepend protocol name to types symbol
Marty E. Plummer [Sat, 11 May 2019 14:53:01 +0000 (09:53 -0500)]
scanner: prepend protocol name to types symbol

When doing unity builds via meson (example project:
https://github.com/swaywm/sway) multiple source files are glued together
via #include directives. Having every wayland-scanner generated source
file have an identifier named '*types[]' will lead to errors in these
unity builds if two or more of these are joined.

Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
4 years agotests: Test that send overflow doesn't abort
Manuel Stoeckl [Sun, 18 Aug 2019 16:36:14 +0000 (12:36 -0400)]
tests: Test that send overflow doesn't abort

The new display test runs a client that makes a very large number of
trivial requests. After responding to initial setup requests, the server
is paused, letting the trivial requests fill up the Unix socket buffer,
making further writes to the socket fail. The test then checks that the
client sets an appropriate error code, and does not abort or crash.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
4 years agoclient: Don't abort when sending a request fails
Manuel Stoeckl [Sat, 13 Jul 2019 21:54:14 +0000 (17:54 -0400)]
client: Don't abort when sending a request fails

Instead, set a fatal display error which will let an application
using libwayland-client shutdown cleanly.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>