connection: zero out string padding

We don't want to send random data to the client and this also keeps
valgrind happy.
Fix grammar in the rendering section.

Upon reading some docs, I found a small grammar mistake in the
rendering section. This patch fixes that.
Add support for X cursor themes.

This patch adds a few more directories to search for xcursor themes.

Along with the weston patch, this adds the ability to configure weston
to use an X11 cursor theme. Previously, wayland cursor would just look
in the icons and pixmaps directories for cursor images to load. This
adds the ability to also search in the x cursors directory.
socket-test: don't try to be clever, fail if no XDG_RUNTIME_DIR is set

Not only setenv(), also putenv() allocates memory on my system
(glibc 2.16.0). Just fail with a clear message if XDG_RUNTIME_DIR is
not set.

https://bugs.freedesktop.org/show_bug.cgi?id=52618
protocol: Fix typo.
client: Add wl_display_connect_to_fd() function

This lets us connect a display to an already existing socket fd.
Add wl_shm_buffer_create()
tests: Allow disabling leak checking assertions by env

Some code coverage tools trigger these assertions when run against the test
suite since they don't free all their memory.
tests: ensure sanity leak check tests pass when leak checks are disabled.

This finalizes Robert Bradfords patch to allow NO_ASSERT_LEAK_CHECK
environment variable to disable leak checks in unit tests.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
tests: Quiet warning
cursor: Add a default cursor theme

This theme is loaded when the specified cursor theme can not be found.

These cursors are extracted from the xorg sources and transformed into
raw ARGB data by a small helper program (commited separately).
cursor: add cursor.pcf and extraction program
event-loop: remove dead code

There is really no need to increment "n" if we never read the value. The
do-while() loop overwrites the value before it is read the first time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
wayland-server: return new ID in wl_client_add_resource()

wl_client_add_resource() used to return no error even though the new
resource wasn't added to the client. This currently makes it very easy to
DOS weston by simply posting thousands of "create_surface" requests with
an invalid ID. Weston simply assumes the wl_client_add_resource() request
succeeds but will never destroy the surface again as the "destroy" signal
is never called (because the surface isn't linked into the wl_map).

This change makes wl_client_add_resource() return the new ID of the added
object and 0 on failure. Servers (like weston) can now correctly
immediately destroy the surface when this call fails instead of leaving
the surface around and producing memory-leaks.

Instead of returning -1 on failure and 0 on success, I made it return the
new ID as this seems more appropriate. We can directly use it when calling
it with new_id==0.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
event-loop: export wl_event_loop_dispatch_idle()

When integrating the wayland event-loop into another event-loop, we
currently have no chance of checking whether there are pending idle
sources that have to be called. This patch exports the
"dispatch_idle_sources()" call so other event loops can call this before
going to sleep. This is what wl_event_loop_dispatch() currently does so we
simply allow external event-loops to do the same now.

To avoid breaking existing applications, we keep the call to
dispatch_idle_sources() in wl_event_loop_dispatch() for now. However, if
we want we can remove this later and require every application to call
this manually. This needs to be discussed, but the overhead is negligible
so we will probably leave it as it is.

This finally allows to fully integrate the wayland-server API into
existing event-loops without any nasty workarounds.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Fix typo (ratio, not ration)

Signed-off-by: Diego Viola <diego.viola@gmail.com>
protocol: Fix typo

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
man: add man-page infrastructure

This adds a man-page infrastructure based on Docbook XML files. This
allows us to integrate the man-pages into the publican books later. An
example page for wl_display_connect() (with an alias
wl_display_connect_to_fd()) is also added.

Feel free to add more man-pages. Function calls are put in man3 and
overview pages into man7. All pages (including aliases) have to be added
to the Makefile.

Docbook does generate aliases automatically from the additional names that
were put in the XML file. However, a small SED script is needed to fixup
the include-paths in the generated troff files. If someone knows how to
avoid that (or even install them gzip'ped), please fix it up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
man: fix compilation without xsltproc

We really shouldn't add the man-pages when HAVE_XSLTPROC is not true so
move it into the if-clause.
But declare the automake-variables outside of the if-clause to avoid
automake complaints.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
connection: Drop unused static closures