client/X11: cache original clipboard data for raw transfers
authorilammy <a.lozovsky@gmail.com>
Mon, 15 Aug 2016 19:45:20 +0000 (22:45 +0300)
committerilammy <a.lozovsky@gmail.com>
Fri, 10 Feb 2017 22:48:36 +0000 (00:48 +0200)
commit11c55f8dcd64d74ea2348aae2b70b311cd709c5c
treefce0bb83c9c03e295c678a9a4ca91dd1c5597ef6
parent842a8c57ecc0cb21cf2653e829c3cd815b226896
client/X11: cache original clipboard data for raw transfers

FreeRDP uses clipboard->data to cache the result of the Windows->X11
clipboard format conversion, and xf_cliprdr_process_selection_request()
immediately provides this result to local applications if they request
the same clipboard format again. This saves us a possibly costly
conversion in case where the user pastes data repeatedly.

However, this caching mechanism did not support raw clipboard transfers
where the unmodified data is passed between two FreeRDP clients. We use
the same XClipboard protocol for this, so the clipboard->data is in play.
We clear the cached value when we receive new data from the server, so
initially raw transfers are fine. But if some local application (e.g.,
a clipboard manager) asks for some data format before the data is pasted
into the second FreeRDP session then clipboard->data will contain the
*converted* data. And this converted cached data will be provided to
the second FreeRDP session as a part of the raw data transfer. Instead
we should have provided the original data.

In order to achieve this we are now caching the original data in the
same way as the converted one, and the original data is now correctly
provided when the second FreeRDP session asks for a raw data transfer.
client/X11/xf_cliprdr.c