vcl/qt5/Qt5Frame.cxx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
New commits: commit 140434a7677946020bb2c6db9ed3afe8998ee7d0 Author: Katarina Behrens <katarina.behr...@cib.de> AuthorDate: Thu Oct 25 12:29:34 2018 +0200 Commit: Katarina Behrens <katarina.behr...@cib.de> CommitDate: Fri Oct 26 20:09:42 2018 +0200 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.behr...@cib.de> Tested-by: Katarina Behrens <katarina.behr...@cib.de> 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits