Changeset 86051 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 7, 2020 4:17:11 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r86046 r86051 223 223 } 224 224 225 bool UIMachineWindow::shouldResizeToGuestDisplay() const 226 { 227 return actionPool() 228 && actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize) 229 && actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked(); 230 } 231 225 232 void UIMachineWindow::adjustMachineViewSize() 226 233 { … … 233 240 /* Send machine-view size-hint to the guest: */ 234 241 machineView()->resendSizeHint(); 235 }236 237 bool UIMachineWindow::shouldResizeToGuestDisplay() const238 {239 return actionPool() &&240 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize) &&241 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked();242 242 } 243 243 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r86046 r86051 87 87 const QString& machineName() const; 88 88 89 /** Returns whether the machine-window should resize to fit to the guest display. 90 * @note Relevant only to normal (windowed) case. */ 91 bool shouldResizeToGuestDisplay() const; 92 89 93 /** Restores cached window geometry. 90 94 * @note Reimplemented in sub-classes. Base implementation does nothing. */ … … 95 99 * @param fResizeToGuestDisplay determines if is it necessary to resize the window to fit to guest display size. 96 100 * @note Reimplemented in sub-classes. Base implementation does nothing. */ 97 virtual void normalizeGeometry(bool fAdjustPosition, bool fResizeToGuestDisplay) { Q_UNUSED(fAdjustPosition); Q_UNUSED(fResizeToGuestDisplay); }101 virtual void normalizeGeometry(bool fAdjustPosition, bool fResizeToGuestDisplay) { Q_UNUSED(fAdjustPosition); Q_UNUSED(fResizeToGuestDisplay); } 98 102 99 103 /** Adjusts machine-view size to correspond current machine-window size. */ … … 102 106 /** Sends machine-view size-hint to the guest. */ 103 107 virtual void sendMachineViewSizeHint(); 104 105 /** Returns true if the machine window should resize to fit to the guest display. Relevant only in normal (windowed) case. */106 bool shouldResizeToGuestDisplay() const;107 108 108 109 #ifdef VBOX_WITH_MASKED_SEAMLESS -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r86050 r86051 156 156 /* Normalize geometry without moving: */ 157 157 normalizeGeometry(false /* adjust position */, shouldResizeToGuestDisplay()); 158 159 158 } 160 159 … … 377 376 if (!geo.isNull()) 378 377 { 379 /* If previous machine-state was SAVED: */ 380 if (machine().GetState() == KMachineState_Saved) 381 { 382 /* Restore window geometry: */ 383 m_normalGeometry = geo; 384 UICommon::setTopLevelGeometry(this, m_normalGeometry); 385 } 386 /* If previous machine-state was NOT SAVED: */ 387 else 388 { 389 m_normalGeometry = geo; 390 UICommon::setTopLevelGeometry(this, m_normalGeometry); 391 /* And normalize to the optimal-size: */ 378 /* Restore window geometry: */ 379 m_normalGeometry = geo; 380 UICommon::setTopLevelGeometry(this, m_normalGeometry); 381 382 /* If previous machine-state was NOT SAVED => normalize window to the optimal-size: */ 383 if (machine().GetState() != KMachineState_Saved) 392 384 normalizeGeometry(false /* adjust position */, shouldResizeToGuestDisplay()); 393 } 394 395 /* Maximize (if necessary): */ 385 386 /* Maximize window (if necessary): */ 396 387 if (gEDataManager->machineWindowShouldBeMaximized(machineLogic()->visualStateType(), 397 388 m_uScreenId, uiCommon().managedVMUuid())) … … 401 392 else 402 393 { 403 /* Get available geometry, for screen with (x,y) coords if possible: */ 404 QRect availableGeo = !geo.isNull() ? gpDesktop->availableGeometry(QPoint(geo.x(), geo.y())) : 405 gpDesktop->availableGeometry(this); 406 407 /* Normalize to the optimal size: */ 394 /* Normalize window to the optimal size: */ 408 395 normalizeGeometry(true /* adjust position */, shouldResizeToGuestDisplay()); 409 /* Move newly created window to the screen-center: */ 396 397 /* Move it to the screen-center: */ 410 398 m_normalGeometry = geometry(); 411 m_normalGeometry.moveCenter( availableGeo.center());399 m_normalGeometry.moveCenter(gpDesktop->availableGeometry(this).center()); 412 400 UICommon::setTopLevelGeometry(this, m_normalGeometry); 413 401 }
Note:
See TracChangeset
for help on using the changeset viewer.