@@ -183,9 +183,6 @@ void ShellApplication::onScreenAdded(QScreen * /*screen*/)
183 if (screens().count() == 2) {
183 if (screens().count() == 2) {
184 m_shellView->setScreen(screens().at(1));
184 m_shellView->setScreen(screens().at(1));
185 m_qmlArgs.setDeviceName(QStringLiteral("desktop"));
185 m_qmlArgs.setDeviceName(QStringLiteral("desktop"));
186− // Changing the QScreen where a QWindow is drawn makes it also lose focus (besides having
187− // its backing QPlatformWindow recreated). So lets refocus it.
188− m_shellView->requestActivate();
189 // QWindow::destroy() is called when it changes between screens. We have to manually make it visible again
186 // QWindow::destroy() is called when it changes between screens. We have to manually make it visible again
190 // <dandrader> This bug is supposedly fixed in Qt 5.5.1, although I can still reproduce it there. :-/
187 // <dandrader> This bug is supposedly fixed in Qt 5.5.1, although I can still reproduce it there. :-/
191 m_shellView->setVisible(true);
188 m_shellView->setVisible(true);
@@ -196,6 +193,12 @@ void ShellApplication::onScreenAdded(QScreen * /*screen*/)
196 // QWindow::showFullScreen() also calls QWindow::requestActivate() and we don't want that!
193 // QWindow::showFullScreen() also calls QWindow::requestActivate() and we don't want that!
197 m_secondaryWindow->setWindowState(Qt::WindowFullScreen);
194 m_secondaryWindow->setWindowState(Qt::WindowFullScreen);
198 m_secondaryWindow->setVisible(true);
195 m_secondaryWindow->setVisible(true);
197+ // Changing the QScreen where a QWindow is drawn makes it also lose focus (besides having
198+ // its backing QPlatformWindow recreated). So lets refocus it.
199+ // This must be done after the creation of the SecondaryWindow, else
200+ // the SecondaryWindow takes focus anyway.
201+ m_shellView->requestActivate();