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
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>
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>
When an application and a toolkit share the same Wayland connection,
it will receive events with each others objects. For example if the
toolkit manages a set of surfaces, and the application another set, if
both the toolkit and application listen to pointer focus events,
they'll receive focus events for each others surfaces.
In order for the toolkit and application layers to identify whether a
surface is managed by itself or not, it cannot only rely on retrieving
the proxy user data, without going through all it's own proxy objects
finding whether it's one of them.
By adding the ability to "tag" a proxy object, the toolkit and
application can use the tag to identify what the user data pointer
points to something known.
To create a tag, the recommended way is to define a statically allocated
constant char array containing some descriptive string. The tag will be
the pointer to the non-const pointer to the beginning of the array.
For example, to identify whether a focus event is for a surface managed
by the code in question:
static const char *my_tag = "my tag";
static void
pointer_enter(void *data,
struct wl_pointer *wl_pointer,
uint32_t serial,
struct wl_surface *surface,
wl_fixed_t surface_x,
wl_fixed_t surface_y)
{
struct window *window;
const char * const *tag;
tag = wl_proxy_get_tag((struct wl_proxy *) surface);
if (tag != &my_tag)
return;
window = wl_surface_get_user_data(surface);
...
}
...
static void
init_window_surface(struct window *window)
{
struct wl_surface *surface;
surface = wl_compositor_create_surface(compositor);
wl_surface_set_user_data(surface, window);
wl_proxy_set_tag((struct wl_proxy *) surface,
&my_tag);
}
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
When compiling wayland with slibtool instead of GNU libtool
it will fail building libtest_runner with an undefined
reference to pthread_join@@GLIBC_2.2.5. This is because
-pthread (Or -lpthread) is missing from display_test. If its
added the build succeeds as expected with slibtool and
continues to work with libtool. Its likely that libtool is
hiding this failure by silently adding the missing flag which
is not uncommon...
Exposed in commit aa51a833eb.
Fixes https://gitlab.freedesktop.org/wayland/wayland/issues/91
Signed-off-by: orbea <orbea@riseup.net>
The test runs wayland_scanner on a set of XML protocol files which
have malformed element names, and confirms that an error is produced
and indicates the correct line.
Copyright notifications are not included in the test files, as
they are not code; of course, the project license still applies.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
So far I got these errors before patching:
libtool: link: cc -o .libs/headers-test -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/headers-test.o tests/headers-protocol-test.o tests/headers-protocol-core-test.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at headers-test.c:53 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/headers-test.c:53)
>>> tests/headers-test.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>> test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a
libtool: link: cc -o .libs/exec-fd-leak-checker -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/exec-fd-leak-checker.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at exec-fd-leak-checker.c:57 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/exec-fd-leak-checker.c:57)
>>> tests/exec-fd-leak-checker.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>> test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a
Makefile.am: error: object 'tests/test-helpers.$(OBJEXT)' created both with libtool and without
libtool: link: cc -o .libs/fixed-benchmark -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/fixed-benchmark.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at fixed-benchmark.c:100 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/fixed-benchmark.c:100)
>>> tests/fixed-benchmark.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>> test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a
This commit fixes all of that.
Signed-off-by: Leonid Bobrov <mazocomp@disroot.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Gitlab expects a CONTRIBUTING.md in the root directory, so move our
guide there.
Conversion to proper markup is a follow-up patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
A previous patch used $NM as an environment variable, but this was only
set as a make variable. Make sure it is passed through from make to the
environment we use to run tests.
v2: Quote argument when passing to shell.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fixes: 6903e4d539 ("wayland-egl: use correct `nm` path when cross-compiling")
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Earlier commit changed to passing the binary name as env. variable
introducing a typo.
That went unnoticed, since we do not check if the file is present or
not.
Cc: Pukka Paalanen <ppaalanen@gmail.com>
Cc: Daniel Stone <daniels@collabora.com>
Fixes: 85cb5ed64a ("wayland-egl-symbols-check: pass the DSO name via
the build system")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
First one is deprecated in favour of the second option.
The latter is newly introduced and annotates the generated symbols
accordingly.
v2: Don't introduce small-public-code.c - reuse small-code.c (Pekka)
Cc: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
The core wayland interfaces are public, via the libwayland-server and
libwayland-client DSOs. Hence use "public-code" cmdline option, instead
of the deprecated code".
As the host wayland-scanner may not know about the new option, use the
legacy "code".
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Now we have all the wayland-egl bits in a single place.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
The location of the file is build system specific so, keep it there.
Cc: Daniel Stone <daniels@collabora.com>
Suggested-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
Wire-up the imported sources, test and pkg-config files.
v2:
- Don't mangle with existing EXTRA_DIST list
- Add the symbols check script to the `make check' target
- Rename wayland-egl-{priv,backend}.h
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
In f74c9b98db I added tests.xml to the
repository, but not to the distribution tarball.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Until recently, if a client destroying a resource raced with the
server generating an event on that resource that delivered a file
descriptor, we would leak the fd.
This tests for a leaked fd from that race condition.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
All the foo.in files are in the tarball, as long as their foo
counterparts are listed in AC_CONFIG_FILES
For example - *.pc.in, Makefile.in files, etc.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When input/output files are passed as arguments to wayland-scanner,
instead of using stdin/stdout, warning and error messages will contain
the file name, together with line number, of the warning/error. Doing
this helps IDEs jump to the correct line.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Pekka: dropped the src/scanner.mk hunk, file deleted]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
wl_list_for_each_safe, which is used by wl_signal_emit is not really
safe. If a signal has two listeners, and the first one removes and
re-inits the second one, it would enter an infinite loop, which was hit
in weston on resource destruction, which emits a signal.
This commit adds a new version of wl_signal, called wl_priv_signal,
which is private in wayland-server.c and which does not have this problem.
The old wl_signal cannot be improved without breaking backwards compatibility.
Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add tests that ensure that wayland-scanner output for a given input does
not change unexpectedly. This makes it very easy to review
wayland-scanner patches.
Before, when patches were proposed for wayland-scanner, I had to
build wayland without the patches, save the generated files into a
temporary directory, apply the patches, build again, and diff the old
vs. new generated file.
No more. Now whenever someone makes intentional changes to
wayland-scanner's output, he will also have to patch the example output
files to match. That means that reviewers see the diff of the generated
files straight from the patch itself. Verifying the diff is true is as
easy as 'make check'.
The tests use separate example XML files instead of wayland.xml
directly, so that wayland.xml can be updated without fixing scanner
tests, avoiding the churn.
example.xml starts as a copy of wayland.xml. If wayland.xml starts using
new wayland-scanner features, they should be copied into example.xml
again to be covered by the tests.
This patch relies on the previous patch to actually add all the data
files for input and reference output.
The scanner output is fed through sed to remove parts that are allowed
to vary: the scanner version string.
v2: no need for scanner-test.sh to depend on the test data
Task: https://phabricator.freedesktop.org/T3313
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> (v1)
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Put also test programs into noinst_PROGRAMS so that they get always
built. In check_PROGRAMS they are built for 'make check' but not for
'make'.
This makes it harder to accidentally break the test programs.
v2: also change check_LTLIBRARIES to noinst_LTLIBRARIES
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
If you assign TESTS into check_PROGRAMS, you cannot add a test that is
not built from source files.
Instead, use a temporary variable built_test_programs to hold the names
that are both programs built from source files and tests to execute.
This change is required by the following patch adding wayland-scanner
test script.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
The new wl_display_add_protocol_logger allows to set a function as
a logger, which will get called when a new request is received or an
event is sent.
This is akin to setting WAYLAND_DEBUG=1, but more powerful because it
can be enabled at run time and allows to show the log e.g. in a UI view.
A test is added for the new functionality.
Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Using display object, Emit a signal if a new client is created.
In the server-side, we can get the destroy event of a client,
But there is no way to get the created event of it.
Of course, we can get the client object from the global registry
binding callbacks.
But it can be called several times with same client object.
And even if A client creates display object,
(so there is a connection), The server could not know that.
There could be more use-cases not only for this.
Giulio: a test is added for the new functionality
Signed-off-by: Sung-jae Park <nicesj@nicesj.com>
Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When configured with --disable-dtd-validation:
CPPAS src/dtddata.o
src/dtddata.S: Assembler messages:
src/dtddata.S:39: Error: file not found: src/wayland.dtd.embed
Makefile:1520: recipe for target 'src/dtddata.o' failed
This is because the variable name used does not match the implicit
variable name in autoconf.
Fix the variable name, making both --disable-dtd-validation and
--enable-dtd-validation to what they should.
Do not try to build dtddata.S if dtd-validation is disabled. It depends
on wayland.dtd.embed which is created by configure only if
dtd-validation is enabled.
If not building dtddata.S, also make sure the extern definitions in
scanner.c are compiled out.
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=575212
Reported-by: leio@gentoo.org
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
This reverts commit 8125919b0d.
This makes things far more annoying than intended, especially since
the list of default warnings isn't consistent from distro to distro.
Automake seems to have its own rules for compiling an .o from an .S.
Essentially it does the same as our hand-crafted rule, but adds some
things like dependency file generation.
Remove our hand-crafted rule to use the automake rule, it is less
surprising.
http://www.gnu.org/software/automake/manual/html_node/Assembly-Support.html
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Víctor Jáquez <vjaquez@igalia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Embed the wayland.dtd protocol data into the scanner binary so we can validate
external protocol files without requiring makefile changes. Hat-tip to Pekka
Paalanen for the embedding trick.
The embedding trick doesn't work well if the to-be-embedded file is in a
different location than the source file, so copy/link it during configure and
then build it in from the local directory.
The current expat parser is not a validating parser, moving scanner.c to
another parser has the risk of breaking compatibility. This patch adds libxml2
as extra (optional) dependency, but that also requires parsing the input
twice.
If the protocol fails validation a warning is printed but no error is returned
otherwise.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This reverts commit 06fb8bd371.
Having a DTD hooked up gives an indication of what we expect the protocol to
be, which is a clearer documentation than the current "whatever scanner.c
manages to parse".
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The wayland scanner defines the protocol. The DTD specification is not used.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com>
This splits the bulk of libwayland-util into libwayland-private.
libwayland-util (which is just wayland-util.c) is for use with the scanner.
libwayland-private is everything else.
Most things will want to link both libs.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
The previous idiom for building a cross-compiled Wayland is to build once for
the build host (with --enable-scanner --disable-libraries) to get a
wayland-scanner binary that can then be used in a cross-compile (with
--disable-scanner). The problem with this is that the cross wayland is missing
a wayland-scanner binary, which means you then can't do any Wayland development
on the target.
Instead, always build wayland-scanner for the target and change
--enable/disable-scanner to --with/without-host-scanner. Normal builds use the
default of --without-host-scanner and run the wayland-scanner it just built, and
cross-compiled builds pass --with-host-scanner to use a previously built host
scanner but still get a wayland-scanner to install.
(a theoretically neater solution would be to build two scanners if required (one
to run and one to install), but automake makes this overly complicated)
[daniels: Bikeshedded naming with Ross's OK.]
Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This will make it easier if we ever want to add new flags to everything
in the future.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The scanner doesn't need anything but wayland-util.c/.h so we can
shrink wayland-util when not building the main libraries.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When cross-compiling it may be useful to build only the wayland-scanner
natively. This patch makes it possible to disable build of the libraries.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
AM_CFLAGS are the defaults passed to anything that doesn't specify its own
_CFLAGS, so instead of putting FFI_CFLAGS there, let's just add that to
anything that actually needs it.
The only thing that needs it but didn't have it specifically was
libwayland_util (for connection.c)
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
AM_CFLAGS and AM_CPPFLAGS aren't positional, so putting them at a
random place in Makefile.am can be misleading.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Some newer versions of doxygen are generating this file now, and if
we don't clean it up distcheck will fail.
Known to affect doxygen 1.8.8 from debian jessie.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Tested-by: Jon A. Cruz <jonc@osg.samsung.com>
This test checks that the protocol and library headers include only what
they are supposed to include. That is, that the core headers do not
include the protocol headers and that the core protocol headers do not
include the non core library headers.
The build process now generates core protocol headers, but they are only
used in the test and don't get installed.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The new core header doesn't include any other header, since it really
is not needed.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
wayland-client.h and wayland-server.h include the protocol headers generated
at build time. This means that a libwayland user cannot generate and use
protocol code created from a wayland.xml newer than the installed libwayland,
because it is not possible to only include the API header.
Another use case is language bindings, which would generate their own protocol
code and which only need to use the library ABI, not the generated C code.
This commit adds wayland-client-core.h and wayland-server-core.h which do not
include the protocol headers or any deprecated code.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This is now done in the same way as the libffi dependency and still
allows the library to be installed in a non-standard location (with
PKG_CONFIG_PATH).
This test includes one of wayland headers, which produced
error with C++ compiler. C compiler can't be used for this test,
because it issues only a warning[1] and only when wayland headers
are not installed in system headers path (/usr/include).
[1] wayland-server-protocol.h:201:2: warning: implicit declaration of function ‘wl_resource_post_event’
[daniels: Merged in Marek's follow-up to check for a C++ compiler.]
Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>