Fix window decorations to be thread safe

Rather than have window decorations that paint directly to the paint
device representing the window surface, window decorations are now
generated on demand into a backing store based on their current state,
and then are rendered to a surface when needed.

There is still a problem with resizing though that needs to be
addressed.

Change-Id: I7516628239eb0f9ae46d49bcb4bb2cb94ec6a617
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Make resizing thread-safe

Change-Id: I57407fe3d3877f59b1587ec94ff88a44195271cb
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Remove unnecessary blocking roundtrip

Change-Id: Ie12cdc1d2d931dc86497188d69b34bae47fa6dcc
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Forgot to clear state after resize

Change-Id: I596cba84a1d4e36daa58ddcce02a02ca8320712d
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Use the api instead of accessing "private" static variables

Change-Id: I1dd7fe72de5b88d4bbde1d91912abd78ff833a64
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Add warning to makeCurrent if it fails

and remove code thats not needed anymore

Change-Id: Ie79b1bd3d3cb632ba75ec429c1323ee679b274a9
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Need to NULL check for waylandBufferHandle of m_backBuffer

After unmapped, waylandBufferHandle of m_backBuffer can be null
when another buffer attached before sendFrameCallback() called.

Change-Id: I3470e42ca09466c5b2ecc6d6438090f5af50f59d
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Fix threaded resizing once more :)

This time make Scenegraph also play along nicely

Change-Id: I8d52fe2fc514466cef40e247e978434d8014e18b
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Introduced qtwaylandscanner.

Generates C++ headers with Qt types based on the Wayland XML protocol files,
to reduce a lot of code duplication in all the places that interface between
Qt and the wayland protocol headers.

Change-Id: I34a4417d3d3d0238de2f2f74986855d097b50ec9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Adapted code to use qtwaylandscanner.

We include the wayland.xml since we need to generate bindings for the
core protocol as well.

Also, WAYLANDSOURCES has been split into WAYLANDSERVERSOURCES and
WAYLANDCLIENTSOURCES since we need to produce different output in the
server and client cases.

Change-Id: I0bd493d41ca6b26dfd2d9b1463d4b762786537f9
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fixed broken wayland_scanner config.test.

We need to replicate the extra compiler rule to invoke the
wayland-scanner without trying to invoke the qtwaylandscanner.

Change-Id: I312b24103f63570080c32103fb352f1948308f15
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Fix variable name in QWaylandInputDevice::keyboard_modifiers

Follow-up commit for Change I0bd493d4, for non-xkb builds

Change-Id: I34e331e981d278cc1c184740c0f973d54836a0c3
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Use surfaceBuffer's image to get image for shm surface

Allowing to get same image instance if the surface is not
damaged, TextureCahche can get same hash key for unchanged
source image. Also saves instructions for constructing QImage.

Change-Id: Iba8df32c9c2bf735e31819db9adaa4f704ab6d22
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Adapted Surface and Region to use the qtwaylandscanner.

This requires some slight additions to the qtwaylandscanner to handle
the pattern of the wl_resource not being owned by the generated class.

Change-Id: Ia49c8129cee3a203ca9a727e83fafd3dfc653e75
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fixed client being blocked in xcomposite integrations.

There's no need to wait for a sync until a frame has been rendered. As
it was the client ended up waiting for a sync that never came.

Change-Id: I41828d76ae62f1fa13f15bc050a16dd8e384fff4
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fixed / cleaned up xcomposite integrations.

Compile fix and adaptation after qtwaylandscanner changes.

Change-Id: I3dbaaaf6c01e1b5d5a7a36fedc036d3b0d20a4bc
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fixed EGL_BAD_MATCH error with xcomposite-egl.

Context and surface need to be created with the same EGLConfig.

Change-Id: I5ffd148d61ae67ca5ebd2d8382e635be7babc2df
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fixed hellowindow with multiple windows in xcomposite-egl.

Multiple contexts are calling blockingReadEvents() from multiple
threads, while the window belongs to one thread. So the
mWaitingForFrameSync might get set to false by another thread while the
current thread is stuck in blockingReadEvents(). This leads to animating
blocking until something else puts events on the wayland event queue,
for example mouse move events.

Change-Id: Id76a82e500753c5817d25298662851c4a6505553
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Made egl and wayland_egl config.tests require GLES2 configured Qt.

Otherwise the platform native interfaces won't return a valid
"EGLDisplay" handle, which is required for all the EGL based
integrations to work.

Change-Id: I9d5031878da5bf87e1366150f75d000a2f5fc280
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fixed build issue due to not finding "wayland-client.h".

We need to use pkg-config to add the proper include path to the CXXFLAGS.

Change-Id: I51c388a3dd050514758997492c1fb1efb87b2837
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>