- Timestamp:
- Sep 7, 2020 3:27:58 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r84990 r86046 683 683 /* Update action states: */ 684 684 LogRel3(("GUI: UIMachineLogic::sltAdditionsStateChanged: Adjusting actions availability according to GA state.\n")); 685 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->setEnabled(uisession()->isGuestSupportsGraphics());686 685 actionPool()->action(UIActionIndexRT_M_View_T_Seamless)->setEnabled(uisession()->isVisualStateAllowed(UIVisualStateType_Seamless) && 687 686 uisession()->isGuestSupportsSeamless()); … … 1979 1978 1980 1979 /* Normalize window geometry: */ 1981 pMachineWindow->normalizeGeometry(true /* adjust position */ );1980 pMachineWindow->normalizeGeometry(true /* adjust position */, true /* resize window to guest display size */); 1982 1981 } 1983 1982 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r84792 r86046 375 375 if (visualStateType() == UIVisualStateType_Normal && 376 376 frameBufferSizeNew != frameBufferSizeOld) 377 machineWindow()->normalizeGeometry(true /* adjust position */ );377 machineWindow()->normalizeGeometry(true /* adjust position */, machineWindow()->shouldResizeToGuestDisplay()); 378 378 } 379 379 … … 1074 1074 /* Normalize 'normal' machine-window geometry: */ 1075 1075 if (visualStateType() == UIVisualStateType_Normal) 1076 machineWindow()->normalizeGeometry(true /* adjust position */ );1076 machineWindow()->normalizeGeometry(true /* adjust position */, machineWindow()->shouldResizeToGuestDisplay()); 1077 1077 } 1078 1078 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r84790 r86046 24 24 25 25 /* GUI includes: */ 26 #include "UIActionPoolRuntime.h" 26 27 #include "UICommon.h" 27 28 #include "UIConverter.h" … … 232 233 /* Send machine-view size-hint to the guest: */ 233 234 machineView()->resendSizeHint(); 235 } 236 237 bool UIMachineWindow::shouldResizeToGuestDisplay() const 238 { 239 return actionPool() && 240 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize) && 241 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked(); 234 242 } 235 243 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r82968 r86046 93 93 /** Adjusts machine-window size to correspond current machine-view size. 94 94 * @param fAdjustPosition determines whether is it necessary to adjust position too. 95 * @param fResizeToGuestDisplay determines if is it necessary to resize the window to fit to guest display size. 95 96 * @note Reimplemented in sub-classes. Base implementation does nothing. */ 96 virtual void normalizeGeometry(bool fAdjustPosition ) { Q_UNUSED(fAdjustPosition);}97 virtual void normalizeGeometry(bool fAdjustPosition, bool fResizeToGuestDisplay) { Q_UNUSED(fAdjustPosition); Q_UNUSED(fResizeToGuestDisplay);} 97 98 98 99 /** Adjusts machine-view size to correspond current machine-window size. */ … … 101 102 /** Sends machine-view size-hint to the guest. */ 102 103 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; 103 107 104 108 #ifdef VBOX_WITH_MASKED_SEAMLESS … … 111 115 #ifdef VBOX_WS_X11 112 116 /** X11: Performs machine-window geometry normalization. */ 113 void sltNormalizeGeometry() { normalizeGeometry(true /* adjust position */ ); }117 void sltNormalizeGeometry() { normalizeGeometry(true /* adjust position */, shouldResizeToGuestDisplay()); } 114 118 #endif /* VBOX_WS_X11 */ 115 119 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r84702 r86046 155 155 156 156 /* Normalize geometry without moving: */ 157 normalizeGeometry(false /* adjust position */); 157 normalizeGeometry(false /* adjust position */, shouldResizeToGuestDisplay()); 158 158 159 } 159 160 … … 189 190 190 191 /* Normalize geometry without moving: */ 191 normalizeGeometry(false /* adjust position */ );192 normalizeGeometry(false /* adjust position */, shouldResizeToGuestDisplay()); 192 193 } 193 194 … … 386 387 else 387 388 { 388 /* Restore only window position: */ 389 m_normalGeometry = QRect(geo.x(), geo.y(), width(), height()); 389 m_normalGeometry = geo; 390 390 UICommon::setTopLevelGeometry(this, m_normalGeometry); 391 391 /* And normalize to the optimal-size: */ 392 normalizeGeometry(false /* adjust position */ );392 normalizeGeometry(false /* adjust position */, shouldResizeToGuestDisplay()); 393 393 } 394 394 … … 406 406 407 407 /* Normalize to the optimal size: */ 408 normalizeGeometry(true /* adjust position */ );408 normalizeGeometry(true /* adjust position */, shouldResizeToGuestDisplay()); 409 409 /* Move newly created window to the screen-center: */ 410 410 m_normalGeometry = geometry(); … … 417 417 QTimer::singleShot(0, this, SLOT(sltNormalizeGeometry())); 418 418 #else /* !VBOX_WS_X11 */ 419 normalizeGeometry(true /* adjust position */ );419 normalizeGeometry(true /* adjust position */, shouldResizeToGuestDisplay()); 420 420 #endif /* !VBOX_WS_X11 */ 421 421 } … … 427 427 /* Save window geometry: */ 428 428 { 429 printf("UIMachineWindowNormal::saveSettings %d %d %d %d\n", m_normalGeometry.x(), m_normalGeometry.y(), 430 m_normalGeometry.width(), m_normalGeometry.height()); 429 431 gEDataManager->setMachineWindowGeometry(machineLogic()->visualStateType(), 430 432 m_uScreenId, m_normalGeometry, … … 535 537 536 538 /* Normalize machine-window geometry: */ 537 normalizeGeometry(true /* adjust position */ );539 normalizeGeometry(true /* adjust position */, shouldResizeToGuestDisplay()); 538 540 539 541 /* Make sure machine-view have focus: */ … … 551 553 } 552 554 553 void UIMachineWindowNormal::normalizeGeometry(bool fAdjustPosition )555 void UIMachineWindowNormal::normalizeGeometry(bool fAdjustPosition, bool fResizeToGuestDisplay) 554 556 { 555 557 #ifndef VBOX_GUI_WITH_CUSTOMIZATIONS1 … … 566 568 const int db = frGeo.bottom() - geo.bottom(); 567 569 568 /* Get the best size w/o scroll-bars: */ 569 QSize sh = sizeHint(); 570 571 /* If guest-screen auto-resize is not enabled 572 * or the guest-additions doesn't support graphics 573 * we should take scroll-bars size-hints into account: */ 574 if (!machineView()->isGuestAutoresizeEnabled() || !uisession()->isGuestSupportsGraphics()) 575 { 576 if (machineView()->verticalScrollBar()->isVisible()) 577 sh -= QSize(machineView()->verticalScrollBar()->sizeHint().width(), 0); 578 if (machineView()->horizontalScrollBar()->isVisible()) 579 sh -= QSize(0, machineView()->horizontalScrollBar()->sizeHint().height()); 580 } 581 582 /* Resize the frame to fit the contents: */ 583 sh -= size(); 584 frGeo.setRight(frGeo.right() + sh.width()); 585 frGeo.setBottom(frGeo.bottom() + sh.height()); 570 if (fResizeToGuestDisplay) 571 { 572 /* Get the best size w/o scroll-bars: */ 573 QSize sh = sizeHint(); 574 575 /* If guest-screen auto-resize is not enabled 576 * or the guest-additions doesn't support graphics 577 * we should take scroll-bars size-hints into account: */ 578 if (!machineView()->isGuestAutoresizeEnabled() || !uisession()->isGuestSupportsGraphics()) 579 { 580 if (machineView()->verticalScrollBar()->isVisible()) 581 sh -= QSize(machineView()->verticalScrollBar()->sizeHint().width(), 0); 582 if (machineView()->horizontalScrollBar()->isVisible()) 583 sh -= QSize(0, machineView()->horizontalScrollBar()->sizeHint().height()); 584 } 585 586 /* Resize the frame to fit the contents: */ 587 sh -= size(); 588 frGeo.setRight(frGeo.right() + sh.width()); 589 frGeo.setBottom(frGeo.bottom() + sh.height()); 590 } 586 591 587 592 /* Adjust position if necessary: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r82968 r86046 118 118 /** Performs window geometry normalization according to guest-size and host's available geometry. 119 119 * @param fAdjustPosition Determines whether is it necessary to adjust position as well. */ 120 virtual void normalizeGeometry(bool fAdjustPosition ) /* override */;120 virtual void normalizeGeometry(bool fAdjustPosition, bool fResizeToGuestDisplay) /* override */; 121 121 122 122 /** Common update routine. */
Note:
See TracChangeset
for help on using the changeset viewer.