Commit 04200484 authored by Cyril Rossi's avatar Cyril Rossi

KCM KWinCompositing implement KCModuleData to highlight default at module level

Fix Rendering backend combobox that was not highlighted.
Particular case due to OpenGLIsUnsafe kcfg entry which is an indicating
flag and not a configurable setting.
parent c812b1b8
......@@ -10,6 +10,7 @@ remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FR
set(kwincompositing_SRC
main.cpp
kwincompositingdata.cpp
)
kconfig_add_kcfg_files(kwincompositing_SRC kwincompositing_setting.kcfgc GENERATE_MOC)
......
......@@ -5,7 +5,6 @@ X-KDE-ServiceTypes=KCModule
X-DocPath=https://userbase.kde.org/Desktop_Effects_Performance#Advanced_Desktop_Effects_Settings
X-KDE-Library=kwincompositing
X-KDE-PluginKeyword=compositing
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=display
......
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2020 Cyril Rossi <cyril.rossi@enioka.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwincompositingdata.h"
#include "kwincompositing_setting.h"
KWinCompositingData::KWinCompositingData(QObject *parent, const QVariantList &args)
: KCModuleData(parent, args)
, m_settings(new KWinCompositingSetting(this))
{
}
bool KWinCompositingData::isDefaults() const
{
bool defaults = true;
for (const auto &item : m_settings->items()) {
if (item->key() != QStringLiteral("OpenGLIsUnsafe")) {
defaults &= item->isDefault();
}
}
return defaults;
}
#include "kwincompositingdata.moc"
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2020 Cyril Rossi <cyril.rossi@enioka.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KWINCOMPOSITINGDATA_H
#define KWINCOMPOSITINGDATA_H
#include <QObject>
#include "kcmoduledata.h"
class KWinCompositingSetting;
class KWinCompositingData : public KCModuleData
{
Q_OBJECT
public:
explicit KWinCompositingData(QObject *parent = nullptr, const QVariantList &args = QVariantList());
bool isDefaults() const override;
private:
KWinCompositingSetting *m_settings;
};
#endif // KWINCOMPOSITINGDATA_H
......@@ -23,6 +23,7 @@
#include <functional>
#include "kwincompositing_setting.h"
#include "kwincompositingdata.h"
static bool isRunningPlasma()
{
......@@ -88,6 +89,8 @@ KWinCompositingKCM::KWinCompositingKCM(QWidget *parent, const QVariantList &args
m_form.kcfg_Enabled->setVisible(!compositingRequired());
m_form.kcfg_WindowsBlockCompositing->setVisible(!compositingRequired());
connect(this, &KWinCompositingKCM::defaultsIndicatorsVisibleChanged, this, &KWinCompositingKCM::updateUnmanagedItemStatus);
init();
}
......@@ -211,6 +214,10 @@ void KWinCompositingKCM::updateUnmanagedItemStatus()
if (!inPlasma) {
defaulted &= animationDuration == m_settings->defaultAnimationDurationFactorValue();
}
m_form.backend->setProperty("_kde_highlight_neutral", defaultsIndicatorsVisible() && (backend != m_settings->defaultBackendValue() || glCore != m_settings->defaultGlCoreValue()));
m_form.backend->update();
unmanagedWidgetDefaultState(defaulted);
}
......@@ -288,7 +295,8 @@ void KWinCompositingKCM::save()
}
K_PLUGIN_FACTORY(KWinCompositingConfigFactory,
registerPlugin<KWinCompositingKCM>("compositing");
registerPlugin<KWinCompositingKCM>();
registerPlugin<KWinCompositingData>();
)
#include "main.moc"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment