Changeset 88247 in vbox
- Timestamp:
- Mar 22, 2021 3:32:40 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 143447
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r88208 r88247 67 67 #include "CConsole.h" 68 68 #include "CDHCPServer.h" 69 #include "CDisplay.h" 69 70 #include "CExtPack.h" 70 71 #include "CExtPackFile.h" … … 2840 2841 } 2841 2842 2843 void UIMessageCenter::cannotAcquireDispayParameter(const CDisplay &comDisplay) 2844 { 2845 error(0, MessageType_Error, 2846 tr("Failed to acquire display parameter."), 2847 UIErrorString::formatErrorInfo(comDisplay)); 2848 } 2849 2842 2850 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 2843 2851 bool UIMessageCenter::confirmCancelingAllNetworkRequests() const -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r87545 r88247 502 502 void cannotSwitchScreenInSeamless(quint64 uMinVRAM) const; 503 503 void cannotAddDiskEncryptionPassword(const CConsole &console); 504 void cannotAcquireDispayParameter(const CDisplay &comDisplay); 504 505 505 506 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r88245 r88247 363 363 } 364 364 365 void UIMachineView::sltHandleActionTriggerViewScreenToggle(int iScreen, bool fEnabled) 366 { 367 /* Skip unrelated guest-screen index: */ 368 if (iScreen != (int)screenId()) 369 return; 370 371 /* Acquire current resolution: */ 372 ULONG uWidth, uHeight, uBitsPerPixel; 373 LONG uOriginX, uOriginY; 374 KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled; 375 display().GetScreenResolution(screenId(), uWidth, uHeight, uBitsPerPixel, uOriginX, uOriginY, monitorStatus); 376 if (!display().isOk()) 377 { 378 msgCenter().cannotAcquireDispayParameter(display()); 379 return; 380 } 381 382 /* Update desirable screen status: */ 383 uisession()->setScreenVisibleHostDesires(screenId(), fEnabled); 384 385 /* Send enabling size-hint: */ 386 if (fEnabled) 387 { 388 /* Defaults: */ 389 if (!uWidth) 390 uWidth = 800; 391 if (!uHeight) 392 uHeight = 600; 393 394 /* Update current window size limitations: */ 395 setMaxGuestSize(QSize(uWidth, uHeight)); 396 397 /* Record the hint to extra data, needed for guests using VMSVGA: 398 * This should be done before the actual hint is sent in case the guest overrides it. 399 * Do not send a hint if nothing has changed to prevent the guest being notified about its own changes. */ 400 if ( !isFullscreenOrSeamless() 401 && uisession()->isGuestSupportsGraphics() 402 && ( (int)m_pFrameBuffer->width() != uWidth 403 || (int)m_pFrameBuffer->height() != uHeight 404 || uisession()->isScreenVisible(screenId()) != uisession()->isScreenVisibleHostDesires(screenId()))) 405 storeGuestSizeHint(QSize(uWidth, uHeight)); 406 407 /* Send enabling size-hint to the guest: */ 408 LogRel(("GUI: UIMachineView::sltHandleActionTriggerViewScreenToggle: Enabling guest-screen %d\n", (int)screenId())); 409 display().SetVideoModeHint(screenId(), 410 true /* enabled? */, 411 false /* change origin? */, 412 0 /* origin x */, 413 0 /* origin y */, 414 uWidth, 415 uHeight, 416 0 /* bits per pixel */, 417 true /* notify? */); 418 } 419 else 420 { 421 /* Send disabling size-hint to the guest: */ 422 LogRel(("GUI: UIMachineView::sltHandleActionTriggerViewScreenToggle: Disabling guest-screen %d\n", (int)screenId())); 423 display().SetVideoModeHint(screenId(), 424 false /* enabled? */, 425 false /* change origin? */, 426 0 /* origin x */, 427 0 /* origin y */, 428 0 /* width */, 429 0 /* height */, 430 0 /* bits per pixel */, 431 true /* notify? */); 432 } 433 } 434 435 void UIMachineView::sltHandleActionTriggerViewScreenResize(int iScreen, const QSize &size) 436 { 437 /* Skip unrelated guest-screen index: */ 438 if (iScreen != (int)m_uScreenId) 439 return; 440 441 /* Make sure we have valid size to work with: */ 442 AssertMsgReturnVoid(size.isValid() && size.width() > 0 && size.height() > 0, 443 ("Size should be valid (%dx%d)!\n", size.width(), size.height())); 444 445 /* Update current window size limitations: */ 446 setMaxGuestSize(size); 447 448 /* Record the hint to extra data, needed for guests using VMSVGA: 449 * This should be done before the actual hint is sent in case the guest overrides it. 450 * Do not send a hint if nothing has changed to prevent the guest being notified about its own changes. */ 451 if ( !isFullscreenOrSeamless() 452 && uisession()->isGuestSupportsGraphics() 453 && ( (int)m_pFrameBuffer->width() != size.width() 454 || (int)m_pFrameBuffer->height() != size.height() 455 || uisession()->isScreenVisible(screenId()) != uisession()->isScreenVisibleHostDesires(screenId()))) 456 storeGuestSizeHint(size); 457 458 /* Send enabling size-hint to the guest: */ 459 LogRel(("GUI: UIMachineView::sltHandleActionTriggerViewScreenResize: Resizing guest-screen %d\n", (int)screenId())); 460 display().SetVideoModeHint(screenId(), 461 true /* enabled? */, 462 false /* change origin? */, 463 0 /* origin x */, 464 0 /* origin y */, 465 size.width(), 466 size.height(), 467 0 /* bits per pixel */, 468 true /* notify? */); 469 } 470 365 471 void UIMachineView::sltHandleNotifyChange(int iWidth, int iHeight) 366 472 { … … 880 986 connect(gEDataManager, &UIExtraDataManager::sigScalingOptimizationTypeChange, 881 987 this, &UIMachineView::sltHandleScalingOptimizationChange); 988 /* Action-pool connections: */ 989 UIActionPoolRuntime *pActionPoolRuntime = qobject_cast<UIActionPoolRuntime*>(actionPool()); 990 if (pActionPoolRuntime) 991 { 992 connect(pActionPoolRuntime, &UIActionPoolRuntime::sigNotifyAboutTriggeringViewScreenToggle, 993 this, &UIMachineView::sltHandleActionTriggerViewScreenToggle); 994 connect(pActionPoolRuntime, &UIActionPoolRuntime::sigNotifyAboutTriggeringViewScreenResize, 995 this, &UIMachineView::sltHandleActionTriggerViewScreenResize); 996 } 882 997 } 883 998 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r88245 r88247 116 116 * guest coordinate system (absolute one) before passing to guest. */ 117 117 void sltPerformGuestResize(const QSize &toSize = QSize()); 118 119 /** Handles guest-screen toggle request. 120 * @param iScreen Brings the number of screen being referred. 121 * @param fEnabled Brings whether this screen should be enabled. */ 122 void sltHandleActionTriggerViewScreenToggle(int iScreen, bool fEnabled); 123 /** Handles guest-screen resize request. 124 * @param iScreen Brings the number of screen being referred. 125 * @param size Brings the size of screen to be applied. */ 126 void sltHandleActionTriggerViewScreenResize(int iScreen, const QSize &size); 118 127 119 128 /* Handler: Frame-buffer NotifyChange stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r84698 r88247 216 216 } 217 217 218 void UIMachineLogicNormal::sltHandleActionTriggerViewScreenToggle(int iIndex, bool fEnabled)219 {220 /* Enable/disable guest keeping current size: */221 ULONG uWidth, uHeight, uBitsPerPixel;222 LONG uOriginX, uOriginY;223 KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;224 display().GetScreenResolution(iIndex, uWidth, uHeight, uBitsPerPixel, uOriginX, uOriginY, monitorStatus);225 if (!fEnabled)226 {227 uisession()->setScreenVisibleHostDesires(iIndex, false);228 display().SetVideoModeHint(iIndex, false, false, 0, 0, 0, 0, 0, true);229 }230 else231 {232 /* Defaults: */233 if (!uWidth)234 uWidth = 800;235 if (!uHeight)236 uHeight = 600;237 uisession()->setScreenVisibleHostDesires(iIndex, true);238 display().SetVideoModeHint(iIndex, true, false, 0, 0, uWidth, uHeight, 32, true);239 }240 }241 242 void UIMachineLogicNormal::sltHandleActionTriggerViewScreenResize(int iIndex, const QSize &size)243 {244 /* Resize guest to required size: */245 display().SetVideoModeHint(iIndex, uisession()->isScreenVisible(iIndex),246 false, 0, 0, size.width(), size.height(), 0, true);247 }248 249 218 void UIMachineLogicNormal::sltHostScreenAvailableAreaChange() 250 219 { … … 297 266 connect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility), &UIAction::triggered, 298 267 this, &UIMachineLogicNormal::sltToggleStatusBar); 299 UIActionPoolRuntime* pActionPoolRuntime = qobject_cast<UIActionPoolRuntime*>(actionPool());300 AssertPtrReturnVoid(pActionPoolRuntime);301 {302 connect(pActionPoolRuntime, &UIActionPoolRuntime::sigNotifyAboutTriggeringViewScreenToggle,303 this, &UIMachineLogicNormal::sltHandleActionTriggerViewScreenToggle);304 connect(pActionPoolRuntime, &UIActionPoolRuntime::sigNotifyAboutTriggeringViewScreenResize,305 this, &UIMachineLogicNormal::sltHandleActionTriggerViewScreenResize);306 }307 268 } 308 269 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
r82968 r88247 67 67 void sltToggleStatusBar(); 68 68 69 /** Handles guest-screen toggle requests. */70 void sltHandleActionTriggerViewScreenToggle(int iIndex, bool fEnabled);71 /** Handles guest-screen resize requests. */72 void sltHandleActionTriggerViewScreenResize(int iIndex, const QSize &size);73 74 69 /** Handles host-screen available-area change. */ 75 70 virtual void sltHostScreenAvailableAreaChange() /* override */;
Note:
See TracChangeset
for help on using the changeset viewer.