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>