Rename QWaylandDecoration => QWaylandAbstractDecoration

This is in preparation for decoration plugins.

Change-Id: Idb322a7a5cbc2eb5bf2cce019073f9f4fb46297f
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
QtWaylandClient: Pluginize window decorations.

Convert to a D-pointer, split between abstract base class and an implementation.

Also move implementation of the current built-in decoration to the "bradient"
plugin, named in glorious memory of the programmer-designed blue gradient that
will forever sear our eyeballs.

The decoration plugin may be specified using the environment variable
QT_WAYLAND_DECORATION.

Change-Id: Idc99ab06ae138ad299bad2b62b9595379bd007ab
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
decorations: Remove strange set dance between QWaylandWindow & QWaylandAbstractDecoration.

This makes absolutely no sense. Just do things inline.

Change-Id: Ic6d4e62bc9b3c0a4533f63740f2608a0be201047
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Use the screen resolution to determine whether a screen is portrait

We were using the screen physical size to determine if a screen is
portrait or landscape, but we may not always get a valid size.
Instead use the screen resolution.
The orientation is then calculated in the wl_output.done handler,
since we don't know the resolution yet when receiving the first
wl_output.geometry event.

Change-Id: I3554f916e54db829f49fa3d1ea24f7ce1ff24e7c
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Send also repeat key release events

We were sending only key press events for the key autorepeat, going
out of sync with the release events. Xorg sends both relase and press
auto repeat events, do so here too.

Change-Id: I41a9bfaff50afea779a7572220f6a01b507e95ac
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Support the creation of >= 3.x OpenGL contexts

Use the EGL_KHR_create_context extension if available to create modern gl
contexts. We disable window decorations on core profiles because that
mandates a VAO to be used.

Change-Id: Id6044e64f6736244ae9d593af4d68c4000a31de6
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Call ::exit() from the gui thread only

::exit() is not thread safe, so make sure to not call it more than one
time, once from the gui thread and once from the wayland event thread.

Change-Id: I80905c6d996cb827a5101ae6d6c9bc12a267ba71
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Allow client side input device customization

Introduces QWaylandInputDeviceIntegration plugins to allow customization
of input device related behavior. The plugin can be activated via the
environment variable QT_WAYLAND_INPUTDEVICE_INTEGRATION

Change-Id: If5629737752afacb29161f51c1b7c6e171fb2758
Reviewed-by: Mikko Levonmaa <mikko.levonmaa@lge.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Fix shm windows sometimes not showing after being hidden

QWaylandShmBackingStore installs a frame callback on flush, and subsequent
flushes will not attach a new buffer until the callback is fired.
If the window is hidden while we're waiting for the callback, we attach
a NULL buffer, so the compositor will not redraw the surface and will not
fire the frame callback. When showing the window again the backing store's
flush() will wait indefinitely for the frame callback to attach its buffer.
To fix it destroy the frame callback when the window is hidden.

This was easily noticeable when fast switching between popup menus.

Change-Id: Ic0c71ed79e2fab9faf452f63b05bc4576ea9a3ba
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Remove duplicate size property declaration

Change-Id: I9700c15066c030436dbe2f9a09b0851b7f4350ae
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Fix the compositor's wayland versioning

We cannot just assume all clients implement the same version of the
various interfaces as the compositor does. Keep track of them, and
react accordingly when creating a resource or sending an event.

Change-Id: I9792433a14d49c5c4df0c892fc1349ce0dfb0d43
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Pass the relevant serial when setting the selection

This fixes copying in Weston.

Change-Id: Icbdb81078e8df4575bbe440321773131ba27ebbf
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Move examples into wayland subdirectory.

Conforming to the Qt project directory structure.
Change-Id: I452867fabc88e9594fa26f944b5d3e1ca4ffc720
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Be compatible with older compositors

When binding globals take care of the version the compositor provides
and don't call requests that the compositor doesn't implement.

Change-Id: Iea0c534fb9e005720857e2778e380b6a9c22a6f3
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fix -no-opengl builds

Task-number: QTBUG-41677
Change-Id: I039ec581e960eb70eb04aed6e65add70c563ba77
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Support for multiple input devices

Allows the registration of multiple input devices for the compositor via
private APIs. Since the Qt stack does not support separate input devices
via the QPA, the identification of each device (wl_seat) is left up to
the implementor.

The compositor will identify input event via the QWaylandInputDevice::isOwner
method. Usually this will happen when an item on the UI has received an
event and would like to send it to the client surface. See
QWaylandSurfaceItem for more details.

Includes basic unit tests

Change-Id: I7ee1db49388713bf3076c23cf8f8a165aefc2fe0
Reviewed-by: Mikko Levonmaa <mikko.levonmaa@lge.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Fix crash when cursor theme can not be loaded

Also add a debug message about theme loading failure.
This is not necessarily fatal, some embedded applications could still
function properly without a cursor.

Change-Id: Ib3e2ee43b00630ee77997c7472a95ac5a22c2cc2
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Fix fd leak in case of ftruncate() failure in qwlkeyboard

Change-Id: Id7d6582d4e139763634c7022548b558d4a2f8ec2
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Gracefully fallback when xkb context creation fails

xkb context creation can fail when xkeyboard-config files are not
available.

This changes qwlkeyboard to gracefully fallback on the
QT_NO_WAYLAND_XKB path, as suggested by Giulio Camuffo.

Change-Id: Ic57d80b6aa3e9fbd8a393a3ca54dff768a4c3e83
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Update .gitignore after wayland examples move

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