From ba6daecb4f12ae0d55a1d30ddf36df71f0848d0d Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Tue, 2 Jul 2019 21:09:23 +0200 Subject: [PATCH] Remove compositing initialized check Summary: The check is used to limit settings reload. But we can afford to reload settings in case the compositing gets toggled since this happens rarely. Removing the check reduces code complexity. Test Plan: Manually in X and Wayland. Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: kwin Tags: #kwin Maniphest Tasks: T11071 Differential Revision: https://phabricator.kde.org/D22220 --- composite.cpp | 5 +---- options.cpp | 14 -------------- options.h | 10 ---------- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/composite.cpp b/composite.cpp index c33d06915c..207114c4da 100644 --- a/composite.cpp +++ b/composite.cpp @@ -193,9 +193,7 @@ void Compositor::setup() } m_starting = true; - if (!options->isCompositingInitialized()) { - options->reloadCompositingSettings(true); - } + options->reloadCompositingSettings(true); slotCompositingOptionsInitialized(); } @@ -514,7 +512,6 @@ void Compositor::slotReinitialize() finish(); // resume compositing if suspended m_suspended = NoReasonSuspend; - options->setCompositingInitialized(false); setup(); if (effects) { // setup() may fail diff --git a/options.cpp b/options.cpp index a8cd58f16f..094ce5b5cc 100644 --- a/options.cpp +++ b/options.cpp @@ -112,7 +112,6 @@ Options::Options(QObject *parent) , m_autogroupInForeground(false) , m_compositingMode(Options::defaultCompositingMode()) , m_useCompositing(Options::defaultUseCompositing()) - , m_compositingInitialized(Options::defaultCompositingInitialized()) , m_hiddenPreviews(Options::defaultHiddenPreviews()) , m_glSmoothScale(Options::defaultGlSmoothScale()) , m_xrenderSmoothScale(Options::defaultXrenderSmoothScale()) @@ -615,15 +614,6 @@ void Options::setUseCompositing(bool useCompositing) emit useCompositingChanged(); } -void Options::setCompositingInitialized(bool compositingInitialized) -{ - if (m_compositingInitialized == compositingInitialized) { - return; - } - m_compositingInitialized = compositingInitialized; - emit compositingInitializedChanged(); -} - void Options::setHiddenPreviews(int hiddenPreviews) { if (m_hiddenPreviews == static_cast(hiddenPreviews)) { @@ -787,7 +777,6 @@ void Options::updateSettings() // KDE4 this probably needs to be done manually in clients // Driver-specific config detection - setCompositingInitialized(false); reloadCompositingSettings(); emit configChanged(); @@ -956,9 +945,6 @@ void Options::reloadCompositingSettings(bool force) } m_settings->load(); syncFromKcfgc(); - // from now on we've an initial setup and don't have to reload settings on compositing activation - // see Workspace::setupCompositing(), composite.cpp - setCompositingInitialized(true); // Compositing settings KConfigGroup config(m_settings->config(), "Compositing"); diff --git a/options.h b/options.h index c66c6b5913..8cfed98885 100644 --- a/options.h +++ b/options.h @@ -167,7 +167,6 @@ class KWIN_EXPORT Options : public QObject Q_PROPERTY(bool autogroupInForeground READ isAutogroupInForeground WRITE setAutogroupInForeground NOTIFY autogroupInForegroundChanged) Q_PROPERTY(int compositingMode READ compositingMode WRITE setCompositingMode NOTIFY compositingModeChanged) Q_PROPERTY(bool useCompositing READ isUseCompositing WRITE setUseCompositing NOTIFY useCompositingChanged) - Q_PROPERTY(bool compositingInitialized READ isCompositingInitialized WRITE setCompositingInitialized NOTIFY compositingInitializedChanged) Q_PROPERTY(int hiddenPreviews READ hiddenPreviews WRITE setHiddenPreviews NOTIFY hiddenPreviewsChanged) /** * 0 = no, 1 = yes when transformed, @@ -558,9 +557,6 @@ public: } // Separate to mode so the user can toggle bool isUseCompositing() const; - bool isCompositingInitialized() const { - return m_compositingInitialized; - } // General preferences HiddenPreviews hiddenPreviews() const { @@ -662,7 +658,6 @@ public: void setAutogroupInForeground(bool autogroupInForeground); void setCompositingMode(int compositingMode); void setUseCompositing(bool useCompositing); - void setCompositingInitialized(bool compositingInitialized); void setHiddenPreviews(int hiddenPreviews); void setGlSmoothScale(int glSmoothScale); void setXrenderSmoothScale(bool xrenderSmoothScale); @@ -746,9 +741,6 @@ public: static bool defaultUseCompositing() { return true; } - static bool defaultCompositingInitialized() { - return false; - } static HiddenPreviews defaultHiddenPreviews() { return HiddenPreviewsShown; } @@ -853,7 +845,6 @@ Q_SIGNALS: void autogroupInForegroundChanged(); void compositingModeChanged(); void useCompositingChanged(); - void compositingInitializedChanged(); void hiddenPreviewsChanged(); void glSmoothScaleChanged(); void xrenderSmoothScaleChanged(); @@ -898,7 +889,6 @@ private: CompositingType m_compositingMode; bool m_useCompositing; - bool m_compositingInitialized; HiddenPreviews m_hiddenPreviews; int m_glSmoothScale; bool m_xrenderSmoothScale;