Commit 8edd0336 authored by Martin Flöser's avatar Martin Flöser

Support creation of PlasmaShellSurface prior to ShellSurface

Summary:
So far KWin did not support the sequence:
1. Create wl_shell
2. Create PlasmaShellSurface
3. Create wl_shell_surface

KWin only supported the case that the PlasmaShellSurface is the last
thing to get created. This is rather limiting and can be considered a
bug. At least we had a QEXPECT_FAIL auto test for this situation. So
it was a known issue.

This change should make it easier to support the QtWayland changes in
Qt 5.8.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4482
parent 41bd8d0d
......@@ -144,17 +144,11 @@ void PlasmaSurfaceTest::testRoleOnAllDesktops()
plasmaSurface2->setRole(role);
QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data()));
QVERIFY(!shellSurface2.isNull());
Test::render(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(Test::waitForWaylandWindowShown());
QVERIFY(workspace()->activeClient() != c);
c = workspace()->activeClient();
QEXPECT_FAIL("Desktop", "PS before WS not supported", Continue);
QEXPECT_FAIL("Panel", "PS before WS not supported", Continue);
QEXPECT_FAIL("OSD", "PS before WS not supported", Continue);
QEXPECT_FAIL("Notification", "PS before WS not supported", Continue);
QEXPECT_FAIL("ToolTip", "PS before WS not supported", Continue);
QCOMPARE(c->isOnAllDesktops(), expectedOnAllDesktops);
auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(c2);
QVERIFY(c != c2);
QCOMPARE(c2->isOnAllDesktops(), expectedOnAllDesktops);
}
void PlasmaSurfaceTest::testAcceptsFocus_data()
......
......@@ -130,6 +130,15 @@ void WaylandServer::createSurface(T *surface)
ScreenLocker::KSldApp::self()->lockScreenShown();
}
auto client = new ShellClient(surface);
auto it = std::find_if(m_plasmaShellSurfaces.begin(), m_plasmaShellSurfaces.end(),
[client] (PlasmaShellSurfaceInterface *surface) {
return client->surface() == surface->surface();
}
);
if (it != m_plasmaShellSurfaces.end()) {
client->installPlasmaShellSurface(*it);
m_plasmaShellSurfaces.erase(it);
}
if (client->isInternal()) {
m_internalClients << client;
} else {
......@@ -214,6 +223,13 @@ bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
[this] (PlasmaShellSurfaceInterface *surface) {
if (ShellClient *client = findClient(surface->surface())) {
client->installPlasmaShellSurface(surface);
} else {
m_plasmaShellSurfaces << surface;
connect(surface, &QObject::destroyed, this,
[this, surface] {
m_plasmaShellSurfaces.removeOne(surface);
}
);
}
}
);
......
......@@ -50,6 +50,7 @@ class ServerSideDecorationManagerInterface;
class SurfaceInterface;
class OutputInterface;
class PlasmaShellInterface;
class PlasmaShellSurfaceInterface;
class PlasmaWindowManagementInterface;
class QtSurfaceExtensionInterface;
class OutputManagementInterface;
......@@ -232,6 +233,7 @@ private:
QList<ShellClient*> m_internalClients;
QHash<KWayland::Server::ClientConnection*, quint16> m_clientIds;
InitalizationFlags m_initFlags;
QVector<KWayland::Server::PlasmaShellSurfaceInterface*> m_plasmaShellSurfaces;
KWIN_SINGLETON(WaylandServer)
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment