Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0744792

Browse files
FE/Qt: bugref:10997: Runtime UI / Machine-view: Do not restore guest-screen size-hint if it wasn't stored before; Previously we were sending 800x600 hint in such cases, we'd like to disable that behavior now.
svn:sync-xref-src-repo-rev: r171375
1 parent 3c656bb commit 0744792

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

‎src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIMachineView.cpp 111057 2025-09-19 11:27:45Z sergey.dubov@oracle.com $ */
1+
/* $Id: UIMachineView.cpp 111751 2025-11-17 10:23:35Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIMachineView class implementation.
44
*/
@@ -1524,14 +1524,25 @@ QSize UIMachineView::sizeHint() const
15241524
return QSize(size.width() + frameWidth() * 2, size.height() + frameWidth() * 2);
15251525
}
15261526

1527-
QSize UIMachineView::storedGuestScreenSizeHint() const
1527+
QSize UIMachineView::storedGuestScreenSizeHint(boolfFailsafe/* = true */) const
15281528
{
15291529
/* Load guest-screen size-hint: */
15301530
QSize sizeHint = gEDataManager->lastGuestScreenSizeHint(m_uScreenId, uiCommon().managedVMUuid());
15311531

1532-
/* Invent the default if necessary: */
1532+
/* If there is no hint currently set: */
15331533
if (!sizeHint.isValid())
1534+
{
1535+
/* Exit prematurelly if fallback hint wasn't requested: */
1536+
if (!fFailsafe)
1537+
{
1538+
LogRel2(("GUI: UIMachineView::storedGuestScreenSizeHint: No guest-screen size-hint present for screen %d\n",
1539+
(int)screenId()));
1540+
return QSize();
1541+
}
1542+
1543+
/* Invent new default hint: */
15341544
sizeHint = QSize(800, 600);
1545+
}
15351546

15361547
/* Take the scale-factor(s) into account: */
15371548
sizeHint = scaledForward(sizeHint);

‎src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIMachineView.h 110684 2025-08-11 17:18:47Z klaus.espenlaub@oracle.com $ */
1+
/* $Id: UIMachineView.h 111751 2025-11-17 10:23:35Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIMachineView class declaration.
44
*/
@@ -273,8 +273,9 @@ protected slots:
273273
UIActionPool* actionPool() const;
274274
QSize sizeHint() const RT_OVERRIDE;
275275

276-
/** Retrieves the last guest-screen size-hint from extra-data. */
277-
QSize storedGuestScreenSizeHint() const;
276+
/** Retrieves stored guest-screen size-hint from extra-data.
277+
* @param fFailsafe Pass true to ensure valid hint is returned. */
278+
QSize storedGuestScreenSizeHint(bool fFailsafe = true) const;
278279
/** Stores a guest-screen @a sizeHint to extra-data. */
279280
void setStoredGuestScreenSizeHint(const QSize &sizeHint);
280281

‎src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIMachineViewNormal.cpp 110684 2025-08-11 17:18:47Z klaus.espenlaub@oracle.com $ */
1+
/* $Id: UIMachineViewNormal.cpp 111751 2025-11-17 10:23:35Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIMachineViewNormal class implementation.
44
*/
@@ -154,8 +154,12 @@ void UIMachineViewNormal::resendSizeHint()
154154
if (uimachine()->requestedVisualState() == UIVisualStateType_Seamless) // Seamless only for now.
155155
return;
156156

157-
/* Get the last guest-screen size-hint, taking the scale factor into account. */
158-
const QSize storedSizeHint = storedGuestScreenSizeHint();
157+
/* Acquire stored guest-screen size-hint: */
158+
const QSize storedSizeHint = storedGuestScreenSizeHint(false /* that means - look for stored hint only */);
159+
/* Make sure valid guest-screen size-hint stored: */
160+
if (storedSizeHint.width() <= 0 || storedSizeHint.height() <= 0)
161+
return;
162+
/* Take the scale factor into account: */
159163
const QSize effectiveSizeHint = scaledBackward(storedSizeHint);
160164
LogRel(("GUI: UIMachineViewNormal::resendSizeHint: Restoring guest size-hint for screen %d to %dx%d\n",
161165
(int)screenId(), effectiveSizeHint.width(), effectiveSizeHint.height()));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /