diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-10-25 12:29:34 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-10-26 20:09:42 +0200 |
commit | 140434a7677946020bb2c6db9ed3afe8998ee7d0 (patch) | |
tree | 9f9a7b78f57e9ab018edc566e50834a0190cdcb6 | |
parent | 397b64afc62a5632a6648598558a4d2c3ca0d283 (diff) |
tdf#119719: Move the window to the requested screen
According to Qt doc, setScreen by itself is ineffective and this
additional step is needed. It still wouldn't work w/ dual screen
on older KDE Plasma (<= 5.12) but tests positively in GNOME and
Plasma 5.13.5
Change-Id: I080b6f93aa3c21411f606ade6df42e9bc3f6f299
Reviewed-on: https://gerrit.libreoffice.org/62351
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 1901877c57ea..822b8004b6e7 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -553,17 +553,16 @@ bool Qt5Frame::GetWindowState(SalFrameState* pState) void Qt5Frame::ShowFullScreen(bool bFullScreen, sal_Int32 nScreen) { + // only top-level windows can go fullscreen assert(m_pTopLevel); - if (isWindow()) - { - QWidget* const pWidget = m_pTopLevel ? m_pTopLevel : m_pQWidget; - pWidget->show(); + // show it if it isn't shown yet + if (!isWindow()) + m_pTopLevel->show(); - // do that before going fullscreen - SetScreenNumber(nScreen); - bFullScreen ? windowHandle()->showFullScreen() : windowHandle()->showNormal(); - } + // do that before going fullscreen + SetScreenNumber(nScreen); + bFullScreen ? windowHandle()->showFullScreen() : windowHandle()->showNormal(); } void Qt5Frame::StartPresentation(bool) @@ -987,7 +986,15 @@ 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]); + + // setScreen by itself has no effect, explicitly move the widget to + // the new screen + QRect screenGeo = QApplication::desktop()->screenGeometry(nScreen); + pWidget->move(screenGeo.topLeft()); + } else { // index outta bounds, use primary screen |