Drop Effect::initConfig()

Effect::initConfig() definition can't be moved to effect.h because
it's going to create a cyclic dependency. On the other hand, the real
benefit of initConfig() is doubtful. It's a shortcut for calling
Config::instance(effects->config()), which is small amount of code.
This commit is contained in:
Vlad Zahorodnii 2023-11-16 15:59:43 +02:00
parent 8566cb3735
commit fe9821722e
20 changed files with 18 additions and 33 deletions

View file

@ -924,15 +924,6 @@ public:
public Q_SLOTS:
virtual bool borderActivated(ElectricBorder border);
protected:
/**
* An implementing class can call this with it's kconfig compiled singleton class.
* This method will perform the instance on the class.
* @since 5.9
*/
template<typename T>
void initConfig();
};
/**

View file

@ -2746,12 +2746,6 @@ int Effect::animationTime(int defaultDuration)
return animationTime(T::duration() != 0 ? T::duration() : defaultDuration);
}
template<typename T>
void Effect::initConfig()
{
T::instance(effects->config());
}
/***************************************************************
EffectWindow
***************************************************************/

View file

@ -50,7 +50,7 @@ QTimer *BlurEffect::s_blurManagerRemoveTimer = nullptr;
BlurEffect::BlurEffect()
{
initConfig<BlurConfig>();
BlurConfig::instance(effects->config());
ensureResources();
m_downsamplePass.shader = ShaderManager::instance()->generateShaderFromFile(ShaderTrait::MapTexture,

View file

@ -36,7 +36,7 @@ static inline bool belongToSameGroup(const EffectWindow *w1, const EffectWindow
DimInactiveEffect::DimInactiveEffect()
{
initConfig<DimInactiveConfig>();
DimInactiveConfig::instance(effects->config());
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::windowActivated,

View file

@ -31,7 +31,7 @@ bool FallApartEffect::supported()
FallApartEffect::FallApartEffect()
{
initConfig<FallApartConfig>();
FallApartConfig::instance(effects->config());
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::windowClosed, this, &FallApartEffect::slotWindowClosed);
connect(effects, &EffectsHandler::windowDataChanged, this, &FallApartEffect::slotWindowDataChanged);

View file

@ -68,7 +68,7 @@ static QMatrix4x4 createPerspectiveMatrix(const QRectF &rect, const qreal scale,
GlideEffect::GlideEffect()
{
initConfig<GlideConfig>();
GlideConfig::instance(effects->config());
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::windowAdded, this, &GlideEffect::windowAdded);

View file

@ -47,7 +47,7 @@ KscreenEffect::KscreenEffect()
: Effect()
, m_atom(effects->waylandDisplay() ? XCB_ATOM_NONE : effects->announceSupportProperty("_KDE_KWIN_KSCREEN_SUPPORT", this))
{
initConfig<KscreenConfig>();
KscreenConfig::instance(effects->config());
if (!effects->waylandDisplay()) {
connect(effects, &EffectsHandler::propertyNotify, this, &KscreenEffect::propertyNotify);
connect(effects, &EffectsHandler::xcbConnectionChanged, this, [this]() {

View file

@ -18,7 +18,7 @@ namespace KWin
MagicLampEffect::MagicLampEffect()
{
initConfig<MagicLampConfig>();
MagicLampConfig::instance(effects->config());
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::windowAdded, this, &MagicLampEffect::slotWindowAdded);
connect(effects, &EffectsHandler::windowDeleted, this, &MagicLampEffect::slotWindowDeleted);

View file

@ -33,7 +33,7 @@ MagnifierEffect::MagnifierEffect()
, m_texture(nullptr)
, m_fbo(nullptr)
{
initConfig<MagnifierConfig>();
MagnifierConfig::instance(effects->config());
QAction *a;
a = KStandardAction::zoomIn(this, &MagnifierEffect::zoomIn, this);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Equal));

View file

@ -29,7 +29,7 @@ namespace KWin
MouseClickEffect::MouseClickEffect()
{
initConfig<MouseClickConfig>();
MouseClickConfig::instance(effects->config());
m_enabled = false;
QAction *a = new QAction(this);

View file

@ -36,7 +36,7 @@ static consteval QPoint nullPoint()
MouseMarkEffect::MouseMarkEffect()
{
initConfig<MouseMarkConfig>();
MouseMarkConfig::instance(effects->config());
QAction *a = new QAction(this);
a->setObjectName(QStringLiteral("ClearMouseMarks"));
a->setText(i18n("Clear All Mouse Marks"));

View file

@ -154,7 +154,7 @@ OverviewEffect::OverviewEffect()
connect(effects, &EffectsHandler::screenAboutToLock, this, &OverviewEffect::realDeactivate);
initConfig<OverviewConfig>();
OverviewConfig::instance(effects->config());
reconfigure(ReconfigureAll);
setSource(QUrl(QStringLiteral("qrc:/overview/qml/main.qml")));

View file

@ -54,7 +54,7 @@ static QMatrix4x4 createPerspectiveMatrix(const QRectF &rect, const qreal scale)
SheetEffect::SheetEffect()
{
initConfig<SheetConfig>();
SheetConfig::instance(effects->config());
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::windowAdded, this, &SheetEffect::slotWindowAdded);

View file

@ -23,7 +23,7 @@ namespace KWin
SlideEffect::SlideEffect()
{
initConfig<SlideConfig>();
SlideConfig::instance(effects->config());
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::desktopChanged,

View file

@ -32,7 +32,7 @@ QTimer *SlidingPopupsEffect::s_slideManagerRemoveTimer = nullptr;
SlidingPopupsEffect::SlidingPopupsEffect()
{
initConfig<SlidingPopupsConfig>();
SlidingPopupsConfig::instance(effects->config());
Display *display = effects->waylandDisplay();
if (display) {

View file

@ -25,7 +25,7 @@ namespace KWin
ThumbnailAsideEffect::ThumbnailAsideEffect()
{
initConfig<ThumbnailAsideConfig>();
ThumbnailAsideConfig::instance(effects->config());
QAction *a = new QAction(this);
a->setObjectName(QStringLiteral("ToggleCurrentThumbnail"));
a->setText(i18n("Toggle Thumbnail for Current Window"));

View file

@ -34,7 +34,7 @@ namespace KWin
TrackMouseEffect::TrackMouseEffect()
: m_angle(0)
{
initConfig<TrackMouseConfig>();
TrackMouseConfig::instance(effects->config());
if (effects->isOpenGLCompositing() || effects->compositingType() == QPainterCompositing) {
m_angleBase = 90.0;
}

View file

@ -30,7 +30,7 @@ WindowViewEffect::WindowViewEffect()
, m_exposeClassCurrentDesktopAction(new QAction(this))
{
qmlRegisterUncreatableType<WindowViewEffect>("org.kde.KWin.Effect.WindowView", 1, 0, "WindowView", QStringLiteral("WindowView cannot be created in QML"));
initConfig<WindowViewConfig>();
WindowViewConfig::instance(effects->config());
new WindowView1Adaptor(this);
QDBusConnection::sessionBus().registerObject(s_dbusObjectPath, this);

View file

@ -121,7 +121,7 @@ static const ParameterSet pset[5] = {set_0, set_1, set_2, set_3, set_4};
WobblyWindowsEffect::WobblyWindowsEffect()
{
initConfig<WobblyWindowsConfig>();
WobblyWindowsConfig::instance(effects->config());
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::windowAdded, this, &WobblyWindowsEffect::slotWindowAdded);

View file

@ -46,7 +46,7 @@ ZoomEffect::ZoomEffect()
, moveFactor(20.0)
, lastPresentTime(std::chrono::milliseconds::zero())
{
initConfig<ZoomConfig>();
ZoomConfig::instance(effects->config());
QAction *a = nullptr;
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << (Qt::META | Qt::Key_Plus));