- Timestamp:
- Apr 8, 2020 4:29:25 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137054
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard-win.h
r82968 r83624 135 135 136 136 SHCLFORMAT SharedClipboardWinClipboardFormatToVBox(UINT uFormat); 137 int SharedClipboardWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMAT DATA pFormats);137 int SharedClipboardWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMATS pfFormats); 138 138 139 139 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS -
trunk/include/VBox/GuestHost/SharedClipboard.h
r82880 r83624 76 76 /** Pointer to a shared clipboard data request. */ 77 77 typedef SHCLDATAREQ *PSHCLDATAREQ; 78 79 /**80 * Shared Clipboard formats specification.81 * @todo r=bird: Pointless as we don't have any fFlags defined, so, unless82 * someone can give me a plausible scenario where we will need flags here,83 * this structure will be eliminated.84 */85 typedef struct SHCLFORMATDATA86 {87 /** Available format(s) as bit map. */88 SHCLFORMATS Formats;89 /** Formats flags. Currently unused. */90 uint32_t fFlags;91 } SHCLFORMATDATA;92 /** Pointer to a shared clipboard formats specification. */93 typedef SHCLFORMATDATA *PSHCLFORMATDATA;94 78 95 79 /** -
trunk/include/VBox/VBoxGuestLib.h
r83142 r83624 656 656 { 657 657 /** Reports available formats from the host. */ 658 SHCLFORMAT DATAReportedFormats;658 SHCLFORMATS fReportedFormats; 659 659 /** Reports that data needs to be read from the guest. */ 660 660 SHCLFORMAT fReadData; -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r82968 r83624 256 256 /* Clipboard was updated by another application. 257 257 * Report available formats to the host. */ 258 SHCLFORMAT DATAFormats;259 int rc = SharedClipboardWinGetFormats(pWinCtx, & Formats);258 SHCLFORMATS fFormats; 259 int rc = SharedClipboardWinGetFormats(pWinCtx, &fFormats); 260 260 if (RT_SUCCESS(rc)) 261 261 { 262 LogFunc(("WM_CLIPBOARDUPDATE: Reporting formats %#x\n", Formats.Formats));263 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx.idClient, Formats.Formats);262 LogFunc(("WM_CLIPBOARDUPDATE: Reporting formats %#x\n", fFormats)); 263 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx.idClient, fFormats); 264 264 } 265 265 } … … 303 303 /* Clipboard was updated by another application. */ 304 304 /* WM_DRAWCLIPBOARD always expects a return code of 0, so don't change "rc" here. */ 305 SHCLFORMAT DATAFormats;306 rc = SharedClipboardWinGetFormats(pWinCtx, & Formats);305 SHCLFORMATS fFormats; 306 rc = SharedClipboardWinGetFormats(pWinCtx, &fFormats); 307 307 if ( RT_SUCCESS(rc) 308 && Formats.Formats != VBOX_SHCL_FMT_NONE)309 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx.idClient, Formats.Formats);308 && fFormats != VBOX_SHCL_FMT_NONE) 309 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx.idClient, fFormats); 310 310 } 311 311 else … … 506 506 Assert(pEvent->enmType == VBGLR3CLIPBOARDEVENTTYPE_REPORT_FORMATS); 507 507 508 const SHCLFORMATS fFormats = pEvent->u. ReportedFormats.Formats;508 const SHCLFORMATS fFormats = pEvent->u.fReportedFormats; 509 509 510 510 if (fFormats != VBOX_SHCL_FMT_NONE) /* Could arrive with some older GA versions. */ -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r82880 r83624 253 253 * 254 254 * @returns VBox status code. 255 * @param pCtx Shared Clipboard command context to use for the connection.256 * @param pFormats Where to store the received formats from the host.257 * /258 static int vbglR3ClipboardFormatsReportRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLFORMATDATA pFormats) 259 { 260 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 261 AssertPtrReturn(p Formats, VERR_INVALID_POINTER);262 263 pFormats->fFlags = 0; 264 pFormats->Formats = 0;255 * @param pCtx Shared Clipboard command context to use for the 256 * connection. 257 * @param pfFormats Where to store the received formats from the host. 258 */ 259 static int vbglR3ClipboardFormatsReportRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLFORMATS pfFormats) 260 { 261 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 262 AssertPtrReturn(pfFormats, VERR_INVALID_POINTER); 263 264 *pfFormats = 0; 265 265 266 266 struct … … 278 278 if (RT_SUCCESS(rc)) 279 279 { 280 rc = Msg.f32Formats.GetUInt32( &pFormats->Formats);280 rc = Msg.f32Formats.GetUInt32(pfFormats); 281 281 AssertRC(rc); 282 282 } … … 2332 2332 case VBOX_SHCL_HOST_MSG_FORMATS_REPORT: 2333 2333 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_REPORT_FORMATS; 2334 pEvent->u. ReportedFormats.Formats = cParms;2334 pEvent->u.fReportedFormats = cParms; 2335 2335 break; 2336 2336 … … 2372 2372 case VBOX_SHCL_HOST_MSG_FORMATS_REPORT: 2373 2373 { 2374 rc = vbglR3ClipboardFormatsReportRecv(pCtx, &pEvent->u. ReportedFormats);2374 rc = vbglR3ClipboardFormatsReportRecv(pCtx, &pEvent->u.fReportedFormats); 2375 2375 if (RT_SUCCESS(rc)) 2376 2376 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_REPORT_FORMATS; … … 2432 2432 case VBOX_SHCL_HOST_MSG_FORMATS_REPORT: 2433 2433 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_REPORT_FORMATS; 2434 pEvent->u. ReportedFormats.Formats = cParms;2434 pEvent->u.fReportedFormats = cParms; 2435 2435 break; 2436 2436 -
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r83184 r83624 303 303 case VBGLR3CLIPBOARDEVENTTYPE_REPORT_FORMATS: 304 304 { 305 ShClX11ReportFormatsToX11(&g_Ctx.X11, pEvent->u. ReportedFormats.Formats);305 ShClX11ReportFormatsToX11(&g_Ctx.X11, pEvent->u.fReportedFormats); 306 306 break; 307 307 } -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp
r82968 r83624 420 420 * @returns VBox status code. 421 421 * @param pCtx Windows clipboard context to retrieve formats for. 422 * @param p FormatsWhere to store the retrieved formats.423 */ 424 int SharedClipboardWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMAT DATA pFormats)425 { 426 AssertPtrReturn(pCtx, 427 AssertPtrReturn(p Formats, VERR_INVALID_POINTER);422 * @param pfFormats Where to store the retrieved formats. 423 */ 424 int SharedClipboardWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMATS pfFormats) 425 { 426 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 427 AssertPtrReturn(pfFormats, VERR_INVALID_POINTER); 428 428 429 429 SHCLFORMATS fFormats = VBOX_SHCL_FMT_NONE; … … 439 439 int rc2 = SharedClipboardWinClose(); 440 440 AssertRC(rc2); 441 } 442 443 if (RT_FAILURE(rc)) 444 { 445 LogFunc(("Failed with rc=%Rrc\n", rc)); 441 LogFlowFunc(("fFormats=%#x\n", fFormats)); 446 442 } 447 443 else 448 { 449 LogFlowFunc(("fFormats=0x%08X\n", fFormats)); 450 451 pFormats->Formats = fFormats; 452 pFormats->fFlags = 0; /** @todo Handle flags. */ 453 } 454 444 LogFunc(("Failed with rc=%Rrc (fFormats=%#x)\n", rc, fFormats)); 445 446 *pfFormats = fFormats; 455 447 return rc; 456 448 } -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-darwin.cpp
r82968 r83624 35 35 *********************************************************************************************************************************/ 36 36 /** Global clipboard context information */ 37 struct SHCLCONTEXT 38 { 39 /** We have a separate thread to poll for new clipboard content */ 40 RTTHREAD thread; 37 typedef struct SHCLCONTEXT 38 { 39 /** We have a separate thread to poll for new clipboard content. */ 40 RTTHREAD hThread; 41 /** Termination indicator. */ 41 42 bool volatile fTerminate; 42 43 /** The reference to the current pasteboard */ 43 PasteboardRef pasteboard; 44 PSHCLCLIENT pClient; 45 }; 44 PasteboardRef hPasteboard; 45 /** Shared clipboard client. */ 46 PSHCLCLIENT pClient; 47 } SHCLCONTEXT; 46 48 47 49 … … 67 69 bool fChanged = false; 68 70 /* Retrieve the formats currently in the clipboard and supported by vbox */ 69 int rc = queryNewPasteboardFormats(pCtx-> pasteboard, &fFormats, &fChanged);71 int rc = queryNewPasteboardFormats(pCtx->hPasteboard, &fFormats, &fChanged); 70 72 if ( RT_SUCCESS(rc) 71 73 && fChanged) … … 77 79 78 80 /** 79 * The poller thread.81 * @callback_method_impl{FNRTTHREAD, The poller thread. 80 82 * 81 * This thread will check for the arrival of new data on the clipboard. 82 * 83 * @returns VINF_SUCCESS (not used). 84 * @param ThreadSelf Our thread handle. 85 * @param pvUser Pointer to the SHCLCONTEXT structure. 86 * 87 */ 88 static int vboxClipboardThread(RTTHREAD ThreadSelf, void *pvUser) 89 { 83 * This thread will check for the arrival of new data on the clipboard.} 84 */ 85 static DECLCALLBACK(int) vboxClipboardThread(RTTHREAD ThreadSelf, void *pvUser) 86 { 87 SHCLCONTEXT *pCtx = (SHCLCONTEXT *)pvUser; 88 AssertPtr(pCtx); 90 89 LogFlowFuncEnter(); 91 92 AssertPtrReturn(pvUser, VERR_INVALID_PARAMETER);93 SHCLCONTEXT *pCtx = (SHCLCONTEXT *)pvUser;94 90 95 91 while (!pCtx->fTerminate) … … 114 110 g_ctx.fTerminate = false; 115 111 116 int rc = initPasteboard(&g_ctx. pasteboard);112 int rc = initPasteboard(&g_ctx.hPasteboard); 117 113 AssertRCReturn(rc, rc); 118 114 119 rc = RTThreadCreate(&g_ctx. thread, vboxClipboardThread, &g_ctx, 0,115 rc = RTThreadCreate(&g_ctx.hThread, vboxClipboardThread, &g_ctx, 0, 120 116 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLIP"); 121 117 if (RT_FAILURE(rc)) 122 118 { 123 g_ctx. thread = NIL_RTTHREAD;124 destroyPasteboard(&g_ctx. pasteboard);119 g_ctx.hThread = NIL_RTTHREAD; 120 destroyPasteboard(&g_ctx.hPasteboard); 125 121 } 126 122 … … 134 130 */ 135 131 ASMAtomicWriteBool(&g_ctx.fTerminate, true); 136 int rc = RTThreadUserSignal(g_ctx. thread);132 int rc = RTThreadUserSignal(g_ctx.hThread); 137 133 AssertRC(rc); 138 rc = RTThreadWait(g_ctx. thread, RT_INDEFINITE_WAIT, NULL);134 rc = RTThreadWait(g_ctx.hThread, RT_INDEFINITE_WAIT, NULL); 139 135 AssertRC(rc); 140 136 141 137 /* 142 * Destroy the pasteboard and uninitialize the global context record.138 * Destroy the hPasteboard and uninitialize the global context record. 143 139 */ 144 destroyPasteboard(&g_ctx. pasteboard);145 g_ctx. thread = NIL_RTTHREAD;140 destroyPasteboard(&g_ctx.hPasteboard); 141 g_ctx.hThread = NIL_RTTHREAD; 146 142 g_ctx.pClient = NULL; 147 143 } … … 190 186 } 191 187 192 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, 193 PSHCLCLIENTCMDCTX pCmdCtx, PSHCLFORMATDATA pFormats) 194 { 195 RT_NOREF(pCmdCtx); 196 197 LogFlowFunc(("uFormats=%02X\n", pFormats->Formats)); 198 199 if (pFormats->Formats == VBOX_SHCL_FMT_NONE) 188 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, SHCLFORMATS fFormats) 189 { 190 LogFlowFunc(("fFormats=%02X\n", fFormats)); 191 192 if (fFormats == VBOX_SHCL_FMT_NONE) 200 193 { 201 194 /* This is just an automatism, not a genuine announcement */ … … 204 197 205 198 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 206 if ( pFormats->Formats & VBOX_SHCL_FMT_URI_LIST) /* No transfer support yet. */199 if (fFormats & VBOX_SHCL_FMT_URI_LIST) /* No transfer support yet. */ 207 200 return VINF_SUCCESS; 208 201 #endif 209 202 210 return ShClSvcDataReadRequest(pClient, pFormats->Formats, NULL /* pidEvent */);211 } 212 213 int ShClSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 214 SHCLFORMAT uFormat,void *pvData, uint32_t cbData, uint32_t *pcbActual)203 return ShClSvcDataReadRequest(pClient, fFormats, NULL /* pidEvent */); 204 } 205 206 int ShClSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT fFormat, 207 void *pvData, uint32_t cbData, uint32_t *pcbActual) 215 208 { 216 209 RT_NOREF(pCmdCtx); … … 221 214 *pcbActual = 0; 222 215 223 int rc = readFromPasteboard(pClient->State.pCtx->pasteboard, 224 uFormat, pvData, cbData, pcbActual); 225 226 ShClSvcUnlock(); 227 228 return rc; 229 } 230 231 int ShClSvcImplWriteData(PSHCLCLIENT pClient, 232 PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData) 216 int rc = readFromPasteboard(pClient->State.pCtx->hPasteboard, fFormat, pvData, cbData, pcbActual); 217 218 ShClSvcUnlock(); 219 220 return rc; 221 } 222 223 int ShClSvcImplWriteData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT fFormat, void *pvData, uint32_t cbData) 233 224 { 234 225 RT_NOREF(pCmdCtx); … … 236 227 ShClSvcLock(); 237 228 238 writeToPasteboard(pClient->State.pCtx-> pasteboard, pvData, cbData, uFormat);229 writeToPasteboard(pClient->State.pCtx->hPasteboard, pvData, cbData, fFormat); 239 230 240 231 ShClSvcUnlock(); … … 244 235 245 236 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 237 246 238 int ShClSvcImplTransferReadDir(PSHCLCLIENT pClient, PSHCLDIRDATA pDirData) 247 239 { … … 279 271 return VERR_NOT_IMPLEMENTED; 280 272 } 273 281 274 #endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */ 282 275 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r82889 r83624 282 282 * @returns VBox status code. 283 283 * @param pClient Shared Clipboard client context. 284 * @param pCmdCtx Shared Clipboard command context.285 * @param pFormats Announced formats from the guest.286 */ 287 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, PSHCLFORMATDATA pFormats);284 * @param fFormats The announced formats from the guest, 285 * VBOX_SHCL_FMT_XXX. 286 */ 287 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, SHCLFORMATS fFormats); 288 288 /** @todo Document: Can return VINF_HGCM_ASYNC_EXECUTE to defer returning read data.*/ 289 289 /** -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp
r82893 r83624 573 573 if (pCtx->pClient) 574 574 { 575 SHCLFORMATDATA Formats; 576 RT_ZERO(Formats); 577 578 rc = SharedClipboardWinGetFormats(&pCtx->Win, &Formats); 575 SHCLFORMATS fFormats = 0; 576 rc = SharedClipboardWinGetFormats(&pCtx->Win, &fFormats); 579 577 if ( RT_SUCCESS(rc) 580 && Formats.Formats != VBOX_SHCL_FMT_NONE) /** @todo r=bird: BUGBUG: revisit this. */581 rc = ShClSvcHostReportFormats(pCtx->pClient, Formats.Formats);578 && fFormats != VBOX_SHCL_FMT_NONE) /** @todo r=bird: BUGBUG: revisit this. */ 579 rc = ShClSvcHostReportFormats(pCtx->pClient, fFormats); 582 580 } 583 581 else /* If we don't have any client data (yet), bail out. */ … … 696 694 } 697 695 698 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 699 PSHCLFORMATDATA pFormats) 696 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, SHCLFORMATS fFormats) 700 697 { 701 698 AssertPtrReturn(pClient, VERR_INVALID_POINTER); 702 RT_NOREF(pCmdCtx);703 704 int rc;705 699 706 700 PSHCLCONTEXT pCtx = pClient->State.pCtx; 707 701 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 708 702 709 LogFlowFunc((" uFormats=0x%x, hWnd=%p\n", pFormats->Formats, pCtx->Win.hWnd));703 LogFlowFunc(("fFormats=0x%x, hWnd=%p\n", fFormats, pCtx->Win.hWnd)); 710 704 711 705 /* … … 713 707 */ 714 708 PostMessage(pCtx->Win.hWnd, SHCL_WIN_WM_REPORT_FORMATS, 715 0 /* wParam */, pFormats->Formats /* lParam */); 716 717 rc = VINF_SUCCESS; 718 719 LogFlowFuncLeaveRC(rc); 720 return rc; 709 0 /* wParam */, fFormats /* lParam */); 710 711 712 LogFlowFuncLeaveRC(VINF_SUCCESS); 713 return VINF_SUCCESS; 721 714 } 722 715 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp
r82893 r83624 146 146 } 147 147 148 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 149 PSHCLFORMATDATA pFormats) 150 { 151 RT_NOREF(pCmdCtx); 152 153 int rc = ShClX11ReportFormatsToX11(&pClient->State.pCtx->X11, pFormats->Formats); 148 int ShClSvcImplFormatAnnounce(PSHCLCLIENT pClient, SHCLFORMATS fFormats) 149 { 150 int rc = ShClX11ReportFormatsToX11(&pClient->State.pCtx->X11, fFormats); 154 151 155 152 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r83621 r83624 1464 1464 } 1465 1465 else 1466 { 1467 SHCLCLIENTCMDCTX CmdCtx; 1468 RT_ZERO(CmdCtx); 1469 1470 SHCLFORMATDATA FormatData; 1471 FormatData.fFlags = 0; 1472 FormatData.Formats = fFormats; 1473 rc = ShClSvcImplFormatAnnounce(pClient, &CmdCtx, &FormatData); 1474 } 1466 rc = ShClSvcImplFormatAnnounce(pClient, fFormats); 1475 1467 } 1476 1468 } -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp
r82892 r83624 312 312 int ShClSvcImplDisconnect(PSHCLCLIENT) { return VINF_SUCCESS; } 313 313 int ShClSvcImplConnect(PSHCLCLIENT, bool) { return VINF_SUCCESS; } 314 int ShClSvcImplFormatAnnounce(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLFORMATDATA) { AssertFailed(); return VINF_SUCCESS; }314 int ShClSvcImplFormatAnnounce(PSHCLCLIENT, SHCLFORMATS) { AssertFailed(); return VINF_SUCCESS; } 315 315 int ShClSvcImplReadData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, SHCLFORMAT, void *, uint32_t, unsigned int *) { AssertFailed(); return VERR_WRONG_ORDER; } 316 316 int ShClSvcImplWriteData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, SHCLFORMAT, void *, uint32_t) { AssertFailed(); return VINF_SUCCESS; }
Note:
See TracChangeset
for help on using the changeset viewer.