Rework the way buffers are used and rendered

The current way buffers are handled is sub-optimal. They are hidden
inside QtWayland::Surface and the actual renderer, be it QtQuick or
anything else, cannot get a direct hold of them, nor it can directly
control when the underlying textures are created or deleted.

The main additions in this commit are the splitting of the QtQuick
code path and the new QWaylandBufferRef and QWaylandBufferAttacher
classes.
QWaylandBufferRef allows a renderer to retain a reference
to a wl_buffer even after the underlying Surface discarded it.
That allows the renderer to directly decide when to destroy the texture
of the buffer.
QWaylandBufferAttacher is a pure virtual class which must be implemented
by the renderer. Instances of it will be assigned to the QWaylandSurfaces,
created. Its attach() virtual method will then be called when a new buffer
is committed to the surface. The renderer can then choose to immediately
create a texture or wait for some later time. It is its responsibility to
create and destroy the GL texture, it will not happen automatically.
This functionality is implemented for QtQuick in the new QWaylandQuickCompositor
and QWaylandQuickSurface classes.

Change-Id: I674b4e5fb8c65c3b1c582e33ff3a0b0e45f2acc9
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Let the ShellSurface send the mapped and unmapped signals.

A surface without any attached shell surface should never be mapped,
so make the latter set the mapped state on the surface.

Change-Id: If09bd9eebecd6e0a52f862cb866d85aec403c3a0
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Split QWaylandSurface in a model and view fashion

QtQuick compositors already use a view class (QWaylandSurfaceItem),
so add a new QWaylandSurfaceView, which is subclassed by
QWaylandSurfaceItem, and move the view related methods of QWaylandSurface
there. A QWaylandSurface can have many views.

Change-Id: I7e92fe1f7e9d252f5f40a3097feabb5f3318b03a
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Fix possible racey crash after surface destruction

Change-Id: Ic9f231fc6935d787f4d6aa6f69725b290abad37d
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Make it possible to have custom shell implementations

Different compositors may need different shell behaviors, or
even different shell protocols. A smartphone compositor, for
example, may want to make wl_shell_surface::set_popup or
other requests noop, because they don't make sense in the
formfactor, or it may even want to not implement wl_shell_surface
at all, but some smartphone_shell_surface.
A compositor may define its own shell implementation by overriding
QWaylandCompositor::initShell(), and creating there its interface
instance. The default implementation still creates the built-in
wl_shell_surface implementation.

Change-Id: I143b0cd4e30e31d4051ada6e562d486d9bf1a751
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Send the native codes of the key events

Change-Id: I58343ebf931d946a9d1dfc1f0949ba296d97ec52
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Fix compilation on c++03

Change-Id: I34833898bd26dd7113fbfb42cd486e43926eac59
Reviewed-by: Mikko Levonmaa <mikko.levonmaa@lge.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Support configurable capabilities for input devices

Change-Id: I070f7daec8fb13a7db838b3d0c67e8aebc790a6c
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>