Changeset 52902 in vbox for trunk/src/VBox
- Timestamp:
- Sep 30, 2014 3:38:46 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r52894 r52902 222 222 , mSelectorWnd (NULL) 223 223 , m_pVirtualMachine(0) 224 , m IsSeparate(false)224 , m_fSeparateProcess(false) 225 225 , m_pMediumEnumerator(0) 226 226 , mIsKWinManaged (false) … … 3983 3983 mShowStartVMErrors = true; 3984 3984 bool startVM = false; 3985 bool fSeparate = false;3985 bool fSeparateProcess = false; 3986 3986 QString vmNameOrUuid; 3987 3987 … … 4005 4005 else if (!::strcmp (arg, "-separate") || !::strcmp (arg, "--separate")) 4006 4006 { 4007 fSeparate = true;4007 fSeparateProcess = true; 4008 4008 } 4009 4009 #ifdef VBOX_GUI_WITH_PIDFILE … … 4141 4141 if (startVM) 4142 4142 { 4143 /* m IsSeparatemakes sense only if a VM is started. */4144 m IsSeparate = fSeparate;4143 /* m_fSeparateProcess makes sense only if a VM is started. */ 4144 m_fSeparateProcess = fSeparateProcess; 4145 4145 4146 4146 QUuid uuid = QUuid(vmNameOrUuid); … … 4614 4614 if (enmLaunchMode == LaunchMode_Separate) 4615 4615 { 4616 KMachineState s = machine.GetState();4617 if ( s >= KMachineState_FirstOnline4618 && s <= KMachineState_LastOnline)4616 KMachineState state = machine.GetState(); 4617 if ( state >= KMachineState_FirstOnline 4618 && state <= KMachineState_LastOnline) 4619 4619 { 4620 4620 /* Already running. */ … … 4630 4630 * Hope 1 minute will be enough to spawn any running VM silently, 4631 4631 * otherwise we better show the progress... 4632 * If starting separately, then show the progress now. 4633 */ 4634 int iSpawningDuration = enmLaunchMode == LaunchMode_Separate? 4635 0: 4636 60000; 4632 * If starting separately, then show the progress now. */ 4633 int iSpawningDuration = enmLaunchMode == LaunchMode_Separate ? 0 : 60000; 4637 4634 msgCenter().showModalProgressDialog(progress, machine.GetName(), 4638 4635 ":/progress_start_90px.png", 0, iSpawningDuration); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r52894 r52902 68 68 public: 69 69 70 /** VM launch modes. */ 71 enum LaunchMode 72 { 73 LaunchMode_Default, 74 LaunchMode_Headless, 75 LaunchMode_Separate 76 }; 77 70 78 /* Static API: Create/destroy stuff: */ 71 79 static VBoxGlobal* instance(); … … 87 95 bool isBeta() const; 88 96 89 bool isSeparate() const { return mIsSeparate; } 97 /** Returns whether GUI is separate (from VM) process. */ 98 bool isSeparateProcess() const { return m_fSeparateProcess; } 90 99 91 100 #ifdef Q_WS_MAC … … 122 131 bool switchToMachine(CMachine &machine); 123 132 124 enum LaunchMode125 {126 LaunchMode_Default,127 LaunchMode_Headless,128 LaunchMode_Separate129 };130 133 bool launchMachine(CMachine &machine, LaunchMode enmLaunchMode = LaunchMode_Default); 131 134 … … 430 433 UIMachine *m_pVirtualMachine; 431 434 432 bool mIsSeparate; 435 /** Holds whether GUI is separate (from VM) process. */ 436 bool m_fSeparateProcess; 433 437 434 438 QString vmUuid; -
trunk/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp
r52894 r52902 42 42 int main(int argc, char **argv, char **envp) 43 43 { 44 /* 45 * First check whether we're about to start a VM. 46 */ 44 /* First check whether we're about to start a VM: */ 47 45 bool fStartVM = false; 48 bool fSeparate = false; 49 for (int i = 1; i < argc && !(fStartVM && fSeparate); i++) 46 /* In separate process: */ 47 bool fSeparateProcess = false; 48 for (int i = 1; i < argc && !(fStartVM && fSeparateProcess); ++i) 50 49 { 51 50 /* NOTE: the check here must match the corresponding check for the … … 60 59 || !MyStrCmp(argv[i], "-separate")) 61 60 { 62 fSeparate = true;61 fSeparateProcess = true; 63 62 } 64 63 } 65 64 66 uint32_t fFlags = (fStartVM && !fSeparate )? 0: SUPSECMAIN_FLAGS_DONT_OPEN_DEV;65 uint32_t fFlags = (fStartVM && !fSeparateProcess) ? 0 : SUPSECMAIN_FLAGS_DONT_OPEN_DEV; 67 66 68 67 return SUPR3HardenedMain("VirtualBox", fFlags | SUPSECMAIN_FLAGS_TRUSTED_ERROR, argc, argv, envp); -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r52894 r52902 301 301 if (!VBoxXInitThreads()) 302 302 return 1; 303 #endif 303 #endif /* Q_WS_X11 */ 304 304 305 305 /* Simulate try-catch block: */ … … 516 516 if (!VBoxXInitThreads()) 517 517 return 1; 518 #endif 518 #endif /* Q_WS_X11 */ 519 519 520 /* Initialize VBox Runtime. 520 521 * Initialize the SUPLib as well only if we are really about to start a VM. 521 * Don't do this if we are only starting the selector window 522 * or a separate VM process. */ 522 * Don't do this if we are only starting the selector window or a separate VM process. */ 523 523 bool fStartVM = false; 524 bool fSeparate = false;525 for (int i = 1; i < argc && !(fStartVM && fSeparate ); ++i)524 bool fSeparateProcess = false; 525 for (int i = 1; i < argc && !(fStartVM && fSeparateProcess); ++i) 526 526 { 527 527 /* NOTE: the check here must match the corresponding check for the … … 536 536 || !::strcmp(argv[i], "-separate")) 537 537 { 538 fSeparate = true;538 fSeparateProcess = true; 539 539 } 540 540 } 541 541 542 uint32_t fFlags = fStartVM && !fSeparate ? RTR3INIT_FLAGS_SUPLIB: 0;542 uint32_t fFlags = fStartVM && !fSeparateProcess ? RTR3INIT_FLAGS_SUPLIB : 0; 543 543 544 544 int rc = RTR3InitExe(argc, &argv, fFlags); … … 550 550 * just to show the only one error-message: */ 551 551 QApplication a(argc, &argv[0]); 552 Q_UNUSED(a); 553 552 554 #ifdef Q_OS_SOLARIS 553 555 /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r52894 r52902 202 202 203 203 com::SafeArray<FramebufferCapabilities_T> caps; 204 if (vboxGlobal().isSeparate ())204 if (vboxGlobal().isSeparateProcess()) 205 205 { 206 206 caps.resize(1); … … 221 221 { 222 222 CDisplaySourceBitmap sourceBitmap; 223 if (!vboxGlobal().isSeparate ())223 if (!vboxGlobal().isSeparateProcess()) 224 224 m_pMachineView->session().GetConsole().GetDisplay().QuerySourceBitmap(uScreenId, sourceBitmap); 225 225 … … 248 248 m_pendingSyncVisibleRegion = QRegion(); 249 249 250 if (!vboxGlobal().isSeparate ())250 if (!vboxGlobal().isSeparateProcess()) 251 251 { 252 252 /* Acquire new pending bitmap: */ … … 317 317 ComSafeArrayIn(BYTE, image)) 318 318 { 319 // TODO: Retina handling.. 320 321 /* Copying received data (is it shallow?): */ 319 322 com::SafeArray<BYTE> imageData(ComSafeArrayInArg(image)); 320 323 321 lock(); 324 /* Lock access to frame-buffer: */ 325 lock(); 326 327 // TODO: Why does this handling so different from UIFrameBuffer::NotifyUpdate? 328 // And where is the part about m_fUnused? 322 329 323 330 if (m_fUpdatesAllowed) 324 331 { 325 /* Copy to m_image */332 /* Copy to m_image: */ 326 333 uchar *pu8Dst = m_image.bits() + uY * m_image.bytesPerLine() + uX * 4; 327 334 uchar *pu8Src = imageData.raw(); … … 339 346 } 340 347 341 unlock(); 342 348 /* Unlock access to frame-buffer: */ 349 unlock(); 350 351 /* Confirm NotifyUpdateImage: */ 343 352 return S_OK; 344 353 } … … 545 554 546 555 /* If there is NO pending source-bitmap: */ 547 if (!vboxGlobal().isSeparate () && m_pendingSourceBitmap.isNull())556 if (!vboxGlobal().isSeparateProcess() && m_pendingSourceBitmap.isNull()) 548 557 { 549 558 /* Do nothing, change-event already processed: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r52574 r52902 125 125 * @note Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */ 126 126 STDMETHOD(NotifyUpdate)(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight); 127 /** EMT callback which is not used in current implementation. */ 127 128 /** EMT callback: Notifies frame-buffer about guest-screen update. 129 * @param uX Horizontal origin of the update rectangle, in pixels. 130 * @param uY Vertical origin of the update rectangle, in pixels. 131 * @param uWidth Width of the update rectangle, in pixels. 132 * @param uHeight Height of the update rectangle, in pixels. 133 * @param image Brings image container which can be used to copy data from. 134 * @note Any EMT callback is subsequent. No any other EMT callback can be called until this one processed. 135 * @note Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */ 128 136 STDMETHOD(NotifyUpdateImage)(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight, ComSafeArrayIn(BYTE, image)); 129 137 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r52894 r52902 826 826 VBoxGlobal::tr("Disabled", "details report (Unrestricted Execution)"); 827 827 828 /* Get machine: */ 828 829 const CMachine machine = console.GetMachine(); 829 830 if (machine.isNull()) … … 1070 1071 /* Acquire current states from the console: */ 1071 1072 CConsole console = m_session.GetConsole(); 1072 if ( console.isNull())1073 if (!m_session.isOk() || console.isNull()) 1073 1074 return; 1074 1075 const QVector<KDeviceActivity> states = console.GetDeviceActivity(deviceTypes); 1075 if (!console.isOk()) 1076 return; 1076 AssertReturnVoid(console.isOk()); 1077 1077 1078 1078 /* Update indicators with the acquired states: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r52894 r52902 93 93 bool UIMachine::create(UIMachine **ppSelf) 94 94 { 95 UIMachine *p VirtualMachine = new UIMachine(ppSelf);96 if (!p VirtualMachine)95 UIMachine *pMachine = new UIMachine(ppSelf); 96 if (!pMachine) 97 97 return false; 98 return p VirtualMachine->prepare();98 return pMachine->prepare(); 99 99 } 100 100 … … 103 103 , m_ppThis(ppSelf) 104 104 , initialStateType(UIVisualStateType_Normal) 105 , m_session()106 105 , m_pSession(0) 107 106 , m_pVisualState(0) … … 116 115 { 117 116 KLockType lockType; 118 if (vboxGlobal().isSeparate()) 119 { 120 /* Search for the corresponding machine: */ 117 if (!vboxGlobal().isSeparateProcess()) 118 { 119 lockType = KLockType_VM; 120 } 121 else 122 { 123 /* Try to find corresponding machine: */ 121 124 CVirtualBox virtualBox = vboxGlobal().virtualBox(); 122 125 CMachine machine = virtualBox.FindMachine(vboxGlobal().managedVMUuid()); … … 127 130 } 128 131 132 /* Try to launch corresponding machine: */ 129 133 if (!vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Separate)) 130 134 return false; 131 135 132 136 lockType = KLockType_Shared; 133 }134 else135 {136 lockType = KLockType_VM;137 137 } 138 138 … … 165 165 /* Now power up the machine. 166 166 * Actually powerUp does more that just a power up, 167 * so call it regardless of isSeparate setting. 168 */ 167 * so call it regardless of isSeparateProcess setting. */ 169 168 uisession()->powerUp(); 170 169 171 170 /* Initialization of MachineLogic internals after the powerUp. 172 * This is a hack, maybe more generic approach can be used. 173 */ 171 * This is a hack, maybe more generic approach can be used. */ 174 172 machineLogic()->initializePostPowerUp(); 175 173 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r52894 r52902 677 677 shot.fill(0); 678 678 CDisplay dsp = session().GetConsole().GetDisplay(); 679 if (vboxGlobal().isSeparate ())679 if (vboxGlobal().isSeparateProcess()) 680 680 { 681 681 QVector<BYTE> screenData = dsp.TakeScreenShotToArray(screenId(), shot.width(), shot.height(), KBitmapFormat_BGR0); … … 1089 1089 /* Can't do COM inter-process calls from a SendMessage handler, 1090 1090 * see http://support.microsoft.com/kb/131056 */ 1091 if (vboxGlobal().isSeparate () && InSendMessage())1091 if (vboxGlobal().isSeparateProcess() && InSendMessage()) 1092 1092 { 1093 1093 PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r52894 r52902 272 272 273 273 /* If VM process is running separately, then leave it alone and close UI: */ 274 if (vboxGlobal().isSeparate ())274 if (vboxGlobal().isSeparateProcess()) 275 275 { 276 276 uisession()->closeRuntimeUI(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r52894 r52902 261 261 } 262 262 263 if (!vboxGlobal().isSeparate ())263 if (!vboxGlobal().isSeparateProcess()) 264 264 { 265 265 /* Power UP machine: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r52894 r52902 476 476 /* Launch/show current VM: */ 477 477 CMachine machine = pItem->machine(); 478 vboxGlobal().launchMachine(machine, qApp->keyboardModifiers() == Qt::ShiftModifier ?479 VBoxGlobal::LaunchMode_Headless:480 478 vboxGlobal().launchMachine(machine, qApp->keyboardModifiers() == Qt::ShiftModifier ? 479 VBoxGlobal::LaunchMode_Headless : 480 VBoxGlobal::LaunchMode_Default); 481 481 } 482 482 }
Note:
See TracChangeset
for help on using the changeset viewer.