Changeset 93504 in vbox for trunk/src/VBox
- Timestamp:
- Jan 31, 2022 4:17:01 PM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp
r93497 r93504 1836 1836 pValReturn, pcLenReturn, piFormatReturn); 1837 1837 1838 #if def LOG_ENABLED1838 #if 0 /** @todo Disabled -- crashes when running with tstClipboardGH-X11. */ 1839 1839 XSelectionRequestEvent* pReq = 1840 1840 XtGetSelectionRequest(widget, *atomSelection, (XtRequestId)NULL); -
trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardGH-X11.cpp
r93496 r93504 119 119 } 120 120 121 DECLCALLBACK(int) ShClX11RequestDataCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)122 {123 RT_NOREF(pCtx, uFmt);124 *pcb = g_tst_cbDataVBox;125 if (g_tst_pvDataVBox != NULL)126 {127 void *pv = RTMemDup(g_tst_pvDataVBox, g_tst_cbDataVBox);128 *ppv = pv;129 return pv != NULL ? g_tst_rcDataVBox : VERR_NO_MEMORY;130 }131 *ppv = NULL;132 return g_tst_rcDataVBox;133 }134 135 121 Display *XtDisplay(Widget w) { NOREF(w); return (Display *) 0xffff; } 136 122 … … 242 228 /* The formats currently on offer from X11 via the shared clipboard. */ 243 229 static uint32_t g_tst_uX11Formats = 0; 244 245 DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS fFormats)246 {247 RT_NOREF(pCtx);248 g_tst_uX11Formats = fFormats;249 }250 230 251 231 static uint32_t tstClipQueryFormats(void) … … 398 378 static char g_tst_abCompletedBuf[TESTCASE_MAX_BUF_SIZE]; 399 379 400 DECLCALLBACK(void) ShClX11ReportDataCallback(PSHCLCONTEXT pCtx, int rcCompletion, 401 CLIPREADCBREQ *pReq, void *pv, uint32_t cb) 380 static DECLCALLBACK(int) tstShClReportFormatsCallback(PSHCLCONTEXT pCtx, uint32_t fFormats, void *pvUser) 381 { 382 RT_NOREF(pCtx, pvUser); 383 g_tst_uX11Formats = fFormats; 384 return VINF_SUCCESS; 385 } 386 387 static DECLCALLBACK(int) tstShClOnRequestDataFromSourceCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb, void *pvUser) 388 { 389 RT_NOREF(pCtx, uFmt, pvUser); 390 *pcb = g_tst_cbDataVBox; 391 if (g_tst_pvDataVBox != NULL) 392 { 393 void *pv = RTMemDup(g_tst_pvDataVBox, g_tst_cbDataVBox); 394 *ppv = pv; 395 return pv != NULL ? g_tst_rcDataVBox : VERR_NO_MEMORY; 396 } 397 *ppv = NULL; 398 return g_tst_rcDataVBox; 399 } 400 401 static DECLCALLBACK(int) tstShClOnSendDataToDestCallback(PSHCLCONTEXT pCtx, void *pv, uint32_t cb, void *pvUser) 402 402 { 403 403 RT_NOREF(pCtx); 404 405 PSHCLX11READDATAREQ pData = (PSHCLX11READDATAREQ)pvUser; 406 404 407 if (cb <= TESTCASE_MAX_BUF_SIZE) 405 408 { 406 g_tst_rcCompleted = rcCompletion;409 g_tst_rcCompleted = pData->rcCompletion; 407 410 if (cb != 0) 408 411 memcpy(g_tst_abCompletedBuf, pv, cb); … … 411 414 g_tst_rcCompleted = VERR_BUFFER_OVERFLOW; 412 415 g_tst_cbCompleted = cb; 413 g_tst_pCompletedReq = pReq; 416 g_tst_pCompletedReq = pData->pReq; 417 418 return VINF_SUCCESS; 414 419 } 415 420 … … 669 674 * Run the tests. 670 675 */ 676 SHCLCALLBACKS Callbacks; 677 RT_ZERO(Callbacks); 678 Callbacks.pfnReportFormats = tstShClReportFormatsCallback; 679 Callbacks.pfnOnRequestDataFromSource = tstShClOnRequestDataFromSourceCallback; 680 Callbacks.pfnOnSendDataToDest = tstShClOnSendDataToDestCallback; 681 671 682 SHCLX11CTX X11Ctx; 672 rc = ShClX11Init(&X11Ctx, NULL /* pCallbacks */, NULL /* pParent */, false /* fHeadless */);683 rc = ShClX11Init(&X11Ctx, &Callbacks, NULL /* pParent */, false /* fHeadless */); 673 684 AssertRCReturn(rc, RTEXITCODE_FAILURE); 674 685 … … 893 904 * Headless clipboard tests 894 905 */ 895 rc = ShClX11Init(&X11Ctx, NULL /* pCallbacks */, NULL /* pParent */, true /* fHeadless */);906 rc = ShClX11Init(&X11Ctx, &Callbacks, NULL /* pParent */, true /* fHeadless */); 896 907 AssertRCReturn(rc, RTEXITCODE_FAILURE); 897 908 -
trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardGH-X11Smoke.cpp
r93496 r93504 31 31 32 32 33 DECLCALLBACK(int) ShClX11RequestDataCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)33 static DECLCALLBACK(int) tstShClReportFormatsCallback(PSHCLCONTEXT pCtx, uint32_t fFormats, void *pvUser) 34 34 { 35 RT_NOREF(pCtx, uFmt, ppv, pcb); 35 RT_NOREF(pCtx, fFormats, pvUser); 36 return VINF_SUCCESS; 37 } 38 39 static DECLCALLBACK(int) tstShClOnRequestDataFromSourceCallback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb, void *pvUser) 40 { 41 RT_NOREF(pCtx, uFmt, ppv, pcb, pvUser); 36 42 return VERR_NO_DATA; 37 43 } 38 44 39 DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS fFormats)45 static DECLCALLBACK(int) tstShClOnSendDataToDest(PSHCLCONTEXT pCtx, void *pv, uint32_t cb, void *pvUser) 40 46 { 41 RT_NOREF(pCtx, fFormats); 42 } 43 44 DECLCALLBACK(void) ShClX11ReportDataCallback(PSHCLCONTEXT pCtx, int rcCompletion, 45 CLIPREADCBREQ *pReq, void *pv, uint32_t cb) 46 { 47 RT_NOREF(pCtx, rcCompletion, pReq, pv, cb); 47 RT_NOREF(pCtx, pv, cb, pvUser); 48 return VINF_SUCCESS; 48 49 } 49 50 … … 71 72 return RTTestSummaryAndDestroy(hTest); 72 73 } 74 75 SHCLCALLBACKS Callbacks; 76 RT_ZERO(Callbacks); 77 Callbacks.pfnReportFormats = tstShClReportFormatsCallback; 78 Callbacks.pfnOnRequestDataFromSource = tstShClOnRequestDataFromSourceCallback; 79 Callbacks.pfnOnSendDataToDest = tstShClOnSendDataToDest; 80 73 81 SHCLX11CTX X11Ctx; 74 rc = ShClX11Init(&X11Ctx, NULL /* pCallbacks */, NULL /* pParent */, false);82 rc = ShClX11Init(&X11Ctx, &Callbacks, NULL /* pParent */, false); 75 83 AssertRCReturn(rc, 1); 76 84 rc = ShClX11ThreadStart(&X11Ctx, false /* fGrab */); -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardMockHGCM.cpp
r93495 r93504 1179 1179 SHCLCALLBACKS Callbacks; 1180 1180 RT_ZERO(Callbacks); 1181 Callbacks.pfnReportFormats = tstShClUserMockReportFormatsCallback;1182 Callbacks.pfnOnClipboardRead 1181 Callbacks.pfnReportFormats = tstShClUserMockReportFormatsCallback; 1182 Callbacks.pfnOnClipboardRead = tstShClUserMockOnGetDataCallback; 1183 1183 1184 1184 pUsrMock->pCtx = (PSHCLCONTEXT)RTMemAllocZ(sizeof(SHCLCONTEXT));
Note:
See TracChangeset
for help on using the changeset viewer.