client: Make sure screens stay virtual siblings during reconnect
The virtual siblings of QWaylandScreen are constructed from the list of screens in QWaylandDisplay. It is important that when a window changes screens due to handleScreenRemoved that the screens are siblings otherwise the platformwindow is destroyed and window becomes hidden. Pick-to: 6.6 Change-Id: I7ceeee4e18fbdfa936fe987441d35b8a5cb1eefd Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
9c3896c140
commit
63e2f90266
@ -421,9 +421,9 @@ void QWaylandDisplay::reconnect()
|
|||||||
qDeleteAll(mWaitingScreens);
|
qDeleteAll(mWaitingScreens);
|
||||||
mWaitingScreens.clear();
|
mWaitingScreens.clear();
|
||||||
|
|
||||||
const auto screens = std::exchange(mScreens, {});
|
while (!mScreens.isEmpty()) {
|
||||||
ensureScreen();
|
auto screen = mScreens.takeLast();
|
||||||
for (QWaylandScreen *screen : screens) {
|
ensureScreen();
|
||||||
QWindowSystemInterface::handleScreenRemoved(screen);
|
QWindowSystemInterface::handleScreenRemoved(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ private Q_SLOTS:
|
|||||||
//core
|
//core
|
||||||
void cleanup() { QTRY_VERIFY2(m_comp->isClean(), qPrintable(m_comp->dirtyMessage())); }
|
void cleanup() { QTRY_VERIFY2(m_comp->isClean(), qPrintable(m_comp->dirtyMessage())); }
|
||||||
void basicWindow();
|
void basicWindow();
|
||||||
void screens();
|
void multipleScreens();
|
||||||
|
|
||||||
//input
|
//input
|
||||||
void keyFocus();
|
void keyFocus();
|
||||||
@ -142,12 +142,25 @@ void tst_WaylandReconnect::basicWindow()
|
|||||||
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
|
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_WaylandReconnect::screens()
|
void tst_WaylandReconnect::multipleScreens()
|
||||||
{
|
{
|
||||||
QRasterWindow window;
|
|
||||||
window.resize(64, 48);
|
exec([this] { m_comp->add<Output>(); });
|
||||||
window.show();
|
QRasterWindow window1;
|
||||||
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
|
window1.resize(64, 48);
|
||||||
|
window1.show();
|
||||||
|
QRasterWindow window2;
|
||||||
|
window2.resize(64, 48);
|
||||||
|
window2.show();
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(0));
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(1));
|
||||||
|
|
||||||
|
// ensure they are on different outputs
|
||||||
|
exec([this] {
|
||||||
|
m_comp->surface(0)->sendEnter(m_comp->output(0));
|
||||||
|
m_comp->surface(1)->sendEnter(m_comp->output(1));
|
||||||
|
});
|
||||||
|
QTRY_VERIFY(window1.screen() != window2.screen());
|
||||||
|
|
||||||
auto originalScreens = QGuiApplication::screens();
|
auto originalScreens = QGuiApplication::screens();
|
||||||
|
|
||||||
@ -162,8 +175,13 @@ void tst_WaylandReconnect::screens()
|
|||||||
originalScreens.removeOne(screen[0].value<QScreen *>());
|
originalScreens.removeOne(screen[0].value<QScreen *>());
|
||||||
}
|
}
|
||||||
QVERIFY(originalScreens.isEmpty());
|
QVERIFY(originalScreens.isEmpty());
|
||||||
QVERIFY(window.screen());
|
|
||||||
QVERIFY(QGuiApplication::screens().contains(window.screen()));
|
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(0));
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(1));
|
||||||
|
QVERIFY(window1.screen());
|
||||||
|
QVERIFY(window2.screen());
|
||||||
|
QVERIFY(QGuiApplication::screens().contains(window1.screen()));
|
||||||
|
QVERIFY(QGuiApplication::screens().contains(window2.screen()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_WaylandReconnect::keyFocus()
|
void tst_WaylandReconnect::keyFocus()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user