Changeset 74439 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 24, 2018 12:30:47 PM (6 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestDnDPrivate.h
r71398 r74439 26 26 #include <VBox/hgcmsvc.h> /* For PVBOXHGCMSVCPARM. */ 27 27 #include <VBox/GuestHost/DragAndDrop.h> 28 #include <VBox/GuestHost/DragAndDropDefs.h> 28 29 #include <VBox/HostServices/DragAndDropSvc.h> 29 30 … … 797 798 * Needed to tell the guest if data has to be 798 799 * deleted e.g. when moving instead of copying. */ 799 uint32_tmAction;800 VBOXDNDACTION mAction; 800 801 /** Drag'n drop received from the guest. 801 802 * This can be arbitrary data or an URI list. */ … … 986 987 int waitForGuestResponse(RTMSINTERVAL msTimeout = 500) const; 987 988 988 void setA llActions(uint32_t a) { m_allActions= a; }989 uint32_t allActions(void) const { return m_allActions; }990 991 void set DefAction(uint32_t a) { m_defAction= a; }992 uint32_t defAction(void) const { return m_defAction; }989 void setActionsAllowed(VBOXDNDACTIONLIST a) { m_dndLstActionsAllowed = a; } 990 VBOXDNDACTIONLIST getActionsAllowed(void) const { return m_dndLstActionsAllowed; } 991 992 void setActionDefault(VBOXDNDACTION a) { m_dndActionDefault = a; } 993 VBOXDNDACTION getActionDefault(void) const { return m_dndActionDefault; } 993 994 994 995 void setFormats(const GuestDnDMIMEList &lstFormats) { m_lstFormats = lstFormats; } … … 1018 1019 /** Default action to perform in case of a 1019 1020 * successful drop. */ 1020 uint32_t m_defAction; 1021 /** Actions supported by the guest in case of 1022 * a successful drop. */ 1023 uint32_t m_allActions; 1021 VBOXDNDACTION m_dndActionDefault; 1022 /** Actions supported by the guest in case of a successful drop. */ 1023 VBOXDNDACTIONLIST m_dndLstActionsAllowed; 1024 1024 /** Format(s) requested/supported from the guest. */ 1025 1025 GuestDnDMIMEList m_lstFormats; … … 1094 1094 static GuestDnDMIMEList toFilteredFormatList(const GuestDnDMIMEList &lstFormatsSupported, const GuestDnDMIMEList &lstFormatsWanted); 1095 1095 static GuestDnDMIMEList toFilteredFormatList(const GuestDnDMIMEList &lstFormatsSupported, const com::Utf8Str &strFormatsWanted); 1096 static DnDAction_T toMainAction( uint32_t uAction);1097 static std::vector<DnDAction_T> toMainActions( uint32_t uActions);1098 static uint32_ttoHGCMAction(DnDAction_T enmAction);1099 static void toHGCMActions(DnDAction_T enmDefAction, uint32_t *puDefAction, const std::vector<DnDAction_T> vecAllowedActions, uint32_t *puAllowedActions);1096 static DnDAction_T toMainAction(VBOXDNDACTION dndAction); 1097 static std::vector<DnDAction_T> toMainActions(VBOXDNDACTIONLIST dndActionList); 1098 static VBOXDNDACTION toHGCMAction(DnDAction_T enmAction); 1099 static void toHGCMActions(DnDAction_T enmDefAction, VBOXDNDACTION *pDefAction, const std::vector<DnDAction_T> vecAllowedActions, VBOXDNDACTIONLIST *pLstAllowedActions); 1100 1100 /** @} */ 1101 1101 -
trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
r74411 r74439 188 188 GuestDnDResponse::GuestDnDResponse(const ComObjPtr<Guest>& pGuest) 189 189 : m_EventSem(NIL_RTSEMEVENT) 190 , m_d efAction(0)191 , m_ allActions(0)190 , m_dndActionDefault(0) 191 , m_dndLstActionsAllowed(0) 192 192 , m_pParent(pGuest) 193 193 { … … 214 214 LogFlowThisFuncEnter(); 215 215 216 m_d efAction= 0;217 m_ allActions= 0;216 m_dndActionDefault = 0; 217 m_dndLstActionsAllowed = 0; 218 218 219 219 m_lstFormats.clear(); … … 384 384 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 385 385 386 set DefAction(pCBData->uAction);386 setActionDefault(pCBData->uAction); 387 387 rc = notifyAboutGuestResponse(); 388 388 break; … … 453 453 { 454 454 setFormats (GuestDnD::toFormatList(pCBData->pszFormat)); 455 set DefAction(pCBData->uDefAction);456 setA llActions(pCBData->uAllActions);455 setActionDefault (pCBData->uDefAction); 456 setActionsAllowed(pCBData->uAllActions); 457 457 458 458 rc = VINF_SUCCESS; … … 671 671 672 672 /* static */ 673 uint32_tGuestDnD::toHGCMAction(DnDAction_T enmAction)674 { 675 uint32_t uAction = VBOX_DND_ACTION_IGNORE;673 VBOXDNDACTION GuestDnD::toHGCMAction(DnDAction_T enmAction) 674 { 675 VBOXDNDACTION dndAction = VBOX_DND_ACTION_IGNORE; 676 676 switch (enmAction) 677 677 { 678 678 case DnDAction_Copy: 679 uAction = VBOX_DND_ACTION_COPY;679 dndAction = VBOX_DND_ACTION_COPY; 680 680 break; 681 681 case DnDAction_Move: 682 uAction = VBOX_DND_ACTION_MOVE;682 dndAction = VBOX_DND_ACTION_MOVE; 683 683 break; 684 684 case DnDAction_Link: … … 693 693 } 694 694 695 return uAction;695 return dndAction; 696 696 } 697 697 698 698 /* static */ 699 void GuestDnD::toHGCMActions(DnDAction_T enmD efAction,700 uint32_t *puDefAction,701 const std::vector<DnDAction_T> vec AllowedActions,702 uint32_t *puAllowedActions)703 { 704 uint32_t uAllowedActions= VBOX_DND_ACTION_IGNORE;705 uint32_t uDefAction = toHGCMAction(enmDefAction);706 707 if (!vec AllowedActions.empty())699 void GuestDnD::toHGCMActions(DnDAction_T enmDnDActionDefault, 700 VBOXDNDACTION *pDnDActionDefault, 701 const std::vector<DnDAction_T> vecDnDActionsAllowed, 702 VBOXDNDACTIONLIST *pDnDLstActionsAllowed) 703 { 704 VBOXDNDACTIONLIST dndLstActionsAllowed = VBOX_DND_ACTION_IGNORE; 705 VBOXDNDACTION dndActionDefault = toHGCMAction(enmDnDActionDefault); 706 707 if (!vecDnDActionsAllowed.empty()) 708 708 { 709 709 /* First convert the allowed actions to a bit array. */ 710 for (size_t i = 0; i < vec AllowedActions.size(); i++)711 uAllowedActions |= toHGCMAction(vecAllowedActions[i]);710 for (size_t i = 0; i < vecDnDActionsAllowed.size(); i++) 711 dndLstActionsAllowed |= toHGCMAction(vecDnDActionsAllowed[i]); 712 712 713 713 /* … … 715 715 * set allowed actions, preferring copy, move (in that order). 716 716 */ 717 if (isDnDIgnoreAction( uDefAction))718 { 719 if (hasDnDCopyAction( uAllowedActions))720 uDefAction= VBOX_DND_ACTION_COPY;721 else if (hasDnDMoveAction( uAllowedActions))722 uDefAction= VBOX_DND_ACTION_MOVE;723 } 724 } 725 726 if (p uDefAction)727 *p uDefAction = uDefAction;728 if (p uAllowedActions)729 *p uAllowedActions = uAllowedActions;717 if (isDnDIgnoreAction(dndActionDefault)) 718 { 719 if (hasDnDCopyAction(dndLstActionsAllowed)) 720 dndActionDefault = VBOX_DND_ACTION_COPY; 721 else if (hasDnDMoveAction(dndLstActionsAllowed)) 722 dndActionDefault = VBOX_DND_ACTION_MOVE; 723 } 724 } 725 726 if (pDnDActionDefault) 727 *pDnDActionDefault = dndActionDefault; 728 if (pDnDLstActionsAllowed) 729 *pDnDLstActionsAllowed = dndLstActionsAllowed; 730 730 } 731 731 732 732 /* static */ 733 DnDAction_T GuestDnD::toMainAction( uint32_t uAction)733 DnDAction_T GuestDnD::toMainAction(VBOXDNDACTION dndAction) 734 734 { 735 735 /* For now it doesn't seems useful to allow a 736 736 * link action between host & guest. Maybe later! */ 737 return isDnDCopyAction( uAction) ? DnDAction_Copy738 : isDnDMoveAction( uAction) ? DnDAction_Move739 : DnDAction_Ignore;737 return isDnDCopyAction(dndAction) ? DnDAction_Copy 738 : isDnDMoveAction(dndAction) ? DnDAction_Move 739 : DnDAction_Ignore; 740 740 } 741 741 742 742 /* static */ 743 std::vector<DnDAction_T> GuestDnD::toMainActions( uint32_t uActions)743 std::vector<DnDAction_T> GuestDnD::toMainActions(VBOXDNDACTIONLIST dndActionList) 744 744 { 745 745 std::vector<DnDAction_T> vecActions; … … 748 748 * link action between host & guest. Maybe later! */ 749 749 RTCList<DnDAction_T> lstActions; 750 if (hasDnDCopyAction( uActions))750 if (hasDnDCopyAction(dndActionList)) 751 751 lstActions.append(DnDAction_Copy); 752 if (hasDnDMoveAction( uActions))752 if (hasDnDMoveAction(dndActionList)) 753 753 lstActions.append(DnDAction_Move); 754 754 -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r74361 r74439 279 279 280 280 if ( fFetchResult 281 && isDnDIgnoreAction(pResp-> defAction()))281 && isDnDIgnoreAction(pResp->getActionDefault())) 282 282 fFetchResult = false; 283 283 … … 299 299 300 300 aFormats = lstFiltered; 301 aAllowedActions = GuestDnD::toMainActions(pResp-> allActions());301 aAllowedActions = GuestDnD::toMainActions(pResp->getActionsAllowed()); 302 302 if (aDefaultAction) 303 *aDefaultAction = GuestDnD::toMainAction(pResp-> defAction());303 *aDefaultAction = GuestDnD::toMainAction(pResp->getActionDefault()); 304 304 305 305 /* Apply the (filtered) formats list. */ … … 310 310 } 311 311 312 LogFlowFunc(("fFetchResult=%RTbool, allActions=0x%x\n", fFetchResult, pResp->allActions()));312 LogFlowFunc(("fFetchResult=%RTbool, lstActionsAllowed=0x%x\n", fFetchResult, pResp->getActionsAllowed())); 313 313 } 314 314 … … 337 337 return setError(E_INVALIDARG, tr("Specified format '%s' is not supported"), aFormat.c_str()); 338 338 339 uint32_t uAction = GuestDnD::toHGCMAction(aAction);340 if (isDnDIgnoreAction( uAction)) /* If there is no usable action, ignore this request. */339 VBOXDNDACTION dndAction = GuestDnD::toHGCMAction(aAction); 340 if (isDnDIgnoreAction(dndAction)) /* If there is no usable action, ignore this request. */ 341 341 return S_OK; 342 342 -
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r74411 r74439 274 274 DnDAction_T resAction = DnDAction_Ignore; 275 275 276 /* Check & convert the drag & drop actions */ 277 uint32_t uDefAction = 0; 278 uint32_t uAllowedActions = 0; 279 GuestDnD::toHGCMActions(aDefaultAction, &uDefAction, 280 aAllowedActions, &uAllowedActions); 276 /* Check & convert the drag & drop actions. */ 277 VBOXDNDACTION dndActionDefault = 0; 278 VBOXDNDACTIONLIST dndActionListAllowed = 0; 279 GuestDnD::toHGCMActions(aDefaultAction, &dndActionDefault, 280 aAllowedActions, &dndActionListAllowed); 281 281 282 /* If there is no usable action, ignore this request. */ 282 if (isDnDIgnoreAction( uDefAction))283 if (isDnDIgnoreAction(dndActionDefault)) 283 284 return S_OK; 284 285 … … 316 317 Msg.setNextUInt32(aX); 317 318 Msg.setNextUInt32(aY); 318 Msg.setNextUInt32( uDefAction);319 Msg.setNextUInt32( uAllowedActions);319 Msg.setNextUInt32(dndActionDefault); 320 Msg.setNextUInt32(dndActionListAllowed); 320 321 Msg.setNextPointer((void *)strFormats.c_str(), cbFormats); 321 322 Msg.setNextUInt32(cbFormats); … … 326 327 GuestDnDResponse *pResp = GuestDnDInst()->response(); 327 328 if (pResp && RT_SUCCESS(pResp->waitForGuestResponse())) 328 resAction = GuestDnD::toMainAction(pResp-> defAction());329 resAction = GuestDnD::toMainAction(pResp->getActionDefault()); 329 330 } 330 331 } … … 363 364 364 365 /* Check & convert the drag & drop actions. */ 365 uint32_t uDefAction = 0; 366 uint32_t uAllowedActions = 0; 367 GuestDnD::toHGCMActions(aDefaultAction, &uDefAction, 368 aAllowedActions, &uAllowedActions); 366 VBOXDNDACTION dndActionDefault = 0; 367 VBOXDNDACTIONLIST dndActionListAllowed = 0; 368 GuestDnD::toHGCMActions(aDefaultAction, &dndActionDefault, 369 aAllowedActions, &dndActionListAllowed); 370 369 371 /* If there is no usable action, ignore this request. */ 370 if (isDnDIgnoreAction( uDefAction))372 if (isDnDIgnoreAction(dndActionDefault)) 371 373 return S_OK; 372 374 … … 393 395 Msg.setNextUInt32(aX); 394 396 Msg.setNextUInt32(aY); 395 Msg.setNextUInt32( uDefAction);396 Msg.setNextUInt32( uAllowedActions);397 Msg.setNextUInt32(dndActionDefault); 398 Msg.setNextUInt32(dndActionListAllowed); 397 399 Msg.setNextPointer((void *)strFormats.c_str(), cbFormats); 398 400 Msg.setNextUInt32(cbFormats); … … 403 405 GuestDnDResponse *pResp = GuestDnDInst()->response(); 404 406 if (pResp && RT_SUCCESS(pResp->waitForGuestResponse())) 405 resAction = GuestDnD::toMainAction(pResp-> defAction());407 resAction = GuestDnD::toMainAction(pResp->getActionDefault()); 406 408 } 407 409 } … … 480 482 481 483 /* Check & convert the drag & drop actions to HGCM codes. */ 482 uint32_t uDefAction = VBOX_DND_ACTION_IGNORE; 483 uint32_t uAllowedActions = 0; 484 GuestDnD::toHGCMActions(aDefaultAction, &uDefAction, 485 aAllowedActions, &uAllowedActions); 484 VBOXDNDACTION dndActionDefault = VBOX_DND_ACTION_IGNORE; 485 VBOXDNDACTIONLIST dndActionListAllowed = 0; 486 GuestDnD::toHGCMActions(aDefaultAction, &dndActionDefault, 487 aAllowedActions, &dndActionListAllowed); 488 486 489 /* If there is no usable action, ignore this request. */ 487 if (isDnDIgnoreAction( uDefAction))490 if (isDnDIgnoreAction(dndActionDefault)) 488 491 { 489 492 aFormat = ""; … … 514 517 Msg.setNextUInt32(aX); 515 518 Msg.setNextUInt32(aY); 516 Msg.setNextUInt32( uDefAction);517 Msg.setNextUInt32( uAllowedActions);519 Msg.setNextUInt32(dndActionDefault); 520 Msg.setNextUInt32(dndActionListAllowed); 518 521 Msg.setNextPointer((void*)strFormats.c_str(), cbFormats); 519 522 Msg.setNextUInt32(cbFormats); … … 528 531 if (RT_SUCCESS(vrc)) 529 532 { 530 resAction = GuestDnD::toMainAction(pResp-> defAction());533 resAction = GuestDnD::toMainAction(pResp->getActionDefault()); 531 534 532 535 GuestDnDMIMEList lstFormats = pResp->formats(); … … 534 537 { 535 538 aFormat = lstFormats.at(0); 536 LogFlowFunc(("resFormat=%s, resAction=%RU32\n", aFormat.c_str(), pResp-> defAction()));539 LogFlowFunc(("resFormat=%s, resAction=%RU32\n", aFormat.c_str(), pResp->getActionDefault())); 537 540 } 538 541 else
Note:
See TracChangeset
for help on using the changeset viewer.