[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.
This commit is contained in:
Martin Gräßlin 2015-06-18 00:19:25 +02:00
parent 3442664609
commit 183479fe67

View file

@ -87,6 +87,9 @@ void WaylandServer::init(const QByteArray &socketName)
};
if (Toplevel *t = ws->findToplevel(check)) {
t->setSurface(surface);
if (Client *c = dynamic_cast<Client*>(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);