[effects] Use arg="true" in the kcfg files

Summary:
By changing all kcfg to have arg="true" we can pass in the same
KSharedConfigPtr into all effects. This allows to have fake config in
the tests and in the planned effect demo mode.

Also it means that we don't have to hardcode the name kwinrc into the
files. In the configs - where we cannot access the effectshandler - we
use the define KWIN_CONFIG which gets generated based on the compile
time arguments.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3571
icc-effect-5.14.5
Martin Gräßlin 2016-12-02 20:27:43 +01:00
parent af9f81700f
commit 2132b1e0c8
78 changed files with 134 additions and 31 deletions

View File

@ -75,13 +75,13 @@ void SlidingPopupsTest::initTestCase()
for (QString name : builtinNames) {
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
}
KConfigGroup wobblyGroup = config->group("Effect-Wobbly");
wobblyGroup.writeEntry(QStringLiteral("Settings"), QStringLiteral("Custom"));
wobblyGroup.writeEntry(QStringLiteral("OpenEffect"), true);
wobblyGroup.writeEntry(QStringLiteral("CloseEffect"), true);
config->sync();
kwinApp()->setConfig(config);
// TODO: make effects use KWin's config directly
KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG), KConfig::NoGlobals)->group("Effect-Wobbly").writeEntry(QStringLiteral("Settings"), QStringLiteral("Custom"));
KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG), KConfig::NoGlobals)->group("Effect-Wobbly").writeEntry(QStringLiteral("OpenEffect"), true);
KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG), KConfig::NoGlobals)->group("Effect-Wobbly").writeEntry(QStringLiteral("CloseEffect"), true);
if (QFile::exists(QStringLiteral("/dev/dri/card0"))) {
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));

View File

@ -23,3 +23,10 @@ MockEffectsHandler::MockEffectsHandler(KWin::CompositingType type)
: EffectsHandler(type)
{
}
KSharedConfigPtr MockEffectsHandler::config() const
{
static const KSharedConfigPtr s_config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
return s_config;
}

View File

@ -260,6 +260,8 @@ public:
}
void hideOnScreenMessage(OnScreenMessageHideFlags flags = OnScreenMessageHideFlags()) override { Q_UNUSED(flags)}
KSharedConfigPtr config() const override;
private:
bool m_animationsSuported = true;
};

View File

@ -1621,6 +1621,11 @@ void EffectsHandlerImpl::hideOnScreenMessage(OnScreenMessageHideFlags flags)
OSD::hide(osdFlags);
}
KSharedConfigPtr EffectsHandlerImpl::config() const
{
return kwinApp()->config();
}
//****************************************
// EffectWindowImpl
//****************************************

View File

@ -241,6 +241,8 @@ public:
void showOnScreenMessage(const QString &message, const QString &iconName = QString()) override;
void hideOnScreenMessage(OnScreenMessageHideFlags flags = OnScreenMessageHideFlags()) override;
KSharedConfigPtr config() const override;
Scene *scene() const {
return m_scene;
}

View File

@ -39,6 +39,7 @@ static const QByteArray s_blurAtomName = QByteArrayLiteral("_KDE_NET_WM_BLUR_BEH
BlurEffect::BlurEffect()
{
initConfig<BlurConfig>();
shader = BlurShader::create();
m_simpleShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("logout-blur.frag"));
if (!m_simpleShader->isValid()) {

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Blur">
<entry name="BlurRadius" type="Int">
<default>12</default>

View File

@ -20,6 +20,7 @@
#include "blur_config.h"
// KConfigSkeleton
#include "blurconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <KAboutData>
@ -36,6 +37,7 @@ BlurEffectConfig::BlurEffectConfig(QWidget *parent, const QVariantList &args)
: KCModule(KAboutData::pluginData(QStringLiteral("blur")), parent, args)
{
ui.setupUi(this);
BlurConfig::instance(KWIN_CONFIG);
addConfig(BlurConfig::self(), this);
load();

View File

@ -54,6 +54,7 @@ CoverSwitchEffect::CoverSwitchEffect()
, primaryTabBox(false)
, secondaryTabBox(false)
{
initConfig<CoverSwitchConfig>();
reconfigure(ReconfigureAll);
// Caption frame

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-CoverSwitch">
<entry name="Duration" type="UInt">
<default>0</default>

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "coverswitch_config.h"
// KConfigSkeleton
#include "coverswitchconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <KAboutData>
@ -48,6 +49,7 @@ CoverSwitchEffectConfig::CoverSwitchEffectConfig(QWidget* parent, const QVariant
layout->addWidget(m_ui);
CoverSwitchConfig::instance(KWIN_CONFIG);
addConfig(CoverSwitchConfig::self(), m_ui);
}

View File

@ -95,6 +95,7 @@ CubeEffect::CubeEffect()
, m_cylinderAction(new QAction(this))
, m_sphereAction(new QAction(this))
{
initConfig<CubeConfig>();
desktopNameFont.setBold(true);
desktopNameFont.setPointSize(14);

View File

@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Cube">
<entry name="BorderActivate" type="IntList" />
<entry name="BorderActivateCylinder" type="IntList" />

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cube_config.h"
// KConfigSkeleton
#include "cubeconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -85,6 +86,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
capsSelectionChanged();
connect(m_ui->kcfg_Caps, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged()));
m_ui->kcfg_Wallpaper->setFilter(QStringLiteral("*.png *.jpeg *.jpg "));
CubeConfig::instance(KWIN_CONFIG);
addConfig(CubeConfig::self(), m_ui);
load();
}

View File

@ -37,6 +37,7 @@ CubeSlideEffect::CubeSlideEffect()
, desktopChangedWhileMoving(false)
, progressRestriction(0.0f)
{
initConfig<CubeSlideConfig>();
connect(effects, SIGNAL(desktopChanged(int,int)), this, SLOT(slotDesktopChanged(int,int)));
connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*)));

View File

@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-CubeSlide">
<entry name="RotationDuration" type="Int">
<default>0</default>

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cubeslide_config.h"
// KConfigSkeleton
#include "cubeslideconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <kconfiggroup.h>
@ -48,6 +49,7 @@ CubeSlideEffectConfig::CubeSlideEffectConfig(QWidget* parent, const QVariantList
layout->addWidget(m_ui);
CubeSlideConfig::instance(KWIN_CONFIG);
addConfig(CubeSlideConfig::self(), m_ui);
load();

View File

@ -66,6 +66,7 @@ DesktopGridEffect::DesktopGridEffect()
, m_proxy(0)
, m_activateAction(new QAction(this))
{
initConfig<DesktopGridConfig>();
// Load shortcuts
QAction* a = m_activateAction;
a->setObjectName(QStringLiteral("ShowDesktopGrid"));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-DesktopGrid">
<entry name="BorderActivate" type="IntList" />
<entry name="TouchBorderActivate" type="IntList" />

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "desktopgrid_config.h"
// KConfigSkeleton
#include "desktopgridconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -83,6 +84,7 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant
m_ui->desktopNameAlignmentCombo->addItem(i18n("Top-Left"), QVariant(Qt::AlignLeft | Qt::AlignTop));
m_ui->desktopNameAlignmentCombo->addItem(i18n("Center"), QVariant(Qt::AlignCenter));
DesktopGridConfig::instance(KWIN_CONFIG);
addConfig(DesktopGridConfig::self(), m_ui);
connect(m_ui->kcfg_LayoutMode, SIGNAL(currentIndexChanged(int)), this, SLOT(layoutSelectionChanged()));
connect(m_ui->desktopNameAlignmentCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));

View File

@ -30,6 +30,7 @@ namespace KWin
DimInactiveEffect::DimInactiveEffect()
{
initConfig<DimInactiveConfig>();
reconfigure(ReconfigureAll);
timeline.setDuration(animationTime(250));
previousActiveTimeline.setDuration(animationTime(250));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-DimInactive">
<entry name="Strength" type="Int">
<default>25</default>

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "diminactive_config.h"
// KConfigSkeleton
#include "diminactiveconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
@ -53,6 +54,7 @@ DimInactiveEffectConfig::DimInactiveEffectConfig(QWidget* parent, const QVariant
layout->addWidget(m_ui);
DimInactiveConfig::instance(KWIN_CONFIG);
addConfig(DimInactiveConfig::self(), m_ui);
load();

View File

@ -34,6 +34,7 @@ bool FallApartEffect::supported()
FallApartEffect::FallApartEffect()
{
initConfig<FallApartConfig>();
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-FallApart">
<entry name="BlockSize" type="Int">
<default>40</default>

View File

@ -48,6 +48,7 @@ FlipSwitchEffect::FlipSwitchEffect()
, m_hasKeyboardGrab(false)
, m_captionFrame(NULL)
{
initConfig<FlipSwitchConfig>();
reconfigure(ReconfigureAll);
// Caption frame

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-FlipSwitch">
<entry name="TabBox" type="Bool">
<default>false</default>

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "flipswitch_config.h"
// KConfigSkeleton
#include "flipswitchconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -69,6 +70,7 @@ FlipSwitchEffectConfig::FlipSwitchEffectConfig(QWidget* parent, const QVariantLi
m_ui->shortcutEditor->addCollection(m_actionCollection);
FlipSwitchConfig::instance(KWIN_CONFIG);
addConfig(FlipSwitchConfig::self(), m_ui);
load();

View File

@ -36,6 +36,7 @@ static const int IsGlideWindow = 0x22A982D4;
GlideEffect::GlideEffect()
: Effect()
{
initConfig<GlideConfig>();
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Glide">
<entry name="Duration" type="UInt">
<default>0</default>

View File

@ -21,6 +21,7 @@
#include "glide_config.h"
// KConfigSkeleton
#include "glideconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <KAboutData>
@ -37,6 +38,7 @@ GlideEffectConfig::GlideEffectConfig(QWidget *parent, const QVariantList &args)
: KCModule(KAboutData::pluginData(QStringLiteral("glide")), parent, args)
{
ui.setupUi(this);
GlideConfig::instance(KWIN_CONFIG);
addConfig(GlideConfig::self(), this);
load();
}

View File

@ -55,6 +55,7 @@ KscreenEffect::KscreenEffect()
, m_state(StateNormal)
, m_atom(effects->announceSupportProperty("_KDE_KWIN_KSCREEN_SUPPORT", this))
{
initConfig<KscreenConfig>();
connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), SLOT(propertyNotify(KWin::EffectWindow*,long)));
reconfigure(ReconfigureAll);
}

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Kscreen">
<entry name="Duration" type="Int">
<default>0</default>

View File

@ -52,6 +52,7 @@ LookingGlassEffect::LookingGlassEffect()
, m_enabled(false)
, m_valid(false)
{
initConfig<LookingGlassConfig>();
QAction* a;
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-LookingGlass">
<entry name="Radius" type="UInt">
<default>200</default>

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "lookingglassconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -58,6 +59,7 @@ LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVaria
layout->addWidget(m_ui);
LookingGlassConfig::instance(KWIN_CONFIG);
addConfig(LookingGlassConfig::self(), m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));

View File

@ -34,6 +34,7 @@ namespace KWin
MagicLampEffect::MagicLampEffect()
{
initConfig<MagicLampConfig>();
mActiveAnimations = 0;
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-MagicLamp">
<entry name="AnimationDuration" type="Int">
<default>0</default>

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "magiclamp_config.h"
// KConfigSkeleton
#include "magiclampconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
@ -50,6 +51,7 @@ MagicLampEffectConfig::MagicLampEffectConfig(QWidget* parent, const QVariantList
layout->addWidget(m_ui);
MagicLampConfig::instance(KWIN_CONFIG);
addConfig(MagicLampConfig::self(), m_ui);
load();

View File

@ -50,6 +50,7 @@ MagnifierEffect::MagnifierEffect()
, m_pixmap(XCB_PIXMAP_NONE)
#endif
{
initConfig<MagnifierConfig>();
QAction* a;
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Magnifier">
<entry name="Width" type="UInt">
<default>200</default>

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "magnifier_config.h"
// KConfigSkeleton
#include "magnifierconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -57,6 +58,7 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList
layout->addWidget(m_ui);
MagnifierConfig::instance(KWIN_CONFIG);
addConfig(MagnifierConfig::self(), m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));

View File

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

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-MouseClick">
<entry name="Color1" type="Color">
<default code="true">QColor(Qt::red)</default>

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "mouseclick_config.h"
// KConfigSkeleton
#include "mouseclickconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -67,6 +68,7 @@ MouseClickEffectConfig::MouseClickEffectConfig(QWidget* parent, const QVariantLi
m_ui->editor->addCollection(m_actionCollection);
MouseClickConfig::instance(KWIN_CONFIG);
addConfig(MouseClickConfig::self(), m_ui);
load();
}

View File

@ -46,6 +46,7 @@ namespace KWin
MouseMarkEffect::MouseMarkEffect()
{
initConfig<MouseMarkConfig>();
QAction* a = new QAction(this);
a->setObjectName(QStringLiteral("ClearMouseMarks"));
a->setText(i18n("Clear All Mouse Marks"));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-MouseMark">
<entry name="LineWidth" type="UInt">
<default>3</default>

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "mousemarkconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -58,6 +59,7 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
layout->addWidget(m_ui);
MouseMarkConfig::instance(KWIN_CONFIG);
addConfig(MouseMarkConfig::self(), m_ui);
// Shortcut config. The shortcut belongs to the component "kwin"!

View File

@ -65,6 +65,7 @@ PresentWindowsEffect::PresentWindowsEffect()
, m_exposeAllAction(new QAction(this))
, m_exposeClassAction(new QAction(this))
{
initConfig<PresentWindowsConfig>();
m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this);
m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this);

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-PresentWindows">
<entry name="LayoutMode" type="Int">
<default>0</default>

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "presentwindows_config.h"
// KConfigSkeleton
#include "presentwindowsconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -84,6 +85,7 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
connect(m_ui->shortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
PresentWindowsConfig::instance(KWIN_CONFIG);
addConfig(PresentWindowsConfig::self(), m_ui);
load();

View File

@ -40,6 +40,7 @@ ResizeEffect::ResizeEffect()
, m_active(false)
, m_resizeWindow(0)
{
initConfig<ResizeConfig>();
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect)));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Resize">
<entry name="TextureScale" type="Bool">
<default>true</default>

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "resize_config.h"
// KConfigSkeleton
#include "resizeconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <kconfiggroup.h>
@ -49,6 +50,7 @@ ResizeEffectConfig::ResizeEffectConfig(QWidget* parent, const QVariantList& args
layout->addWidget(m_ui);
ResizeConfig::instance(KWIN_CONFIG);
addConfig(ResizeConfig::self(), m_ui);
load();

View File

@ -35,6 +35,7 @@ static const int IsSheetWindow = 0x22A982D5;
SheetEffect::SheetEffect()
{
initConfig<SheetConfig>();
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Sheet">
<entry name="AnimationTime" type="Int">
<default>0</default>

View File

@ -47,6 +47,7 @@ ShowFpsEffect::ShowFpsEffect()
, frames_pos(0)
, m_noBenchmark(effects->effectFrame(EffectFrameUnstyled, false))
{
initConfig<ShowFpsConfig>();
for (int i = 0;
i < NUM_PAINTS;
++i) {

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-ShowFps">
<entry name="TextPosition" type="Int">
<default>0</default>

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "showfpsconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <KLocalizedString>
@ -41,6 +42,7 @@ ShowFpsEffectConfig::ShowFpsEffectConfig(QWidget* parent, const QVariantList& ar
m_ui = new Ui::ShowFpsEffectConfigForm;
m_ui->setupUi(this);
ShowFpsConfig::instance(KWIN_CONFIG);
addConfig(ShowFpsConfig::self(), this);
load();

View File

@ -33,6 +33,7 @@ namespace KWin
SlidingPopupsEffect::SlidingPopupsEffect()
{
initConfig<SlidingPopupsConfig>();
KWayland::Server::Display *display = effects->waylandDisplay();
if (display) {
display->createSlideManager(this)->create();

View File

@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-SlidingPopups">
<entry name="SlideInTime" type="Int">
<default>0</default>

View File

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

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-ThumbnailAside">
<entry name="MaxWidth" type="Int">
<default>200</default>

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "thumbnailaside_config.h"
// KConfigSkeleton
#include "thumbnailasideconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -58,6 +59,7 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
ThumbnailAsideConfig::instance(KWIN_CONFIG);
addConfig(ThumbnailAsideConfig::self(), this);
// Shortcut config. The shortcut belongs to the component "kwin"!

View File

@ -45,6 +45,7 @@ TrackMouseEffect::TrackMouseEffect()
: m_active(false)
, m_angle(0)
{
initConfig<TrackMouseConfig>();
m_texture[0] = m_texture[1] = 0;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
m_picture[0] = m_picture[1] = 0;

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-TrackMouse">
<entry name="Meta" type="Bool">
<default>true</default>

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include <QAction>
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <KLocalizedString>
@ -51,7 +52,7 @@ TrackMouseEffectConfigForm::TrackMouseEffectConfigForm(QWidget* parent) : QWidge
TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(KAboutData::pluginData(QStringLiteral("trackmouse")), parent, args)
{
TrackMouseConfig::instance(KWIN_CONFIG);
m_ui = new TrackMouseEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);

View File

@ -34,6 +34,7 @@ using namespace KWin;
WindowGeometry::WindowGeometry()
{
initConfig<WindowGeometryConfiguration>();
iAmActivated = true;
iAmActive = false;
myResizeWindow = 0L;

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-WindowGeometry">
<entry name="Move" type="Bool">
<default>true</default>

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "windowgeometry_config.h"
// KConfigSkeleton
#include "windowgeometryconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -46,6 +47,7 @@ WindowGeometryConfigForm::WindowGeometryConfigForm(QWidget* parent) : QWidget(pa
WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList& args)
: KCModule(KAboutData::pluginData(QStringLiteral("windowgeometry")), parent, args)
{
WindowGeometryConfiguration::instance(KWIN_CONFIG);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(myUi = new WindowGeometryConfigForm(this));

View File

@ -146,6 +146,7 @@ static const ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 };
WobblyWindowsEffect::WobblyWindowsEffect()
{
initConfig<WobblyWindowsConfig>();
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Wobbly">
<entry name="WobblynessLevel" type="UInt">
<default>0</default>

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "wobblywindows_config.h"
// KConfigSkeleton
#include "wobblywindowsconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <KLocalizedString>
@ -82,6 +83,7 @@ ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 };
WobblyWindowsEffectConfig::WobblyWindowsEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(KAboutData::pluginData(QStringLiteral("wobblywindows")), parent, args)
{
WobblyWindowsConfig::instance(KWIN_CONFIG);
m_ui.setupUi(this);
addConfig(WobblyWindowsConfig::self(), this);

View File

@ -60,6 +60,7 @@ ZoomEffect::ZoomEffect()
, yMove(0)
, moveFactor(20.0)
{
initConfig<ZoomConfig>();
QAction* a = 0;
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<kcfgfile arg="true"/>
<group name="Effect-Zoom">
<entry name="ZoomFactor" type="Double">
<default>1.2</default>

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "zoom_config.h"
// KConfigSkeleton
#include "zoomconfig.h"
#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <QAction>
@ -49,6 +50,7 @@ ZoomEffectConfigForm::ZoomEffectConfigForm(QWidget* parent) : QWidget(parent)
ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(KAboutData::pluginData(QStringLiteral("zoom")), parent, args)
{
ZoomConfig::instance(KWIN_CONFIG);
m_ui = new ZoomEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);

View File

@ -89,7 +89,7 @@ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
include_directories(${glinclude})
add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
generate_export_header(${name} BASE_NAME kwinglutils EXPORT_FILE_NAME kwinglutils_export.h)
target_link_libraries(${name} PUBLIC XCB::XCB KF5::CoreAddons KF5::WindowSystem)
target_link_libraries(${name} PUBLIC XCB::XCB KF5::CoreAddons KF5::ConfigCore KF5::WindowSystem)
set_target_properties(${name} PROPERTIES
VERSION ${KWINEFFECTS_VERSION_STRING}
SOVERSION ${KWINEFFECTS_SOVERSION}

View File

@ -43,6 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QScopedPointer>
#include <KPluginFactory>
#include <KSharedConfig>
#include <assert.h>
#include <limits.h>
@ -665,6 +666,14 @@ public Q_SLOTS:
protected:
xcb_connection_t *xcbConnection() const;
xcb_window_t x11RootWindow() const;
/**
* 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();
};
@ -1291,6 +1300,12 @@ public:
**/
virtual void hideOnScreenMessage(OnScreenMessageHideFlags flags = OnScreenMessageHideFlags()) = 0;
/*
* @returns The configuration used by the EffectsHandler.
* @since 5.10
**/
virtual KSharedConfigPtr config() const = 0;
Q_SIGNALS:
/**
* Signal emitted when the current desktop changed.
@ -3440,6 +3455,12 @@ int Effect::animationTime(int defaultDuration)
return animationTime(T::duration() != 0 ? T::duration() : defaultDuration);
}
template <typename T>
void Effect::initConfig()
{
T::instance(effects->config());
}
} // namespace
Q_DECLARE_METATYPE(KWin::EffectWindow*)
Q_DECLARE_METATYPE(QList<KWin::EffectWindow*>)