Allow to customize enabled compositor extensions

Add an ExtensionFlag enum to QWaylandCompositor and allow to specify
extensions to enable via the constructor.

Change-Id: If1a691232134034ba4055a9ed280bc211dcaebe8
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fix building xcomposite plugins with pkg-config

wayland-server.h is included in the generated code, therefore
wayland-server has to be added to PKGCONFIG.

Change-Id: I9a0eba7decba8d2db5e5e3de82069976faa24164
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Wayland platform: Do not crash when opening a popup without the mouse

set_popup requires a wl_seat which we will not have if the mouse has
not been touched. Avoid set_popup in this case, otherwise all we get
is a crash.

Change-Id: I591b218c18e3812cdc5fb86e8bf8b92caf64a4f6
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Add missing errno.h include

Change-Id: I17655fbd86aee6b135bd02df140dd4cd2e253a43
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Allow to set a fixed DPI for the screen

When the QT_WAYLAND_FORCE_DPI environment vairable is set use that value
for Dpi.

Needed in some cases for font matching.

Change-Id: Ia02ec4743894d41a18471e6cbcca764da45a6844
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Just exit instead of asking the application to quit when the connection goes down.

As discussed in abe1be628da687b1943a41e5411f34f646aeca86, the existing approach
is ineffective in some cases in that it merely requests that the application
shut down. In the case of misbehaving threads (for example), the application can
sit around indefinitely instead of quitting as it should.

Additionally, add a warning to make it clear what happened.

This also matches up with the xcb plugin's behavior.

Change-Id: Iabc17dc268c849635263a16754b9f3bfa7bd9e4a
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Set window state on platform window creation

When creating the platform window, the window state should be set
according to the value in the associated QWindow. This is especially
important for new QWindows, as the application may expect the compositor
to resize e.g. maximized or fullscreen surfaces.

Change-Id: I9cf4eb810bb4fa6305da4206c9a2cec0247c2fe6
Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Constrain window geometry

It is the platform plugin's responsibility to constrain window geometry
to QWindow::minimumSize/QWindow::maximumSize. Platform subclasses should
make sure to call the setGeometry() base method first to make sure
geometry() has been constrained before continuing to resize surfaces.

Change-Id: I1c25ba6a32a3597603a3ffdb799b4e22b9d8f3ec
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Set surface title on platform window creation

When creating the platform window, the surface title should be set to
the value in the associated QWindow otherwise the compositor won't know
it until setWindowTitle() is called.

Change-Id: I5d0e16c78bf5dd7c9dde47254809d18cf77f0a82
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Compositor: add BypassWindowManager hint to WindowFlags

BypassWindowManagerHint is already being used on the client-side, and it
would be beneficial for some compositors to see this server-side as well.

Change-Id: I4801a0c2f14f86fcd48cc49c3f2324af4216fb6f
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Call sendRelease before unlockNativeBuffer

Unlock native buffer can call to destroy egl image.
If a wayland buffer is bound to the egl image and the buffer
resource is already destroyed by client, the buffer resouce
in compositor will be destroyed with destroying the egl image.
On sendRelease, m_buffer is null since destroy_listener_callback
is called by unlockNativeBuffer of HW integration.

Change-Id: I8fcaec12b4acab2c9d5fb2f2b4abc1e40654f014
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Initialize more variable

Warning from valgrind.  And I beleive this might also lead to crash on the first mouse click

Change-Id: Iad6530aab358e29c510c5f46f8c9ae64d8e7287f
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Support application internal mouse grabbing for popup windows

Mouse grabbing is used to close a popup window when the user clicks on
another window. Wayland doesn't support mouse grabbing by
design and sends an event when the user clicks on a window of another
application. This patch fakes mouse grabbing for the windows of the
application the popup belongs to, so that it closes when the user
clicks on a window of the same application.

Change-Id: Iac210bed0ca0fc6d3ffdbdb76d069886de51cf04
Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Pin qtbase version so we can integrate QPA API changes

Will be unpined along with an update that matches the changes in
https://codereview.qt-project.org/#change,66591.

Change-Id: I84fc8b6d28c05d75fe199044a9a5c7cf0070518f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Avoid dereferencing a null pointer when QMimeData is 0

QClipboard's QPA implementation of clear() calls setMimeData(0, mode),
which means mimeData can be dereferenced when it is null. Prevent this
from happening.

Change-Id: Ib019926e1a7c002d365419db609028c258d364bc
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Make the platform plugin compatible with qt 5.2.

Change-Id: Ib81ae383c5ef4baf76f2cfd4bd9efeb749480f4b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Remove code for EGL_WL_request_client_buffer_format.

This appears to have no supported use in the open source or modern world, so
drop the dead code.

Change-Id: Ic08a6bf2c844da567e8f76cec7201ee31ded5b81
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Use new EGL_WAYLAND_Y_INVERTED_WL attribute to query Y inversion of a buffer.

Change-Id: I1532ad432cf1a6a1b1ba9c960a8b575f801b8331
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Compositor: Ping/Pong API

Provide a way for the compositor to ping (and receive a pong) from
surface clients.

Change-Id: Iab594f0357fdfc25fe01ca0b8b9f527149718b44
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com>
explicitly request wayland-scanner feature

having qtbase include it for everyone is wasteful, so do it here
explicitly.

Change-Id: I9bf39a48fe3323aaa5471a638760ac61a61de683
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>