configure.ac: Use wayland_version macro in bug url
client: Check reference count only for destroyed proxies

The llvm static analyzer tool reported "Use of memory after it is freed"
in dispatch_event() because the proxy is used after being freed if the
reference count reaches zero without the destroyed flag being set. This
would never happen in practice because the owner of the proxy object
always holds a reference until calling wl_proxy_destroy() which would
also set the destroyed flag.

Since this is the case, it is safe to do the reference count check only
if the destroyed flag is set, as it can never reach zero if not.

This commit doesn't change the behavior of the function, but makes the
static analyzer more happy.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=61385

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
client: Invoke new_id closure arguments as pointers instead of integers

This commit adds a flags parameter to wl_closure_invoke(). The so far
added flags are ment to specify if the invokation is client side or
server side. When on the server side, closure arguments of type 'new_id'
should be invoked as a integer id while on the client side they should
be invoked as a pointer to a proxy object.

This fixes a bug happening when the address of a client side 'new_id'
proxy object did not fit in a 32 bit integer.

krh: Squashed test suite compile fix from Jason Ekstrand.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Change wl_closure_invoke to take an opcode instead of an actual function pointer

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Add wl_resource_init and use it in libwayland implementations of data sharing and SHM

This commit adds a wl_resource_init function for initializing wl_resource
structures similar to wl_client_add_object.

From this commit forward, wl_resource structures should not be initialized
manually, but should use wl_resource_init.  In the event of a change to the
wl_resource structure, this allows us to protect against regressions by filling
in added fields with reasonable defaults.  In this way, while changing
wl_object or wl_resource still constitutes an ABI break, compositors following
this rule will only need to be recompiled in order to properly link against the
new version.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
protocol: remove implicit attach semantics

To match the Weston commit e7144fd175d1d68b91aa0cec7ab63381b79385a9:
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Mon Mar 4 12:11:41 2013 -0500

    compositor: Only send release event in response to wl_surface.attach

Remove the implicit attach semantics from wl_surface.commit and .attach.

Before, if you did this on a wl_surface: attach, commit, commit, you
would receive wl_buffer.release for both commits. After this change, you
will only receive wl_buffer.release for the first commit. To get a
second release, the same buffer must be attached again.

There is no need for the implicit attach on the second commit. If the
compositor needs the wl_buffer for repainting, it will not release it to
begin with. If the compositor does not need to keep the wl_buffer around
for repainting, it will not need it for a new commit either.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
docs: Add a revision history

Publican complains if it can't find this file.
docs: Fix the documentation build

The publican man page says that the options are actually called
--formats and --langs, and with this, the doc build succeeds.
wayland-server: Avoid deferencing a NULL pointer in error case

Reorder the error handling in the case that closure is NULL due to ENOMEM to
ensure that we can safely call wl_closure_lookup_objects on the second test.
Prior to this reordering the closure would be deferenced in the ENOMEM case
due to the invocation of the second half of the logical OR check.
docs: Reorder some sections

Move the 'Types of Compositors' section right after the Overview,
and move the 'Client API' part after the protocol spec.
docs: Slight rewording

The Wayland Protocol -> Wayland Protocol Overview, to align
better with the subsequent Wayland Protocol Specification.
docs: Improve the 'Types of Compositors' section

Turn the bullet-point lists into full paragraphs.
docs: Improve the 'Connect time' section

Turn the bullet-point list into complete sentences.
doc: Improve various sections of the documentation
docs: Consistency fixes

Say 'object ID' throughout.
docs: Improve wl_display protocol docs

This adds a bit of information about in-order event delivery,
removes extraneous formatting, and adds a missing period.
docs: Improve the wl_registry protocol docs

Reword a few things, and add some details.
docs: Improve wl_callback protocol docs

Add some information about wl_callback and its done event.
docs: Improve wl_shm and wl_shm_pool protocol docs

Reword some paragraphs, and spell out 'file descriptor'.
docs: Improve the wl_data_* procol docs

Add a few missing summaries and descriptions, spell out file
descriptor, use hyphens in drag-and-drop, don't use hyphens in
'mime type', and reword a few things.