Implement invalidateSurface() to free up surface memory

Change-Id: I848a9f37f1b2e9616c3e5254a6329531e8eec825
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Merge pull request #3 from sletta/invalidate-surface

Implement invalidateSurface() to free up surface memory
Egl surfaces can now be invalidated, make sure to recreate them

Change-Id: Ifae97cc4538989bc45641bda5ce2ec8a7d8980c
Merge pull request #4 from giucam/fix_invalidated_surfaces

Recreate the egl surfaces after they have been invalidated
Fix unsetting the wl_data_device selection

Calling wl_data_device_set_selection with a NULL source is valid,
so do not crash.

Change-Id: I8ceb21366e19df703aff75c10091ee8570488848
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Fix the creation of wl_data_offer objects

The client dataSource->resource() points to is the client that
created the current active wl_data_source object, but we're
sending the wl_data_offer to another client.

Change-Id: I3d4505defaa8fa276903692644ec1b894809a1e3
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Clipboard: perform non-blocking reads from compositor

Since the compositor recycles file descriptors when offering data to
clients, it is possible that a client (or multiple clients) can attempt
to read from the same FD simultaneously, creating a situation where one
read can wait indefinitely for data. By making the pipe non-blocking,
the client can gracefully time-out if data doesn't arrive in a timely
manner.

This commit also ensures that only one FD is open per client per offered
mime type.

Change-Id: If052e5bf8198df1cdc8fc4df360f83a77950b2f9
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Discard the selection and drag source when not active anymore

If another client sets a selection or starts a drag the active
wl_data_source, if any, gets a 'cancelled' event. We must listen to
this and discard the wl_data_source, else e.g. checking the clipboard
content will still return the data of the source instead of the current
wl_data_offer.

Change-Id: I80b202baf95fbc8abe19496a991cb30bc0b78bb0
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Fix resizing of shm apps

Change-Id: Iad94691317bde38603d9143f951b1b69326ab12e
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Don't create an invalidated surface when not needed

After invalidateSurface() is called we don't want to recreate
the EGLSurface on setGeometry() until makeCurrent is called

Change-Id: Ide10ecf3bff40a01fa1ed249986a631c77c2bf63
Merge pull request #5 from giucam/fixes

Fixes when resizing egl windows
Avoid virtual calls in constructors.

QWaylandWindow::setGeometry() is a virtual call and internally it
would call windowType() which is pure virtual, so calling it from
the constructor won't work.

Instead, set geometry explicitly from the constructor and call
setGeometry() on setVisible(true). This also merges it so we send
one expose event (with correct x/y offset) on geometry change + show.

Change-Id: I1d21664c982005c60c8d73740e43b3a463bac4a8