dbe: Cleanup in CloseScreen hook not ext CloseDown

Instead of registering an extension CloseDownProc when adding the dbe
extension this patch hooks into pScreen->CloseScreen so that the chain
of pScreen->DestroyWindow hooks remains valid until all windows have
been destroyed. Previously it was possible for DbeResetProc to be called
before the root window had been destroyed and the unwrapping of
pScreen->DestroyWindow would clobber the chain of callbacks.

This is needed for xwayland to be able to know when the root window is
destroyed so it can unredirect root sub-windows.
xkb: Add struct XkbCompContext

This commit adds a struct that contains most of the context for starting,
running and cleaning up after xkbcomp.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
xkb: Split out code to start and finish xkbcomp

Using the context struct from previous commit, we can now split out
code to start xkbcomp and to finish and clean up after it.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
xkb: Add XkbCompileKeymapFromString()

This new function compiles a keymap from an in-memory string.  We use it
to add a new keyooard device init function,
InitKeyboardDeviceStructFromString(), which inits a keyboard device with
a keymap specified as a string instead of a rmlvo set.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
os: Add a function to create a client for an fd
Export xf86NewInputDevice and xf86AllocateInput
Add redirect window for input device feature
dri2: Introduce a third version of the AuthMagic function

This most recent version takes a client pointer to allow xwayland to
asynchronously authenticate a client.
xkb: Repurpose XkbCopyDeviceKeymap to apply a given keymap to a device

This will also make it useful for cases when we have a new keymap to
apply to a device but don't have a source device.
xkb: Factor out a function to copy a keymap's controls unto another
Add xwayland module

Squashed and rebased from the xwayland-1.12 branch.  Contributions from

  Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
  Corentin Chary <corentin.chary@gmail.com>
  Daniel Stone <daniel@fooishbar.org>
  Kristian Høgsberg <krh@bitplanet.net>
  Robert Bragg <robert@linux.intel.com>
  Scott Moreau <oreaus@gmail.com>
  Tiago Vignatti <tiago.vignatti@intel.com>
  Giovanni Campagna <gcampagn@redhat.com>
  Jonas Ådahl <jadahl@gmail.com>
  Ray Strode <rstrode@redhat.com>
  Trevor McCort <tjmccort@gmail.com>
  Rui Matos <tiagomatos@gmail.com>