summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp9
-rw-r--r--src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h3
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp15
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h3
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp14
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp13
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp3
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h4
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp26
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/UISession.h3
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp6
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp10
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp10
-rw-r--r--src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp6
14 files changed, 94 insertions, 31 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
index da4500d1a60..416b03ed141 100644
--- a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
@@ -679,6 +679,15 @@ void UINotificationMessage::cannotAcquireMachineDebuggerParameter(const CMachine
}
/* static */
+void UINotificationMessage::cannotAcquireGraphicsAdapterParameter(const CGraphicsAdapter &comAdapter)
+{
+ createMessage(
+ QApplication::translate("UIMessageCenter", "Graphics adapter failure ..."),
+ QApplication::translate("UIMessageCenter", "Failed to acquire graphics adapter parameter.") +
+ UIErrorString::formatErrorInfo(comAdapter));
+}
+
+/* static */
void UINotificationMessage::cannotAcquireConsoleParameter(const CConsole &comConsole)
{
createMessage(
diff --git a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
index 53d2eeb8f44..a77b3a98821 100644
--- a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
+++ b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
@@ -298,6 +298,9 @@ public:
/** Notifies about inability to acquire IMachineDebugger parameter.
* @param comMachineDebugger Brings the object parameter get acquired from. */
static void cannotAcquireMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger);
+ /** Notifies about inability to acquire IGraphicsAdapter parameter.
+ * @param comAdapter Brings the object parameter get acquired from. */
+ static void cannotAcquireGraphicsAdapterParameter(const CGraphicsAdapter &comAdapter);
/** Notifies about inability to acquire IConsole parameter.
* @param comConsole Brings the object parameter get acquired from. */
static void cannotAcquireConsoleParameter(const CConsole &comConsole);
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
index c4398dee9e0..fbfd0d81fa8 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
@@ -433,6 +433,11 @@ void UIMachine::setLastFullScreenSize(ulong uScreenId, QSize size)
m_monitorLastFullScreenSizeVector[(int)uScreenId] = size;
}
+bool UIMachine::acquireMonitorCount(ulong &uCount)
+{
+ return uisession()->acquireMonitorCount(uCount);
+}
+
bool UIMachine::acquireGuestScreenParameters(ulong uScreenId,
ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
long &xOrigin, long &yOrigin, KGuestMonitorStatus &enmMonitorStatus)
@@ -1322,13 +1327,17 @@ void UIMachine::prepareScreens()
# endif /* !VBOX_WS_X11 || VBOX_GUI_WITH_CUSTOMIZATIONS1 */
#endif /* !VBOX_WS_MAC */
+ /* Accquire monitor count: */
+ ulong cMonitorCount = 0;
+ acquireMonitorCount(cMonitorCount);
+
/* Prepare initial screen visibility status: */
- m_monitorVisibilityVector.resize(uisession()->machine().GetGraphicsAdapter().GetMonitorCount());
+ m_monitorVisibilityVector.resize(cMonitorCount);
m_monitorVisibilityVector.fill(false);
m_monitorVisibilityVector[0] = true;
/* Prepare empty last full-screen size vector: */
- m_monitorLastFullScreenSizeVector.resize(uisession()->machine().GetGraphicsAdapter().GetMonitorCount());
+ m_monitorLastFullScreenSizeVector.resize(cMonitorCount);
m_monitorLastFullScreenSizeVector.fill(QSize(-1, -1));
/* If machine is in 'saved' state: */
@@ -1366,7 +1375,7 @@ void UIMachine::prepareScreens()
}
/* Prepare initial screen visibility status of host-desires (same as facts): */
- m_monitorVisibilityVectorHostDesires.resize(uisession()->machine().GetGraphicsAdapter().GetMonitorCount());
+ m_monitorVisibilityVectorHostDesires.resize(cMonitorCount);
for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
m_monitorVisibilityVectorHostDesires[iScreenIndex] = m_monitorVisibilityVector[iScreenIndex];
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
index 1c8105b90e5..7ebeb78bc65 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
@@ -278,6 +278,9 @@ public:
/** Defines whether guest screen resize should be @a fIgnored. */
void setGuestResizeIgnored(bool fIgnored) { m_fIsGuestResizeIgnored = fIgnored; }
+ /** Acquires monitor count. */
+ bool acquireMonitorCount(ulong &uCount);
+
/** Acquires parameters for guest-screen with passed uScreenId. */
bool acquireGuestScreenParameters(ulong uScreenId,
ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
index aaf7579a439..14f6a0e04a3 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
@@ -2532,9 +2532,11 @@ void UIMachineLogic::sltChangeDockIconUpdate(bool fEnabled)
setDockIconPreviewEnabled(fEnabled);
if (m_pDockPreviewSelectMonitorGroup)
{
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
m_pDockPreviewSelectMonitorGroup->setEnabled(fEnabled);
m_DockIconPreviewMonitor = qMin(gEDataManager->realtimeDockIconUpdateMonitor(uiCommon().managedVMUuid()),
- (int)machine().GetGraphicsAdapter().GetMonitorCount() - 1);
+ (int)cMonitorCount - 1);
}
/* Resize the dock icon in the case the preview monitor has changed. */
QSize size = machineWindows().at(m_DockIconPreviewMonitor)->machineView()->size();
@@ -3060,13 +3062,14 @@ int UIMachineLogic::searchMaxSnapshotIndex(const CMachine &machine,
void UIMachineLogic::takeScreenshot(const QString &strFile, const QString &strFormat /* = "png" */) const
{
/* Get console: */
- const ulong cGuestScreens = machine().GetGraphicsAdapter().GetMonitorCount();
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
QList<QImage> images;
ulong uMaxWidth = 0;
ulong uMaxHeight = 0;
/* First create screenshots of all guest screens and save them in a list.
* Also sum the width of all images and search for the biggest image height. */
- for (ulong uScreenIndex = 0; uScreenIndex < cGuestScreens; ++uScreenIndex)
+ for (ulong uScreenIndex = 0; uScreenIndex < cMonitorCount; ++uScreenIndex)
{
ulong uWidth = 0, uHeight = 0, uDummy = 0;
long iDummy = 0;
@@ -3203,8 +3206,9 @@ void UIMachineLogic::reset(bool fShowConfirmation)
// WORKAROUND:
// On reset the additional screens didn't get a display
// update. Emulate this for now until it get fixed. */
- const ulong uMonitorCount = machine().GetGraphicsAdapter().GetMonitorCount();
- for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
+ for (ulong uScreenId = 1; uScreenId < cMonitorCount; ++uScreenId)
machineWindows().at(uScreenId)->update();
}
}
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
index be9d5a2d67e..6852d02d313 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
@@ -286,14 +286,11 @@ void UIMachineWindow::updateAppearanceOf(int iElement)
strMachineName += " - " + (strUserProductName.isEmpty() ? defaultWindowTitle() : strUserProductName);
#endif /* !VBOX_WS_MAC */
- /* Check if we can get graphics adapter: */
- CGraphicsAdapter comAdapter = machine().GetGraphicsAdapter();
- if (machine().isOk() && comAdapter.isNotNull())
- {
- /* Append screen number only if there are more than one present: */
- if (comAdapter.GetMonitorCount() > 1)
- strMachineName += QString(" : %1").arg(m_uScreenId + 1);
- }
+ /* Append screen number only if there are more than one present: */
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
+ if (cMonitorCount > 1)
+ strMachineName += QString(" : %1").arg(m_uScreenId + 1);
/* Assign title finally: */
setWindowTitle(strMachineName);
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
index bebd2ebd0d9..114776bd649 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
@@ -43,7 +43,7 @@
UIMultiScreenLayout::UIMultiScreenLayout(UIMachineLogic *pMachineLogic)
: m_pMachineLogic(pMachineLogic)
- , m_cGuestScreens(m_pMachineLogic->machine().GetGraphicsAdapter().GetMonitorCount())
+ , m_cGuestScreens(0)
, m_cHostMonitors(0)
{
prepare();
@@ -296,6 +296,7 @@ void UIMultiScreenLayout::calculateGuestScreenCount()
{
m_guestScreens.clear();
m_disabledGuestScreens.clear();
+ uimachine()->acquireMonitorCount(m_cGuestScreens);
for (uint iGuestScreen = 0; iGuestScreen < m_cGuestScreens; ++iGuestScreen)
if (uimachine()->isScreenVisible(iGuestScreen))
m_guestScreens << iGuestScreen;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
index 535d7ba07c1..ae4106272b6 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
@@ -107,9 +107,9 @@ private:
UIMachineLogic *m_pMachineLogic;
/** Holds the number of guest-screens. */
- const uint m_cGuestScreens;
+ ulong m_cGuestScreens;
/** Holds the number of host-monitors. */
- int m_cHostMonitors;
+ int m_cHostMonitors;
/** Holds currently cached enabled guest-screens. */
QList<int> m_guestScreens;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
index 6b58ce8acb0..b68f260a2cd 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
@@ -624,6 +624,25 @@ QSize UISession::frameBufferSize(ulong uScreenId) const
return pFramebuffer ? QSize(pFramebuffer->width(), pFramebuffer->height()) : QSize();
}
+bool UISession::acquireMonitorCount(ulong &uCount)
+{
+ CMachine comMachine = machine();
+ CGraphicsAdapter comAdapter = comMachine.GetGraphicsAdapter();
+ bool fSuccess = comMachine.isOk();
+ if (!fSuccess)
+ UINotificationMessage::cannotAcquireMachineParameter(comMachine);
+ else
+ {
+ const ULONG uMonitorCount = comAdapter.GetMonitorCount();
+ fSuccess = comAdapter.isOk();
+ if (!fSuccess)
+ UINotificationMessage::cannotAcquireGraphicsAdapterParameter(comAdapter);
+ else
+ uCount = uMonitorCount;
+ }
+ return fSuccess;
+}
+
bool UISession::acquireGuestScreenParameters(ulong uScreenId,
ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
long &xOrigin, long &yOrigin, KGuestMonitorStatus &enmMonitorStatus)
@@ -1344,8 +1363,11 @@ void UISession::prepareConsoleEventHandlers()
void UISession::prepareFramebuffers()
{
- /* Each framebuffer will be really prepared on first UIMachineView creation: */
- m_frameBufferVector.resize(machine().GetGraphicsAdapter().GetMonitorCount());
+ /* Each framebuffer will be really prepared on first UIMachineView creation;
+ * For now we should just create an empty frame-buffer vector to fill later. */
+ ulong cMonitorCount = 0;
+ acquireMonitorCount(cMonitorCount);
+ m_frameBufferVector.resize(cMonitorCount);
}
void UISession::prepareConnections()
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
index 135e48007c7..d1b4e91a0c9 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
@@ -325,6 +325,9 @@ public:
/** Returns frame-buffer size for screen with index @a uScreenId. */
QSize frameBufferSize(ulong uScreenId) const;
+ /** Acquires monitor count. */
+ bool acquireMonitorCount(ulong &uCount);
+
/** Acquires parameters for guest-screen with passed uScreenId. */
bool acquireGuestScreenParameters(ulong uScreenId,
ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
index 68b4cde4128..1fcdc156b7e 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
@@ -537,8 +537,12 @@ void UIMachineLogicFullscreen::prepareMachineWindows()
/* Update the multi-screen layout: */
m_pScreenLayout->update();
+ /* Acquire monitor count: */
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
+
/* Create machine-window(s): */
- for (uint cScreenId = 0; cScreenId < machine().GetGraphicsAdapter().GetMonitorCount(); ++cScreenId)
+ for (uint cScreenId = 0; cScreenId < cMonitorCount; ++cScreenId)
addMachineWindow(UIMachineWindow::create(this, cScreenId));
/* Listen for frame-buffer resize: */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
index 14511c204cd..10984fe90e2 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
@@ -280,13 +280,15 @@ void UIMachineLogicNormal::prepareMachineWindows()
::darwinSetFrontMostProcess();
#endif /* VBOX_WS_MAC */
- /* Get monitors count: */
- ulong uMonitorCount = machine().GetGraphicsAdapter().GetMonitorCount();
+ /* Acquire monitor count: */
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
+
/* Create machine window(s): */
- for (ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)
+ for (ulong uScreenId = 0; uScreenId < cMonitorCount; ++ uScreenId)
addMachineWindow(UIMachineWindow::create(this, uScreenId));
/* Order machine window(s): */
- for (ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)
+ for (ulong uScreenId = cMonitorCount; uScreenId > 0; -- uScreenId)
machineWindows()[uScreenId - 1]->raise();
/* Listen for frame-buffer resize: */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
index e06fe76be1b..325a7d22612 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
@@ -149,13 +149,15 @@ void UIMachineLogicScale::prepareMachineWindows()
::darwinSetFrontMostProcess();
#endif /* VBOX_WS_MAC */
- /* Get monitors count: */
- ulong uMonitorCount = machine().GetGraphicsAdapter().GetMonitorCount();
+ /* Acquire monitor count: */
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
+
/* Create machine window(s): */
- for (ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)
+ for (ulong uScreenId = 0; uScreenId < cMonitorCount; ++ uScreenId)
addMachineWindow(UIMachineWindow::create(this, uScreenId));
/* Order machine window(s): */
- for (ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)
+ for (ulong uScreenId = cMonitorCount; uScreenId > 0; -- uScreenId)
machineWindows()[uScreenId - 1]->raise();
/* Listen for frame-buffer resize: */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
index 3437f84ff96..6276e59f7e5 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
@@ -266,8 +266,12 @@ void UIMachineLogicSeamless::prepareMachineWindows()
/* Update the multi-screen layout: */
m_pScreenLayout->update();
+ /* Acquire monitor count: */
+ ulong cMonitorCount = 0;
+ uimachine()->acquireMonitorCount(cMonitorCount);
+
/* Create machine-window(s): */
- for (uint cScreenId = 0; cScreenId < machine().GetGraphicsAdapter().GetMonitorCount(); ++cScreenId)
+ for (uint cScreenId = 0; cScreenId < cMonitorCount; ++cScreenId)
addMachineWindow(UIMachineWindow::create(this, cScreenId));
/* Listen for frame-buffer resize: */