Restart compositing if kwinrc changes only on X11

On Wayland, options don't influence compositing as on X11. For example,
kwin cannot easily switch between compositing modes, etc.

One can still force kwin_wayland to reinitialize compositing by using
the dbus api.
This commit is contained in:
Vlad Zahorodnii 2023-10-20 15:10:24 +03:00
parent 49b84ddf8c
commit 754b549f01
4 changed files with 8 additions and 19 deletions

View file

@ -41,8 +41,6 @@ Compositor *Compositor::self()
Compositor::Compositor(QObject *workspace)
: QObject(workspace)
{
connect(options, &Options::configChanged, this, &Compositor::configChanged);
// 2 sec which should be enough to restart the compositor.
static const int compositorLostMessageDelay = 2000;
@ -119,11 +117,6 @@ void Compositor::deleteUnusedSupportProperties()
}
}
void Compositor::configChanged()
{
reinitialize();
}
void Compositor::reinitialize()
{
// Restart compositing

View file

@ -130,8 +130,6 @@ protected:
virtual void start() = 0;
virtual void stop() = 0;
virtual void configChanged();
static Compositor *s_compositor;
protected Q_SLOTS:

View file

@ -79,6 +79,14 @@ X11Compositor::X11Compositor(QObject *parent)
m_framesToTestForSafety = qEnvironmentVariableIntValue("KWIN_MAX_FRAMES_TESTED");
}
connect(options, &Options::configChanged, this, [this]() {
if (m_suspended) {
stop();
} else {
reinitialize();
}
});
m_releaseSelectionTimer.setSingleShot(true);
m_releaseSelectionTimer.setInterval(2000);
connect(&m_releaseSelectionTimer, &QTimer::timeout, this, &X11Compositor::releaseCompositorSelection);
@ -127,15 +135,6 @@ void X11Compositor::reinitialize()
Compositor::reinitialize();
}
void X11Compositor::configChanged()
{
if (m_suspended) {
stop();
return;
}
Compositor::configChanged();
}
void X11Compositor::suspend(X11Compositor::SuspendReason reason)
{
Q_ASSERT(reason != NoReasonSuspend);

View file

@ -97,7 +97,6 @@ public:
void uninhibit(Window *window) override;
void reinitialize() override;
void configChanged() override;
bool compositingPossible() const override;
QString compositingNotPossibleReason() const override;
bool openGLCompositingIsBroken() const override;