tdf#124484: avoid crash in fullscreen slideshow spanning all displays
This just stops the bleeding (crash) in a special case when screen
number argument of SalFrame::ShowFullScreen is -1 (meaning
'fullscreen spanning all available displays')
It doesn't yet extend the fullscreen window over all screens, this
will be done in a follow-up fix
Change-Id: I2cf48096a1fe1ec33c943f10acb41c59585b325f
Reviewed-on: https://gerrit.libreoffice.org/71965
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 05e1793..5ed722a 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -1069,12 +1069,26 @@ void Qt5Frame::SetScreenNumber(unsigned int nScreen)
QList<QScreen*> screens = QApplication::screens();
if (static_cast<int>(nScreen) < screens.size())
{
QWidget* const pWidget = m_pTopLevel ? m_pTopLevel : m_pQWidget;
pWindow->setScreen(QApplication::screens()[nScreen]);
bool bSpanAllScreens = (nScreen == static_cast<unsigned int>(-1));
QRect screenGeo;
if (!bSpanAllScreens)
{
screenGeo = QApplication::desktop()->screenGeometry(nScreen);
pWindow->setScreen(QApplication::screens()[nScreen]);
}
else // special case: fullscreen over all available screens
{
// left-most screen
int nLeftScreen = QApplication::desktop()->screenNumber(QPoint(0, 0));
// entire virtual desktop
screenGeo = QApplication::screens()[nLeftScreen]->availableVirtualGeometry();
pWindow->setScreen(QApplication::screens()[nLeftScreen]);
}
// setScreen by itself has no effect, explicitly move the widget to
// the new screen
QRect screenGeo = QApplication::desktop()->screenGeometry(nScreen);
QWidget* const pWidget = m_pTopLevel ? m_pTopLevel : m_pQWidget;
pWidget->move(screenGeo.topLeft());
}
else