Changeset 85744 in vbox for trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
- Timestamp:
- Aug 13, 2020 8:28:29 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r85743 r85744 161 161 * nor 2) mixed transfers (G->H + H->G at the same time). 162 162 */ 163 m_p Resp = GuestDnDInst()->response();164 AssertPtrReturn(m_p Resp, E_POINTER);163 m_pState = GuestDnDInst()->getState(); 164 AssertPtrReturn(m_pState, E_POINTER); 165 165 166 166 /* Confirm a successful initialization when it's the case. */ … … 316 316 GuestDnDMsg Msg; 317 317 Msg.setType(HOST_DND_HG_EVT_ENTER); 318 if (m_p Resp->m_uProtocolVersion >= 3)318 if (m_pState->m_uProtocolVersion >= 3) 319 319 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 320 320 Msg.appendUInt32(aScreenId); … … 329 329 if (RT_SUCCESS(rc)) 330 330 { 331 if (RT_SUCCESS(m_p Resp->waitForGuestResponse()))332 resAction = GuestDnD::toMainAction(m_p Resp->getActionDefault());331 if (RT_SUCCESS(m_pState->waitForGuestResponse())) 332 resAction = GuestDnD::toMainAction(m_pState->getActionDefault()); 333 333 } 334 334 } … … 393 393 GuestDnDMsg Msg; 394 394 Msg.setType(HOST_DND_HG_EVT_MOVE); 395 if (m_p Resp->m_uProtocolVersion >= 3)395 if (m_pState->m_uProtocolVersion >= 3) 396 396 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 397 397 Msg.appendUInt32(aScreenId); … … 406 406 if (RT_SUCCESS(rc)) 407 407 { 408 GuestDnD Response *pResp = GuestDnDInst()->response();409 if (p Resp && RT_SUCCESS(pResp->waitForGuestResponse()))410 resAction = GuestDnD::toMainAction(p Resp->getActionDefault());408 GuestDnDState *pState = GuestDnDInst()->getState(); 409 if (pState && RT_SUCCESS(pState->waitForGuestResponse())) 410 resAction = GuestDnD::toMainAction(pState->getActionDefault()); 411 411 } 412 412 } … … 440 440 GuestDnDMsg Msg; 441 441 Msg.setType(HOST_DND_HG_EVT_LEAVE); 442 if (m_p Resp->m_uProtocolVersion >= 3)442 if (m_pState->m_uProtocolVersion >= 3) 443 443 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 444 444 … … 446 446 if (RT_SUCCESS(rc)) 447 447 { 448 GuestDnD Response *pResp = GuestDnDInst()->response();449 if (p Resp)450 p Resp->waitForGuestResponse();448 GuestDnDState *pState = GuestDnDInst()->getState(); 449 if (pState) 450 pState->waitForGuestResponse(); 451 451 } 452 452 … … 516 516 GuestDnDMsg Msg; 517 517 Msg.setType(HOST_DND_HG_EVT_DROPPED); 518 if (m_p Resp->m_uProtocolVersion >= 3)518 if (m_pState->m_uProtocolVersion >= 3) 519 519 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 520 520 Msg.appendUInt32(aScreenId); … … 529 529 if (RT_SUCCESS(vrc)) 530 530 { 531 GuestDnD Response *pResp = GuestDnDInst()->response();532 if (p Resp && RT_SUCCESS(pResp->waitForGuestResponse()))531 GuestDnDState *pState = GuestDnDInst()->getState(); 532 if (pState && RT_SUCCESS(pState->waitForGuestResponse())) 533 533 { 534 resAct = GuestDnD::toMainAction(p Resp->getActionDefault());535 536 GuestDnDMIMEList lstFormats = p Resp->formats();534 resAct = GuestDnD::toMainAction(pState->getActionDefault()); 535 536 GuestDnDMIMEList lstFormats = pState->formats(); 537 537 if (lstFormats.size() == 1) /* Exactly one format to use specified? */ 538 538 { … … 606 606 607 607 /* Reset progress object. */ 608 GuestDnD Response *pResp = GuestDnDInst()->response();609 AssertPtr(p Resp);610 HRESULT hr = p Resp->resetProgress(m_pGuest);608 GuestDnDState *pState = GuestDnDInst()->getState(); 609 AssertPtr(pState); 610 HRESULT hr = pState->resetProgress(m_pGuest); 611 611 if (FAILED(hr)) 612 612 return hr; … … 619 619 620 620 mData.mSendCtx.pTarget = this; 621 mData.mSendCtx.p Resp = pResp;621 mData.mSendCtx.pState = pState; 622 622 mData.mSendCtx.uScreenID = aScreenId; 623 623 … … 654 654 655 655 /* Return progress to caller. */ 656 hr = p Resp->queryProgressTo(aProgress.asOutParam());656 hr = pState->queryProgressTo(aProgress.asOutParam()); 657 657 ComAssertComRC(hr); 658 658 } … … 835 835 const char *pcszFmt = pCtx->Meta.strFmt.c_str(); 836 836 837 LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_p Resp->m_uProtocolVersion, pcszFmt, cbFmt, cbData));837 LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pState->m_uProtocolVersion, pcszFmt, cbFmt, cbData)); 838 838 839 839 LogRel2(("DnD: Sending meta data to guest as '%s' (%zu bytes)\n", pcszFmt, cbData)); … … 853 853 Msg.setType(HOST_DND_HG_SND_DATA); 854 854 855 if (m_p Resp->m_uProtocolVersion < 3)855 if (m_pState->m_uProtocolVersion < 3) 856 856 { 857 857 Msg.appendUInt32(pCtx->uScreenID); /* uScreenId */ … … 883 883 if (RT_SUCCESS(rc)) 884 884 { 885 rc = updateProgress(pCtx, pCtx->p Resp, (uint32_t)pCtx->Meta.cbData);885 rc = updateProgress(pCtx, pCtx->pState, (uint32_t)pCtx->Meta.cbData); 886 886 AssertRC(rc); 887 887 } … … 901 901 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 902 902 903 if (m_p Resp->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */903 if (m_pState->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */ 904 904 return VINF_SUCCESS; 905 905 … … 950 950 951 951 pMsg->setType(HOST_DND_HG_SND_DIR); 952 if (m_p Resp->m_uProtocolVersion >= 3)952 if (m_pState->m_uProtocolVersion >= 3) 953 953 pMsg->appendUInt32(0); /** @todo ContextID not used yet. */ 954 954 pMsg->appendString(pcszDstPath); /* path */ … … 997 997 if (RT_SUCCESS(rc)) 998 998 { 999 if (m_p Resp->m_uProtocolVersion >= 2)999 if (m_pState->m_uProtocolVersion >= 2) 1000 1000 { 1001 1001 if (!(pCtx->Transfer.fObjState & DND_OBJ_STATE_HAS_HDR)) … … 1067 1067 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 1068 1068 1069 AssertPtrReturn(pCtx->p Resp, VERR_WRONG_ORDER);1069 AssertPtrReturn(pCtx->pState, VERR_WRONG_ORDER); 1070 1070 1071 1071 /** @todo Don't allow concurrent reads per context! */ … … 1079 1079 /* Protocol version 1 sends the file path *every* time with a new file chunk. 1080 1080 * In protocol version 2 we only do this once with HOST_DND_HG_SND_FILE_HDR. */ 1081 if (m_p Resp->m_uProtocolVersion <= 1)1081 if (m_pState->m_uProtocolVersion <= 1) 1082 1082 { 1083 1083 const size_t cchDstPath = RTStrNLen(pcszDstPath, RTPATH_MAX); … … 1086 1086 pMsg->appendUInt32((uint32_t)cchDstPath + 1); /* cbName */ 1087 1087 } 1088 else if (m_p Resp->m_uProtocolVersion >= 2)1088 else if (m_pState->m_uProtocolVersion >= 2) 1089 1089 { 1090 1090 pMsg->appendUInt32(0); /** @todo ContextID not used yet. */ … … 1103 1103 LogFlowFunc(("cbBufe=%zu, cbRead=%RU32\n", cbBuf, cbRead)); 1104 1104 1105 if (m_p Resp->m_uProtocolVersion <= 1)1105 if (m_pState->m_uProtocolVersion <= 1) 1106 1106 { 1107 1107 pMsg->appendPointer(pvBuf, cbRead); /* pvData */ … … 1114 1114 pMsg->appendUInt32(cbRead); /* cbData */ 1115 1115 1116 if (m_p Resp->m_uProtocolVersion >= 3)1116 if (m_pState->m_uProtocolVersion >= 3) 1117 1117 { 1118 1118 /** @todo Calculate checksum. */ … … 1122 1122 } 1123 1123 1124 int rc2 = updateProgress(pCtx, pCtx->p Resp, (uint32_t)cbRead);1124 int rc2 = updateProgress(pCtx, pCtx->pState, (uint32_t)cbRead); 1125 1125 AssertRC(rc2); 1126 1126 … … 1223 1223 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1224 1224 1225 pCtx->p Resp->reset();1225 pCtx->pState->reset(); 1226 1226 1227 1227 if (RT_SUCCESS(pCBData->rc)) … … 1231 1231 } 1232 1232 1233 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,1234 GuestDnDTarget::i_guestErrorToString(pCBData->rc));1233 rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc, 1234 GuestDnDTarget::i_guestErrorToString(pCBData->rc)); 1235 1235 if (RT_SUCCESS(rc)) 1236 1236 { … … 1343 1343 { 1344 1344 /* Unregister this callback. */ 1345 AssertPtr(pCtx->p Resp);1346 int rc2 = pCtx->p Resp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);1345 AssertPtr(pCtx->pState); 1346 int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */); 1347 1347 AssertRC(rc2); 1348 1348 … … 1373 1373 { 1374 1374 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1375 AssertPtr(pCtx->p Resp);1375 AssertPtr(pCtx->pState); 1376 1376 1377 1377 #define REGISTER_CALLBACK(x) \ 1378 1378 do { \ 1379 rc = pCtx->p Resp->setCallback(x, i_sendTransferDataCallback, pCtx); \1379 rc = pCtx->pState->setCallback(x, i_sendTransferDataCallback, pCtx); \ 1380 1380 if (RT_FAILURE(rc)) \ 1381 1381 return rc; \ … … 1384 1384 #define UNREGISTER_CALLBACK(x) \ 1385 1385 do { \ 1386 int rc2 = pCtx->p Resp->setCallback(x, NULL); \1386 int rc2 = pCtx->pState->setCallback(x, NULL); \ 1387 1387 AssertRC(rc2); \ 1388 1388 } while (0) … … 1406 1406 /* Host callbacks. */ 1407 1407 REGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1408 if (m_p Resp->m_uProtocolVersion >= 2)1408 if (m_pState->m_uProtocolVersion >= 2) 1409 1409 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1410 1410 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); … … 1473 1473 * Send the data header first. 1474 1474 */ 1475 if (m_p Resp->m_uProtocolVersion >= 3)1475 if (m_pState->m_uProtocolVersion >= 3) 1476 1476 rc = i_sendMetaDataHeader(pCtx); 1477 1477 … … 1484 1484 if (RT_SUCCESS(rc)) 1485 1485 { 1486 rc = waitForEvent(&pCtx->EventCallback, pCtx->p Resp, msTimeout);1486 rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout); 1487 1487 if (RT_SUCCESS(rc)) 1488 pCtx->p Resp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);1488 pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS); 1489 1489 } 1490 1490 … … 1501 1501 /* Host callbacks. */ 1502 1502 UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1503 if (m_p Resp->m_uProtocolVersion >= 2)1503 if (m_pState->m_uProtocolVersion >= 2) 1504 1504 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1505 1505 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); … … 1522 1522 LogRel2(("DnD: Sending transfer data to guest cancelled by user\n")); 1523 1523 1524 rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);1524 rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS); 1525 1525 AssertRC(rc2); 1526 1526 … … 1531 1531 { 1532 1532 LogRel(("DnD: Sending transfer data to guest failed with rc=%Rrc\n", rc)); 1533 int rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR, rc,1534 GuestDnDTarget::i_hostErrorToString(rc));1533 int rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, rc, 1534 GuestDnDTarget::i_hostErrorToString(rc)); 1535 1535 AssertRC(rc2); 1536 1536 } … … 1555 1555 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 1556 1556 1557 int rc = updateProgress(pCtx, pCtx->p Resp);1557 int rc = updateProgress(pCtx, pCtx->pState); 1558 1558 AssertRCReturn(rc, rc); 1559 1559 … … 1619 1619 { 1620 1620 LogRel(("DnD: Sending raw data to guest failed with rc=%Rrc\n", rc)); 1621 rc2 = pCtx->p Resp->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,1622 GuestDnDTarget::i_hostErrorToString(rc));1621 rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc, 1622 GuestDnDTarget::i_hostErrorToString(rc)); 1623 1623 } 1624 1624 else 1625 rc2 = pCtx->p Resp->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);1625 rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc); 1626 1626 AssertRC(rc2); 1627 1627
Note:
See TracChangeset
for help on using the changeset viewer.