Changeset 81286 in vbox for trunk/src/VBox/Main
- Timestamp:
- Oct 15, 2019 4:37:37 PM (5 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r81190 r81286 5853 5853 <interface 5854 5854 name="IMachine" extends="$unknown" 5855 uuid=" 13a7c7cb-02fd-4962-a578-5660a5035776"5855 uuid="0020076B-00D0-494E-0023-C293000086A7" 5856 5856 wsmap="managed" 5857 5857 wrap-hint-server-addinterfaces="IInternalMachineControl" … … 6404 6404 Synchronization mode between the host OS clipboard 6405 6405 and the guest OS clipboard. 6406 </desc> 6407 </attribute> 6408 6409 <attribute name="clipboardFileTransfersEnabled" type="boolean"> 6410 <desc> 6411 Sets or retrieves whether clipboard file transfers are allowed or not. 6412 6413 When set to @a true, clipboard file transfers between supported 6414 host and guest OSes are allowed. 6406 6415 </desc> 6407 6416 </attribute> … … 21775 21784 <param name="clipboardMode" type="ClipboardMode" dir="in"> 21776 21785 <desc>The new shared clipboard mode.</desc> 21786 </param> 21787 </method> 21788 21789 <method name="onClipboardFileTransferModeChange"> 21790 <desc> 21791 Notification when the shared clipboard file transfers mode changes. 21792 </desc> 21793 <param name="enabled" type="boolean" dir="in"> 21794 <desc>Flag whether clipboard file transfers are allowed or not.</desc> 21777 21795 </param> 21778 21796 </method> … … 24082 24100 </desc> 24083 24101 </const> 24102 <const name="OnClipboardFileTransferModeChanged" value="104"> 24103 <desc> 24104 See <link to="IClipboardFileTransferModeChangedEvent">IClipboardFileTransferModeChangedEvent</link>. 24105 </desc> 24106 </const> 24084 24107 <!-- End event marker --> 24085 24108 <!-- @todo rename to 'End' as it is exclusive (we use 'last' to be inclusive). --> 24086 <const name="Last" value="10 4">24109 <const name="Last" value="105"> 24087 24110 <desc> 24088 24111 Must be last event, used for iterations and structures relying on numerical event values. … … 24903 24926 <desc> 24904 24927 The new clipboard mode. 24928 </desc> 24929 </attribute> 24930 </interface> 24931 24932 <interface 24933 name="IClipboardFileTransferModeChangedEvent" extends="IEvent" 24934 uuid="00391758-00B1-4E9D-0000-11FA00F9D583" 24935 wsmap="managed" autogen="VBoxEvent" id="OnClipboardFileTransferModeChanged" 24936 > 24937 <desc> 24938 Notification when the shared clipboard file transfer mode changes. 24939 </desc> 24940 <attribute name="enabled" type="boolean" readonly="yes"> 24941 <desc> 24942 Whether file transfers are allowed or not. 24905 24943 </desc> 24906 24944 </attribute> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r80849 r81286 190 190 HRESULT i_onCPUExecutionCapChange(ULONG aExecutionCap); 191 191 HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode); 192 HRESULT i_onClipboardFileTransferModeChange(bool aEnabled); 192 193 HRESULT i_onDnDModeChange(DnDMode_T aDnDMode); 193 194 HRESULT i_onVRDEServerChange(BOOL aRestart); … … 773 774 774 775 int i_changeClipboardMode(ClipboardMode_T aClipboardMode); 776 int i_changeClipboardFileTransferMode(bool aEnabled); 775 777 int i_changeDnDMode(DnDMode_T aDnDMode); 776 778 -
trunk/src/VBox/Main/include/MachineImpl.h
r81087 r81286 311 311 312 312 ClipboardMode_T mClipboardMode; 313 BOOL mClipboardFileTransfersEnabled; 314 313 315 DnDMode_T mDnDMode; 314 316 … … 528 530 virtual HRESULT i_onVMProcessPriorityChange(VMProcPriority_T /* aPriority */) { return S_OK; } 529 531 virtual HRESULT i_onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; } 532 virtual HRESULT i_onClipboardFileTransferModeChange(BOOL /* aEnable */) { return S_OK; } 530 533 virtual HRESULT i_onDnDModeChange(DnDMode_T /* aDnDMode */) { return S_OK; } 531 534 virtual HRESULT i_onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; } … … 929 932 HRESULT getClipboardMode(ClipboardMode_T *aClipboardMode); 930 933 HRESULT setClipboardMode(ClipboardMode_T aClipboardMode); 934 HRESULT getClipboardFileTransfersEnabled(BOOL *aEnabled); 935 HRESULT setClipboardFileTransfersEnabled(BOOL aEnabled); 931 936 HRESULT getDnDMode(DnDMode_T *aDnDMode); 932 937 HRESULT setDnDMode(DnDMode_T aDnDMode); … … 1345 1350 HRESULT i_onSharedFolderChange(); 1346 1351 HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode); 1352 HRESULT i_onClipboardFileTransferModeChange(BOOL aEnable); 1347 1353 HRESULT i_onDnDModeChange(DnDMode_T aDnDMode); 1348 1354 HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup); -
trunk/src/VBox/Main/include/SessionImpl.h
r78261 r81286 101 101 HRESULT onVMProcessPriorityChange(VMProcPriority_T priority); 102 102 HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode); 103 HRESULT onClipboardFileTransferModeChange(BOOL aEnabled); 103 104 HRESULT onDnDModeChange(DnDMode_T aDndMode); 104 105 HRESULT onCPUChange(ULONG aCpu, -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r80849 r81286 5374 5374 alock.release(); 5375 5375 fireClipboardModeChangedEvent(mEventSource, aClipboardMode); 5376 } 5377 5378 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); 5379 return rc; 5380 } 5381 5382 /** 5383 * Called by IInternalSessionControl::OnClipboardFileTransferModeChange(). 5384 * 5385 * @note Locks this object for writing. 5386 */ 5387 HRESULT Console::i_onClipboardFileTransferModeChange(bool aEnabled) 5388 { 5389 LogFlowThisFunc(("\n")); 5390 5391 AutoCaller autoCaller(this); 5392 AssertComRCReturnRC(autoCaller.rc()); 5393 5394 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5395 5396 HRESULT rc = S_OK; 5397 5398 /* don't trigger the change if the VM isn't running */ 5399 SafeVMPtrQuiet ptrVM(this); 5400 if (ptrVM.isOk()) 5401 { 5402 if ( mMachineState == MachineState_Running 5403 || mMachineState == MachineState_Teleporting 5404 || mMachineState == MachineState_LiveSnapshotting) 5405 { 5406 int vrc = i_changeClipboardFileTransferMode(aEnabled); 5407 if (RT_FAILURE(vrc)) 5408 rc = E_FAIL; /** @todo r=andy Set error info here? */ 5409 } 5410 else 5411 rc = i_setInvalidMachineStateError(); 5412 ptrVM.release(); 5413 } 5414 5415 /* notify console callbacks on success */ 5416 if (SUCCEEDED(rc)) 5417 { 5418 alock.release(); 5419 fireClipboardFileTransferModeChangedEvent(mEventSource, aEnabled ? TRUE : FALSE); 5376 5420 } 5377 5421 … … 9285 9329 9286 9330 /** 9331 * Changes the clipboard file transfer mode. 9332 * 9333 * @returns VBox status code. 9334 * @param aEnabled Whether clipboard file transfers are enabled or not. 9335 */ 9336 int Console::i_changeClipboardFileTransferMode(bool aEnabled) 9337 { 9338 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 9339 VMMDev *pVMMDev = m_pVMMDev; 9340 AssertPtrReturn(pVMMDev, VERR_INVALID_POINTER); 9341 9342 VBOXHGCMSVCPARM parm; 9343 RT_ZERO(parm); 9344 9345 parm.type = VBOX_HGCM_SVC_PARM_32BIT; 9346 parm.u.uint32 = aEnabled ? VBOX_SHCL_TRANSFER_MODE_ENABLED : VBOX_SHCL_TRANSFER_MODE_DISABLED; 9347 9348 int vrc = pVMMDev->hgcmHostCall("VBoxSharedClipboard", VBOX_SHCL_HOST_FN_SET_TRANSFER_MODE, 1 /* cParms */, &parm); 9349 if (RT_FAILURE(vrc)) 9350 LogRel(("Shared Clipboard: Error changing file transfer mode: %Rrc\n", vrc)); 9351 9352 return vrc; 9353 #else 9354 RT_NOREF(aEnabled); 9355 return VERR_NOT_IMPLEMENTED; 9356 #endif 9357 } 9358 9359 /** 9287 9360 * Changes the drag and drop mode. 9288 9361 * -
trunk/src/VBox/Main/src-client/SessionImpl.cpp
r78261 r81286 811 811 } 812 812 813 HRESULT Session::onClipboardFileTransferModeChange(BOOL aEnabled) 814 { 815 LogFlowThisFunc(("\n")); 816 817 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 818 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 819 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 820 #ifndef VBOX_COM_INPROC_API_CLIENT 821 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 822 823 return mConsole->i_onClipboardFileTransferModeChange(RT_BOOL(aEnabled)); 824 #else 825 RT_NOREF(aEnabled); 826 return S_OK; 827 #endif 828 } 829 813 830 HRESULT Session::onDnDModeChange(DnDMode_T aDndMode) 814 831 { -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r81087 r81286 86 86 # include <VBox/HostServices/GuestPropertySvc.h> 87 87 # include <VBox/com/array.h> 88 #endif 89 90 #ifdef VBOX_WITH_SHARED_CLIPBOARD 91 # include <VBox/HostServices/VBoxClipboardSvc.h> 88 92 #endif 89 93 … … 214 218 mBootOrder[i] = DeviceType_Null; 215 219 216 mClipboardMode = ClipboardMode_Disabled; 220 mClipboardMode = ClipboardMode_Disabled; 221 mClipboardFileTransfersEnabled = FALSE; 222 217 223 mDnDMode = DnDMode_Disabled; 218 224 … … 2734 2740 } 2735 2741 2742 HRESULT Machine::getClipboardFileTransfersEnabled(BOOL *aEnabled) 2743 { 2744 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2745 2746 *aEnabled = mHWData->mClipboardFileTransfersEnabled; 2747 2748 return S_OK; 2749 } 2750 2751 HRESULT Machine::setClipboardFileTransfersEnabled(BOOL aEnabled) 2752 { 2753 HRESULT rc = S_OK; 2754 2755 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2756 2757 alock.release(); 2758 rc = i_onClipboardFileTransferModeChange(aEnabled); 2759 alock.acquire(); 2760 if (FAILED(rc)) return rc; 2761 2762 i_setModified(IsModified_MachineData); 2763 mHWData.backup(); 2764 mHWData->mClipboardFileTransfersEnabled = aEnabled; 2765 2766 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 2767 if (Global::IsOnline(mData->mMachineState)) 2768 i_saveSettings(NULL); 2769 2770 return S_OK; 2771 } 2772 2736 2773 HRESULT Machine::getDnDMode(DnDMode_T *aDnDMode) 2737 2774 { … … 8981 9018 8982 9019 // Clipboard 8983 mHWData->mClipboardMode = data.clipboardMode; 9020 mHWData->mClipboardMode = data.clipboardMode; 9021 mHWData->mClipboardFileTransfersEnabled = data.fClipboardFileTransfersEnabled ? TRUE : FALSE; 8984 9022 8985 9023 // drag'n'drop … … 10284 10322 10285 10323 // clipboard 10286 data.clipboardMode = mHWData->mClipboardMode; 10324 data.clipboardMode = mHWData->mClipboardMode; 10325 data.fClipboardFileTransfersEnabled = RT_BOOL(mHWData->mClipboardFileTransfersEnabled); 10287 10326 10288 10327 // drag'n'drop … … 14266 14305 * @note Locks this object for reading. 14267 14306 */ 14307 HRESULT SessionMachine::i_onClipboardFileTransferModeChange(BOOL aEnable) 14308 { 14309 LogFlowThisFunc(("\n")); 14310 14311 AutoCaller autoCaller(this); 14312 AssertComRCReturnRC(autoCaller.rc()); 14313 14314 ComPtr<IInternalSessionControl> directControl; 14315 { 14316 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 14317 if (mData->mSession.mLockType == LockType_VM) 14318 directControl = mData->mSession.mDirectControl; 14319 } 14320 14321 /* ignore notifications sent after #OnSessionEnd() is called */ 14322 if (!directControl) 14323 return S_OK; 14324 14325 return directControl->OnClipboardFileTransferModeChange(aEnable); 14326 } 14327 14328 /** 14329 * @note Locks this object for reading. 14330 */ 14268 14331 HRESULT SessionMachine::i_onDnDModeChange(DnDMode_T aDnDMode) 14269 14332 { -
trunk/src/VBox/Main/xml/Settings.cpp
r81103 r81286 3234 3234 fEmulatedUSBCardReader(false), 3235 3235 clipboardMode(ClipboardMode_Disabled), 3236 fClipboardFileTransfersEnabled(false), 3236 3237 dndMode(DnDMode_Disabled), 3237 3238 ulMemoryBalloonSize(0), … … 3327 3328 { 3328 3329 return (this == &h) 3329 || ( strVersion == h.strVersion 3330 && uuid == h.uuid 3331 && fHardwareVirt == h.fHardwareVirt 3332 && fNestedPaging == h.fNestedPaging 3333 && fLargePages == h.fLargePages 3334 && fVPID == h.fVPID 3335 && fUnrestrictedExecution == h.fUnrestrictedExecution 3336 && fHardwareVirtForce == h.fHardwareVirtForce 3337 && fUseNativeApi == h.fUseNativeApi 3338 && fPAE == h.fPAE 3339 && enmLongMode == h.enmLongMode 3340 && fTripleFaultReset == h.fTripleFaultReset 3341 && fAPIC == h.fAPIC 3342 && fX2APIC == h.fX2APIC 3343 && fIBPBOnVMExit == h.fIBPBOnVMExit 3344 && fIBPBOnVMEntry == h.fIBPBOnVMEntry 3345 && fSpecCtrl == h.fSpecCtrl 3346 && fSpecCtrlByHost == h.fSpecCtrlByHost 3347 && fL1DFlushOnSched == h.fL1DFlushOnSched 3348 && fL1DFlushOnVMEntry == h.fL1DFlushOnVMEntry 3349 && fMDSClearOnSched == h.fMDSClearOnSched 3350 && fMDSClearOnVMEntry == h.fMDSClearOnVMEntry 3351 && fNestedHWVirt == h.fNestedHWVirt 3352 && cCPUs == h.cCPUs 3353 && fCpuHotPlug == h.fCpuHotPlug 3354 && ulCpuExecutionCap == h.ulCpuExecutionCap 3355 && uCpuIdPortabilityLevel == h.uCpuIdPortabilityLevel 3356 && strCpuProfile == h.strCpuProfile 3357 && fHPETEnabled == h.fHPETEnabled 3358 && llCpus == h.llCpus 3359 && llCpuIdLeafs == h.llCpuIdLeafs 3360 && ulMemorySizeMB == h.ulMemorySizeMB 3361 && mapBootOrder == h.mapBootOrder 3362 && graphicsControllerType == h.graphicsControllerType 3363 && ulVRAMSizeMB == h.ulVRAMSizeMB 3364 && cMonitors == h.cMonitors 3365 && fAccelerate3D == h.fAccelerate3D 3366 && fAccelerate2DVideo == h.fAccelerate2DVideo 3367 && firmwareType == h.firmwareType 3368 && pointingHIDType == h.pointingHIDType 3369 && keyboardHIDType == h.keyboardHIDType 3370 && chipsetType == h.chipsetType 3371 && paravirtProvider == h.paravirtProvider 3372 && strParavirtDebug == h.strParavirtDebug 3373 && fEmulatedUSBCardReader == h.fEmulatedUSBCardReader 3374 && vrdeSettings == h.vrdeSettings 3375 && biosSettings == h.biosSettings 3376 && usbSettings == h.usbSettings 3377 && llNetworkAdapters == h.llNetworkAdapters 3378 && llSerialPorts == h.llSerialPorts 3379 && llParallelPorts == h.llParallelPorts 3380 && audioAdapter == h.audioAdapter 3381 && storage == h.storage 3382 && llSharedFolders == h.llSharedFolders 3383 && clipboardMode == h.clipboardMode 3384 && dndMode == h.dndMode 3385 && ulMemoryBalloonSize == h.ulMemoryBalloonSize 3386 && fPageFusionEnabled == h.fPageFusionEnabled 3387 && llGuestProperties == h.llGuestProperties 3388 && ioSettings == h.ioSettings 3389 && pciAttachments == h.pciAttachments 3390 && strDefaultFrontend == h.strDefaultFrontend); 3330 || ( strVersion == h.strVersion 3331 && uuid == h.uuid 3332 && fHardwareVirt == h.fHardwareVirt 3333 && fNestedPaging == h.fNestedPaging 3334 && fLargePages == h.fLargePages 3335 && fVPID == h.fVPID 3336 && fUnrestrictedExecution == h.fUnrestrictedExecution 3337 && fHardwareVirtForce == h.fHardwareVirtForce 3338 && fUseNativeApi == h.fUseNativeApi 3339 && fPAE == h.fPAE 3340 && enmLongMode == h.enmLongMode 3341 && fTripleFaultReset == h.fTripleFaultReset 3342 && fAPIC == h.fAPIC 3343 && fX2APIC == h.fX2APIC 3344 && fIBPBOnVMExit == h.fIBPBOnVMExit 3345 && fIBPBOnVMEntry == h.fIBPBOnVMEntry 3346 && fSpecCtrl == h.fSpecCtrl 3347 && fSpecCtrlByHost == h.fSpecCtrlByHost 3348 && fL1DFlushOnSched == h.fL1DFlushOnSched 3349 && fL1DFlushOnVMEntry == h.fL1DFlushOnVMEntry 3350 && fMDSClearOnSched == h.fMDSClearOnSched 3351 && fMDSClearOnVMEntry == h.fMDSClearOnVMEntry 3352 && fNestedHWVirt == h.fNestedHWVirt 3353 && cCPUs == h.cCPUs 3354 && fCpuHotPlug == h.fCpuHotPlug 3355 && ulCpuExecutionCap == h.ulCpuExecutionCap 3356 && uCpuIdPortabilityLevel == h.uCpuIdPortabilityLevel 3357 && strCpuProfile == h.strCpuProfile 3358 && fHPETEnabled == h.fHPETEnabled 3359 && llCpus == h.llCpus 3360 && llCpuIdLeafs == h.llCpuIdLeafs 3361 && ulMemorySizeMB == h.ulMemorySizeMB 3362 && mapBootOrder == h.mapBootOrder 3363 && graphicsControllerType == h.graphicsControllerType 3364 && ulVRAMSizeMB == h.ulVRAMSizeMB 3365 && cMonitors == h.cMonitors 3366 && fAccelerate3D == h.fAccelerate3D 3367 && fAccelerate2DVideo == h.fAccelerate2DVideo 3368 && firmwareType == h.firmwareType 3369 && pointingHIDType == h.pointingHIDType 3370 && keyboardHIDType == h.keyboardHIDType 3371 && chipsetType == h.chipsetType 3372 && paravirtProvider == h.paravirtProvider 3373 && strParavirtDebug == h.strParavirtDebug 3374 && fEmulatedUSBCardReader == h.fEmulatedUSBCardReader 3375 && vrdeSettings == h.vrdeSettings 3376 && biosSettings == h.biosSettings 3377 && usbSettings == h.usbSettings 3378 && llNetworkAdapters == h.llNetworkAdapters 3379 && llSerialPorts == h.llSerialPorts 3380 && llParallelPorts == h.llParallelPorts 3381 && audioAdapter == h.audioAdapter 3382 && storage == h.storage 3383 && llSharedFolders == h.llSharedFolders 3384 && clipboardMode == h.clipboardMode 3385 && fClipboardFileTransfersEnabled == h.fClipboardFileTransfersEnabled 3386 && dndMode == h.dndMode 3387 && ulMemoryBalloonSize == h.ulMemoryBalloonSize 3388 && fPageFusionEnabled == h.fPageFusionEnabled 3389 && llGuestProperties == h.llGuestProperties 3390 && ioSettings == h.ioSettings 3391 && pciAttachments == h.pciAttachments 3392 && strDefaultFrontend == h.strDefaultFrontend); 3391 3393 } 3392 3394 … … 4888 4890 throw ConfigFileError(this, pelmHwChild, N_("Invalid value '%s' in Clipboard/@mode attribute"), strTemp.c_str()); 4889 4891 } 4892 4893 pelmHwChild->getAttributeValue("fileTransfersEnabled", hw.fClipboardFileTransfersEnabled); 4890 4894 } 4891 4895 else if (pelmHwChild->nameEquals("DragAndDrop")) … … 6661 6665 } 6662 6666 6663 if (hw.clipboardMode != ClipboardMode_Disabled) 6664 { 6665 xml::ElementNode *pelmClip = pelmHardware->createChild("Clipboard"); 6666 const char *pcszClip; 6667 switch (hw.clipboardMode) 6668 { 6669 default: /*case ClipboardMode_Disabled:*/ pcszClip = "Disabled"; break; 6670 case ClipboardMode_HostToGuest: pcszClip = "HostToGuest"; break; 6671 case ClipboardMode_GuestToHost: pcszClip = "GuestToHost"; break; 6672 case ClipboardMode_Bidirectional: pcszClip = "Bidirectional"; break; 6673 } 6674 pelmClip->setAttribute("mode", pcszClip); 6667 xml::ElementNode *pelmClip = pelmHardware->createChild("Clipboard"); 6668 if (pelmClip) 6669 { 6670 if (hw.clipboardMode != ClipboardMode_Disabled) 6671 { 6672 const char *pcszClip; 6673 switch (hw.clipboardMode) 6674 { 6675 default: /*case ClipboardMode_Disabled:*/ pcszClip = "Disabled"; break; 6676 case ClipboardMode_HostToGuest: pcszClip = "HostToGuest"; break; 6677 case ClipboardMode_GuestToHost: pcszClip = "GuestToHost"; break; 6678 case ClipboardMode_Bidirectional: pcszClip = "Bidirectional"; break; 6679 } 6680 pelmClip->setAttribute("mode", pcszClip); 6681 } 6682 6683 if (hw.fClipboardFileTransfersEnabled) 6684 pelmClip->setAttribute("fileTransfersEnabled", hw.fClipboardFileTransfersEnabled); 6675 6685 } 6676 6686
Note:
See TracChangeset
for help on using the changeset viewer.