Skip to content

Commit 793b64c

Browse files
committed
FE/Qt: github:gh-197 and github:gh-243: Runtime UI / Windows host: A try to fix full-screen support for multi-monitor case.
svn:sync-xref-src-repo-rev: r171043
1 parent 2baaecf commit 793b64c

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIMachineWindowFullscreen.cpp 110684 2025-08-11 17:18:47Z klaus.espenlaub@oracle.com $ */
1+
/* $Id: UIMachineWindowFullscreen.cpp 111483 2025-10-23 14:08:21Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIMachineWindowFullscreen class implementation.
44
*/
@@ -379,8 +379,9 @@ void UIMachineWindowFullscreen::placeOnScreen()
379379

380380
/* Map window onto required screen: */
381381
windowHandle()->setScreen(qApp->screens().at(iHostScreen));
382-
/* Set appropriate window size: */
382+
/* Set appropriate window position&size: */
383383
resize(workingArea.size());
384+
move(workingArea.topLeft());
384385

385386
#elif defined(VBOX_WS_NIX)
386387

@@ -458,11 +459,17 @@ void UIMachineWindowFullscreen::showInNecessaryMode()
458459
if (fWasMinimized)
459460
setWindowState(Qt::WindowNoState);
460461

462+
/* Exit full-screen if necessary: */
463+
if (isFullScreen())
464+
showNormal();
465+
461466
/* Make sure window have appropriate geometry: */
462467
placeOnScreen();
463468

464-
/* Show window: */
465-
showFullScreen();
469+
/* First of all show window in normal mode
470+
* then request full-screen mode async way: */
471+
showNormal();
472+
QTimer::singleShot(0, this, SLOT(showFullScreen()));
466473

467474
/* Restore minimized state if necessary: */
468475
if (m_fWasMinimized || fWasMinimized)

src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIMiniToolBar.cpp 110684 2025-08-11 17:18:47Z klaus.espenlaub@oracle.com $ */
1+
/* $Id: UIMiniToolBar.cpp 111483 2025-10-23 14:08:21Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIMiniToolBar class implementation.
44
*/
@@ -862,8 +862,10 @@ void UIMiniToolBar::sltShow()
862862
}
863863
case GeometryType_Full:
864864
{
865-
/* Show full-screen: */
866-
showFullScreen();
865+
/* First of all show window in normal mode
866+
* then request full-screen mode async way: */
867+
showNormal();
868+
QTimer::singleShot(0, this, SLOT(showFullScreen()));
867869
break;
868870
}
869871
}
@@ -963,17 +965,19 @@ void UIMiniToolBar::sltAdjust()
963965
}
964966
case GeometryType_Full:
965967
{
966-
/* Map window onto required screen: */
967-
LogRel(("GUI: Map mini-toolbar for window #%d to screen %d of %d\n",
968-
m_iWindowIndex, iHostScreen, qApp->screens().size()));
969-
windowHandle()->setScreen(qApp->screens().at(iHostScreen));
970-
971968
/* Set appropriate window size: */
972969
const QSize newSize = workingArea.size();
973970
LogRel(("GUI: Resize mini-toolbar for window #%d to %dx%d\n",
974971
m_iWindowIndex, newSize.width(), newSize.height()));
975972
resize(newSize);
976973

974+
/* Map/move window onto required screen: */
975+
const QPoint newPosition = workingArea.topLeft();
976+
LogRel(("GUI: Map&move mini-toolbar for window #%d to screen %d of %d\n",
977+
m_iWindowIndex, iHostScreen, qApp->screens().size()));
978+
windowHandle()->setScreen(qApp->screens().at(iHostScreen));
979+
move(newPosition);
980+
977981
break;
978982
}
979983
}

0 commit comments

Comments
 (0)