Fix wl_data_offer source destroy listener

The listener function implementation was getting a wrong pointer to the
wl_data_offer object because the resource parameter is actually the
data source and not the data offer.
Fix server crash when a client dies during a drag with an icon

If a client dies during a drag that it started using an icon surface,
the server could crash because the icon surface is not valid anymore.

Fix this by using a destroy listener to reset device->drag_surface to
nil when the surface is destroyed.
wayland-server: Destroy resource before sending out delete_id event

In some cases, we send out events from the resource destructor and
those need to go out before we recycle the object ID.
scanner: emit event wrapper functions for server

Generate typed wrapper functions for sending events in a server.

This allows compile time type checking, unlike the existing method of
calling the variadic function wl_resource_post_event().

The stuff in wayland-server.h had to be slightly reordered to have all
(forward) declarations before use.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
server: use the event sending wrappers

This exposes some type mismatches that are fixed in the next commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
server: fix event sending type mismatches

These were not bugs in practice, because the first (and only) field of
struct wl_surface is struct wl_resource.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Terminate drag if data source is destroyed
tests: Add Unit tests for wl_map and wl_array data structures

We use a simple test-runner helper that runs each test in a separate
process and reports the pass/fail rate at the end.
tests: Print test status after running test

This way assert output will be a line by itself, which is easier to read
and lets editors such as emacs step through failed assertions.
connection: Export wl_connection_queue() so we can test it
test-runner: Fix warnings
tests: Add connection tests
tests: Add connection marshalling tests
Add tests subdir to toplevel SUBDIRS variable

Artie spotted this.
Add wl_array_for_each
Fix distcheck where protocol.xsl was missing in the tarball

To reproduce, invoke distcheck from an out-of-source tree.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
publican: support out-of-source tree build

When srcdir!=builddir, there is no way to tell publican that the source
is in srcdir rather than builldir. The workaround is to copy the source
files from srcdir to builddir. To retain the en-US final destination
name, the source directory is renamed to en_US.

Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
check: connection-test fails to link to ffi

This prevents distcheck from completing.
Moving the -lffi at the end of the command fixes the problem.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
scanner: Add since attribute

This will help us document when a request or event was added to the protocol.
tests: makefile error: missing test-runner.h

Detected by running distcheck

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>