summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <mgraesslin@kde.org>2017-02-07 18:18:18 (GMT)
committerMartin Gräßlin <mgraesslin@kde.org>2017-02-07 18:26:36 (GMT)
commit8edd0336e67d81e93dfe1418dbe2409e2b03d405 (patch)
tree118ce4954544bfd159956bc3ebf66af785ca8196
parent41bd8d0de93f9d88557108510cf3e44d68d677b9 (diff)
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
-rw-r--r--autotests/integration/plasma_surface_test.cpp16
-rw-r--r--wayland_server.cpp16
-rw-r--r--wayland_server.h2
3 files changed, 23 insertions, 11 deletions
diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp
index 5cb620c..6492149 100644
--- a/autotests/integration/plasma_surface_test.cpp
+++ b/autotests/integration/plasma_surface_test.cpp
@@ -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()
diff --git a/wayland_server.cpp b/wayland_server.cpp
index 776c3af..383446c 100644
--- a/wayland_server.cpp
+++ b/wayland_server.cpp
@@ -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);
+ }
+ );
}
}
);
diff --git a/wayland_server.h b/wayland_server.h
index 706de95..1c6cab3 100644
--- a/wayland_server.h
+++ b/wayland_server.h
@@ -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)
};