diff --git a/composite.h b/composite.h --- a/composite.h +++ b/composite.h @@ -125,7 +125,6 @@ int xrrRefreshRate() const { return m_xrrRefreshRate; } - void setCompositeResetTimer(int msecs); bool hasScene() const { return m_scene != NULL; @@ -219,7 +218,6 @@ int m_xrrRefreshRate; QRegion repaints_region; - QTimer compositeResetTimer; // for compressing composite resets bool m_finishing; // finish() sets this variable while shutting down bool m_starting; // start() sets this variable while starting qint64 m_timeSinceLastVBlank; diff --git a/composite.cpp b/composite.cpp --- a/composite.cpp +++ b/composite.cpp @@ -110,9 +110,8 @@ , m_composeAtSwapCompletion(false) { qRegisterMetaType("Compositor::SuspendReason"); - connect(&compositeResetTimer, &QTimer::timeout, this, &Compositor::reinitialize); connect(options, &Options::configChanged, this, &Compositor::slotConfigChanged); - compositeResetTimer.setSingleShot(true); + m_monotonicClock.start(); // 2 sec which should be enough to restart the compositor @@ -816,11 +815,6 @@ return false; } -void Compositor::setCompositeResetTimer(int msecs) -{ - compositeResetTimer.start(msecs); -} - void Compositor::setCompositeTimer() { if (!hasScene()) // should not really happen, but there may be e.g. some damage events still pending diff --git a/plugins/platforms/x11/standalone/screens_xrandr.cpp b/plugins/platforms/x11/standalone/screens_xrandr.cpp --- a/plugins/platforms/x11/standalone/screens_xrandr.cpp +++ b/plugins/platforms/x11/standalone/screens_xrandr.cpp @@ -47,6 +47,21 @@ m_backend->initOutputs(); setCount(m_backend->outputs().count()); emit changed(); + +#ifndef KWIN_UNIT_TEST + connect(this, &XRandRScreens::changed, this, [] { + if (!workspace()->compositing()) { + return; + } + if (Compositor::self()->xrrRefreshRate() == Options::currentRefreshRate()) { + return; + } + // desktopResized() should take care of when the size or + // shape of the desktop has changed, but we also want to + // catch refresh rate changes + Compositor::self()->reinitialize(); + }); +#endif } void XRandRScreens::updateCount() @@ -75,15 +90,6 @@ screen->width_in_millimeters = xrrEvent->mwidth; screen->height_in_millimeters = xrrEvent->mheight; } -#ifndef KWIN_UNIT_TEST - if (workspace()->compositing()) { - // desktopResized() should take care of when the size or - // shape of the desktop has changed, but we also want to - // catch refresh rate changes - if (Compositor::self()->xrrRefreshRate() != Options::currentRefreshRate()) - Compositor::self()->setCompositeResetTimer(0); - } -#endif return false; }