Partly remove Compositor restart functionality

Summary:
This removes the restart function of the Compositor class and renames the
internal reinitialize function.

Instead of the restart function reinitialize can be called. Reading again
the settings in this case is fine, since it is done rarely. This reduces
the code complexity.

Test Plan: Manually on Wayland and X. 100% autotests pass.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: davidedmundson, zzag, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D22225
This commit is contained in:
Roman Gilg 2019-07-02 22:30:27 +02:00
parent ba6daecb4f
commit 8c047613c5
6 changed files with 8 additions and 21 deletions

View file

@ -158,7 +158,7 @@ void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
QVERIFY(effect->isActive());
// Re-initialize the compositor, effects will be destroyed and created again.
Compositor::self()->slotReinitialize();
Compositor::self()->reinitialize();
// By this time, KWin should still be alive.
}

View file

@ -102,7 +102,7 @@ void GenericSceneOpenGLTest::testRestart()
QSignalSpy sceneCreatedSpy(KWin::Compositor::self(), &Compositor::sceneCreated);
QVERIFY(sceneCreatedSpy.isValid());
KWin::Compositor::self()->slotReinitialize();
KWin::Compositor::self()->reinitialize();
if (sceneCreatedSpy.isEmpty()) {
QVERIFY(sceneCreatedSpy.wait());
}

View file

@ -283,7 +283,7 @@ void SceneQPainterTest::testCompositorRestart()
QVERIFY(oldScene);
QSignalSpy sceneCreatedSpy(KWin::Compositor::self(), &KWin::Compositor::sceneCreated);
QVERIFY(sceneCreatedSpy.isValid());
KWin::Compositor::self()->slotReinitialize();
KWin::Compositor::self()->reinitialize();
if (sceneCreatedSpy.isEmpty()) {
QVERIFY(sceneCreatedSpy.wait());
}

View file

@ -110,7 +110,7 @@ Compositor::Compositor(QObject* workspace)
, m_composeAtSwapCompletion(false)
{
qRegisterMetaType<Compositor::SuspendReason>("Compositor::SuspendReason");
connect(&compositeResetTimer, &QTimer::timeout, this, &Compositor::restart);
connect(&compositeResetTimer, &QTimer::timeout, this, &Compositor::reinitialize);
connect(options, &Options::configChanged, this, &Compositor::slotConfigChanged);
compositeResetTimer.setSingleShot(true);
m_monotonicClock.start();
@ -277,7 +277,7 @@ void Compositor::slotCompositingOptionsInitialized()
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
}
connect(m_scene, &Scene::resetCompositing, this, &Compositor::restart);
connect(m_scene, &Scene::resetCompositing, this, &Compositor::reinitialize);
emit sceneCreated();
if (Workspace::self()) {
@ -503,7 +503,7 @@ void Compositor::slotConfigChanged()
finish();
}
void Compositor::slotReinitialize()
void Compositor::reinitialize()
{
// Reparse config. Config options will be reloaded by setup()
kwinApp()->config()->reparseConfiguration();
@ -590,14 +590,6 @@ void Compositor::resume(Compositor::SuspendReason reason)
setup(); // signal "toggled" is eventually emitted from within setup
}
void Compositor::restart()
{
if (hasScene()) {
finish();
QTimer::singleShot(0, this, &Compositor::setup);
}
}
void Compositor::addRepaint(int x, int y, int w, int h)
{
if (!hasScene())

View file

@ -115,7 +115,7 @@ public:
* Re-initializes the Compositor completely.
* Connected to the D-Bus signal org.kde.KWin /KWin reinitCompositing
**/
void slotReinitialize();
void reinitialize();
/**
* Whether the Compositor is active. That is a Scene is present and the Compositor is
@ -187,11 +187,6 @@ private:
**/
void slotCompositingOptionsInitialized();
void finish();
/**
* Restarts the Compositor if running.
* That is the Compositor will be stopped and started again.
**/
void restart();
void claimCompositorSelection();

View file

@ -319,7 +319,7 @@ void CompositorDBusInterface::suspend()
void CompositorDBusInterface::reinitialize()
{
m_compositor->slotReinitialize();
m_compositor->reinitialize();
}
QStringList CompositorDBusInterface::supportedOpenGLPlatformInterfaces() const