Call setupCompositing on internal clients on startup of Compositor

This fixes a regression found in TestSceneQPainter for restarting the
Compositor. The internal clients were never added to the Scene.

We cannot just call setupCompositing because there is a phase during
startup where setupCompositing already passes but the Compositor is not
yet fully initialized. Thus it could happen that it's called twice which
makes the Scene assert.

To solve that setupCompositing and finishCompositing are now overriden
in ShellClient and track whether they successfully called
setupCompositing.
This commit is contained in:
Martin Gräßlin 2016-08-19 12:33:59 +02:00
parent 2a8ab547e1
commit 01ee957c49
3 changed files with 25 additions and 0 deletions

View file

@ -326,6 +326,11 @@ void Compositor::startupWithWorkspace()
c->setupCompositing(); c->setupCompositing();
c->getShadow(); c->getShadow();
} }
const auto internalClients = w->internalClients();
for (auto c : internalClients) {
c->setupCompositing();
c->getShadow();
}
} }
emit compositingToggled(true); emit compositingToggled(true);

View file

@ -1237,4 +1237,19 @@ void ShellClient::doMinimize()
} }
} }
bool ShellClient::setupCompositing()
{
if (m_compositingSetup) {
return true;
}
m_compositingSetup = Toplevel::setupCompositing();
return m_compositingSetup;
}
void ShellClient::finishCompositing(ReleaseReason releaseReason)
{
m_compositingSetup = false;
Toplevel::finishCompositing(releaseReason);
}
} }

View file

@ -125,6 +125,9 @@ public:
QMatrix4x4 inputTransformation() const override; QMatrix4x4 inputTransformation() const override;
bool setupCompositing() override;
void finishCompositing(ReleaseReason releaseReason = ReleaseReason::Release) override;
protected: protected:
void addDamage(const QRegion &damage) override; void addDamage(const QRegion &damage) override;
bool belongsToSameApplication(const AbstractClient *other, bool active_hack) const override; bool belongsToSameApplication(const AbstractClient *other, bool active_hack) const override;
@ -208,6 +211,8 @@ private:
int m_requestGeometryBlockCounter = 0; int m_requestGeometryBlockCounter = 0;
QRect m_blockedRequestGeometry; QRect m_blockedRequestGeometry;
QString m_caption; QString m_caption;
bool m_compositingSetup = false;
}; };
} }