| 40 | |
| 41 | This corresponds to the following code in |
| 42 | |
| 43 | trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp |
| 44 | |
| 45 | {{{ |
| 46 | 178 int ShClSvcImplReadData(PSHCLCLIENT pClient, |
| 47 | 179 PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData, uint32_t *pcbActual) |
| 48 | 180 { |
| 49 | 181 AssertPtrReturn(pClient, VERR_INVALID_POINTER); |
| 50 | 182 AssertPtrReturn(pCmdCtx, VERR_INVALID_POINTER); |
| 51 | 183 AssertPtrReturn(pvData, VERR_INVALID_POINTER); |
| 52 | 184 |
| 53 | 185 RT_NOREF(pCmdCtx); |
| 54 | 186 |
| 55 | 187 LogFlowFunc(("pClient=%p, uFormat=%02X, pv=%p, cb=%u, pcbActual=%p\n", |
| 56 | 188 pClient, uFormat, pvData, cbData, pcbActual)); |
| 57 | 189 |
| 58 | 190 int rc = VINF_SUCCESS; |
| 59 | 191 |
| 60 | 192 CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)RTMemAllocZ(sizeof(CLIPREADCBREQ)); |
| 61 | 193 if (pReq) |
| 62 | 194 { |
| 63 | 195 pReq->pv = pvData; |
| 64 | 196 pReq->cb = cbData; |
| 65 | 197 pReq->pcbActual = pcbActual; |
| 66 | 198 const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pClient->EventSrc); |
| 67 | 199 pReq->idEvent = idEvent; |
| 68 | 200 if (idEvent != NIL_SHCLEVENTID) |
| 69 | 201 { |
| 70 | 202 rc = ShClX11ReadDataFromX11(&pClient->State.pCtx->X11, uFormat, pReq); |
| 71 | 203 if (RT_SUCCESS(rc)) |
| 72 | 204 { |
| 73 | 205 PSHCLEVENTPAYLOAD pPayload; |
| 74 | 206 rc = ShClEventWait(&pClient->EventSrc, idEvent, 30 * 1000, &pPayload); |
| 75 | 207 if (RT_SUCCESS(rc)) |
| 76 | 208 { |
| 77 | 209 memcpy(pvData, pPayload->pvData, RT_MIN(cbData, pPayload->cbData)); |
| 78 | }}} |