From 183479fe67876911bf2703d591781729ab00934e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 18 Jun 2015 00:19:25 +0200 Subject: [PATCH] [wayland] Only create PlasmaWindowInterface if AbstractClient has a surface With Xwayland clients it can happen that the window gets destroyed before it ever got a surface (Qt 5's file open dialog being an example). This change delays such clients till it got the surface, removing not needed roundtrips and possible problems. --- wayland_server.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wayland_server.cpp b/wayland_server.cpp index 0f4bda2ebd..e2e58e6ad2 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -87,6 +87,9 @@ void WaylandServer::init(const QByteArray &socketName) }; if (Toplevel *t = ws->findToplevel(check)) { t->setSurface(surface); + if (Client *c = dynamic_cast(t)) { + announceClientToWindowManagement(c); + } } } ); @@ -205,6 +208,9 @@ void WaylandServer::initWorkspace() void WaylandServer::announceClientToWindowManagement(AbstractClient *c) { + if (!c->surface()) { + return; + } auto w = m_windowManagement->createWindow(c); w->setTitle(c->caption()); w->setVirtualDesktop(c->isOnAllDesktops() ? 0 : c->desktop() - 1);