From 39a67e4ff17ebfe2f41a1a4db89a38604138fa04 Mon Sep 17 00:00:00 2001 From: Christian Cwienk Date: Sun, 30 Aug 2026 16:16:05 +0200 Subject: [PATCH] FE/Qt: Place the full-screen mini-toolbar on the machine window's monitor UIMiniToolBar::sltAdjust() resolved its host screen via UIDesktopWidgetWatchdog::screenNumber(m_pParent), which goes through m_pParent->windowHandle()->screen(). During a full-screen transition that native screen association can still lag behind the geometry already assigned to the top-level widget by UIMachineWindowFullscreen::placeOnScreen(), so the tool-bar is sized and placed against the wrong monitor. Because the mini-tool-bar's outer window is screen-sized and full-screen, the window manager then considers that unrelated monitor to hold a full-screen window, and desktop panels on it stop being painted for as long as the VM runs. Resolve the screen from the parent's geometry instead. sltAdjust() is queued from the parent's show event, i.e. after placeOnScreen() has moved the parent, so its geometry is authoritative at that point. Fixes: #842 Signed-off-by: Christian Cwienk --- src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp index 184bb731ff0b..1a8a606afe50 100644 --- a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp +++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp @@ -910,7 +910,10 @@ void UIMiniToolBar::sltAdjust() /* Get corresponding host-screen: */ const int iHostScreenCount = UIDesktopWidgetWatchdog::screenCount(); - int iHostScreen = UIDesktopWidgetWatchdog::screenNumber(m_pParent); + /* Resolve the host-screen from the parent's assigned geometry rather than from + * its native QWindow association, which can still lag behind the geometry set by + * UIMachineWindowFullscreen::placeOnScreen() during a full-screen transition: */ + int iHostScreen = UIDesktopWidgetWatchdog::screenNumber(m_pParent->geometry().center()); // WORKAROUND: // When switching host-screen count, especially in complex cases where RDP client is "replacing" host-screen(s) with own virtual-screen(s), // Qt could behave quite arbitrary and laggy, and due to racing there could be a situation when QDesktopWidget::screenNumber() returns -1