diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index a20fa534a7..1104b5fcb8 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -133,32 +133,6 @@ target_link_libraries(testXcbWindow add_test(NAME kwin-testXcbWindow COMMAND testXcbWindow) ecm_mark_as_test(testXcbWindow) -######################################################## -# Test BuiltInEffectLoader -######################################################## -set(testBuiltInEffectLoader_SRCS - ../src/effectloader.cpp - mock_effectshandler.cpp - test_builtin_effectloader.cpp -) -add_executable(testBuiltInEffectLoader ${testBuiltInEffectLoader_SRCS}) -set_target_properties(testBuiltInEffectLoader PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW") - -target_link_libraries(testBuiltInEffectLoader - Qt::Concurrent - Qt::Qml - Qt::Test - Qt::X11Extras - - KF5::Package - - kwineffects - kwin4_effect_builtins -) - -add_test(NAME kwin-testBuiltInEffectLoader COMMAND testBuiltInEffectLoader) -ecm_mark_as_test(testBuiltInEffectLoader) - ######################################################## # Test ScriptedEffectLoader ######################################################## @@ -193,7 +167,6 @@ target_link_libraries(testScriptedEffectLoader XCB::CURSOR kwineffects - kwin4_effect_builtins ) add_test(NAME kwin-testScriptedEffectLoader COMMAND testScriptedEffectLoader) @@ -218,7 +191,6 @@ target_link_libraries(testPluginEffectLoader KF5::Package kwineffects - kwin4_effect_builtins ) add_test(NAME kwin-testPluginEffectLoader COMMAND testPluginEffectLoader) diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt index f560af9f43..3ddccf6f85 100644 --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -44,6 +44,7 @@ add_library(KWinIntegrationTestFramework STATIC ${KWinIntegrationTestFramework_S target_link_libraries(KWinIntegrationTestFramework Qt::Test KF5::WaylandClient + kwin4_effect_builtins kwin Wayland::Client diff --git a/autotests/integration/dont_crash_reinitialize_compositor.cpp b/autotests/integration/dont_crash_reinitialize_compositor.cpp index 3d955e0f05..4fdd41b2f3 100644 --- a/autotests/integration/dont_crash_reinitialize_compositor.cpp +++ b/autotests/integration/dont_crash_reinitialize_compositor.cpp @@ -20,8 +20,6 @@ #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" - #include namespace KWin diff --git a/autotests/integration/effects/desktop_switching_animation_test.cpp b/autotests/integration/effects/desktop_switching_animation_test.cpp index dbb5ea86f2..b89b9518ff 100644 --- a/autotests/integration/effects/desktop_switching_animation_test.cpp +++ b/autotests/integration/effects/desktop_switching_animation_test.cpp @@ -19,8 +19,6 @@ #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" - #include using namespace KWin; diff --git a/autotests/integration/effects/maximize_animation_test.cpp b/autotests/integration/effects/maximize_animation_test.cpp index ac3eb0f532..bfd66cdfec 100644 --- a/autotests/integration/effects/maximize_animation_test.cpp +++ b/autotests/integration/effects/maximize_animation_test.cpp @@ -18,8 +18,6 @@ #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" - #include using namespace KWin; diff --git a/autotests/integration/effects/minimize_animation_test.cpp b/autotests/integration/effects/minimize_animation_test.cpp index eccdd117c4..8861a04ede 100644 --- a/autotests/integration/effects/minimize_animation_test.cpp +++ b/autotests/integration/effects/minimize_animation_test.cpp @@ -18,8 +18,6 @@ #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" - #include #include #include diff --git a/autotests/integration/effects/popup_open_close_animation_test.cpp b/autotests/integration/effects/popup_open_close_animation_test.cpp index aa8707d765..230c9b220b 100644 --- a/autotests/integration/effects/popup_open_close_animation_test.cpp +++ b/autotests/integration/effects/popup_open_close_animation_test.cpp @@ -21,8 +21,6 @@ #include "decorations/decoratedclient.h" -#include "effect_builtins.h" - #include #include diff --git a/autotests/integration/effects/scripted_effects_test.cpp b/autotests/integration/effects/scripted_effects_test.cpp index 9888bff2f3..d88cd13d3a 100644 --- a/autotests/integration/effects/scripted_effects_test.cpp +++ b/autotests/integration/effects/scripted_effects_test.cpp @@ -14,7 +14,6 @@ #include "composite.h" #include "cursor.h" #include "deleted.h" -#include "effect_builtins.h" #include "effectloader.h" #include "effects.h" #include "kwin_wayland_test.h" diff --git a/autotests/integration/effects/slidingpopups_test.cpp b/autotests/integration/effects/slidingpopups_test.cpp index 3326d23fe7..d2c9fa62da 100644 --- a/autotests/integration/effects/slidingpopups_test.cpp +++ b/autotests/integration/effects/slidingpopups_test.cpp @@ -17,7 +17,6 @@ #include "scene.h" #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" #include diff --git a/autotests/integration/effects/toplevel_open_close_animation_test.cpp b/autotests/integration/effects/toplevel_open_close_animation_test.cpp index 9c9c288218..28cae7e39b 100644 --- a/autotests/integration/effects/toplevel_open_close_animation_test.cpp +++ b/autotests/integration/effects/toplevel_open_close_animation_test.cpp @@ -19,8 +19,6 @@ #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" - #include using namespace KWin; diff --git a/autotests/integration/effects/translucency_test.cpp b/autotests/integration/effects/translucency_test.cpp index c4ab2f0f1c..27b822e08a 100644 --- a/autotests/integration/effects/translucency_test.cpp +++ b/autotests/integration/effects/translucency_test.cpp @@ -15,7 +15,6 @@ #include "platform.h" #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" #include diff --git a/autotests/integration/effects/windowgeometry_test.cpp b/autotests/integration/effects/windowgeometry_test.cpp index ca3e19de18..cd5e51c66b 100644 --- a/autotests/integration/effects/windowgeometry_test.cpp +++ b/autotests/integration/effects/windowgeometry_test.cpp @@ -15,7 +15,6 @@ #include "platform.h" #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" #include @@ -53,7 +52,7 @@ void WindowGeometryTest::initTestCase() for (QString name : builtinNames) { plugins.writeEntry(name + QStringLiteral("Enabled"), false); } - plugins.writeEntry(BuiltInEffects::nameForEffect(BuiltInEffect::WindowGeometry) + QStringLiteral("Enabled"), true); + plugins.writeEntry(QStringLiteral("windowgeometryEnabled"), true); config->sync(); kwinApp()->setConfig(config); @@ -78,7 +77,7 @@ void WindowGeometryTest::testStartup() { // just a test to load the effect to verify it doesn't crash EffectsHandlerImpl *e = static_cast(effects); - QVERIFY(e->isEffectLoaded(BuiltInEffects::nameForEffect(BuiltInEffect::WindowGeometry))); + QVERIFY(e->isEffectLoaded(QStringLiteral("windowgeometry"))); } WAYLANDTEST_MAIN(WindowGeometryTest) diff --git a/autotests/integration/effects/wobbly_shade_test.cpp b/autotests/integration/effects/wobbly_shade_test.cpp index 84eaf26d06..14d8e28e67 100644 --- a/autotests/integration/effects/wobbly_shade_test.cpp +++ b/autotests/integration/effects/wobbly_shade_test.cpp @@ -15,7 +15,6 @@ #include "platform.h" #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" #include @@ -98,8 +97,8 @@ void WobblyWindowsShadeTest::testShadeMove() { // this test simulates the condition from BUG 390953 EffectsHandlerImpl *e = static_cast(effects); - QVERIFY(e->loadEffect(BuiltInEffects::nameForEffect(BuiltInEffect::WobblyWindows))); - QVERIFY(e->isEffectLoaded(BuiltInEffects::nameForEffect(BuiltInEffect::WobblyWindows))); + QVERIFY(e->loadEffect(QStringLiteral("wobblywindows"))); + QVERIFY(e->isEffectLoaded(QStringLiteral("wobblywindows"))); QScopedPointer c(xcb_connect(nullptr, nullptr)); diff --git a/autotests/integration/generic_scene_opengl_test.cpp b/autotests/integration/generic_scene_opengl_test.cpp index 0f1d925aa2..47ebbf0785 100644 --- a/autotests/integration/generic_scene_opengl_test.cpp +++ b/autotests/integration/generic_scene_opengl_test.cpp @@ -14,7 +14,6 @@ #include "platform.h" #include "scene.h" #include "wayland_server.h" -#include "effect_builtins.h" #include diff --git a/autotests/integration/kwin_wayland_test.cpp b/autotests/integration/kwin_wayland_test.cpp index 60a6872d1b..db149fdff9 100644 --- a/autotests/integration/kwin_wayland_test.cpp +++ b/autotests/integration/kwin_wayland_test.cpp @@ -9,6 +9,7 @@ #include "kwin_wayland_test.h" #include "composite.h" +#include "effect_builtins.h" #include "effects.h" #include "inputmethod.h" #include "platform.h" @@ -37,6 +38,8 @@ Q_IMPORT_PLUGIN(KGlobalAccelImpl) Q_IMPORT_PLUGIN(KWindowSystemKWinPlugin) Q_IMPORT_PLUGIN(KWinIdleTimePoller) +KWIN_IMPORT_BUILTIN_EFFECTS + namespace KWin { diff --git a/autotests/integration/scene_qpainter_test.cpp b/autotests/integration/scene_qpainter_test.cpp index f409f6ccc4..d2ff495efa 100644 --- a/autotests/integration/scene_qpainter_test.cpp +++ b/autotests/integration/scene_qpainter_test.cpp @@ -14,7 +14,6 @@ #include "effects.h" #include "platform.h" #include "wayland_server.h" -#include "effect_builtins.h" #include "workspace.h" #include diff --git a/autotests/integration/screenedges_test.cpp b/autotests/integration/screenedges_test.cpp index 9027fda4ff..9429b87d39 100644 --- a/autotests/integration/screenedges_test.cpp +++ b/autotests/integration/screenedges_test.cpp @@ -19,8 +19,6 @@ #include "wayland_server.h" #include "workspace.h" -#include "effect_builtins.h" - #include #include diff --git a/autotests/integration/scripting/screenedge_test.cpp b/autotests/integration/scripting/screenedge_test.cpp index f5ae800f60..b56db8a985 100644 --- a/autotests/integration/scripting/screenedge_test.cpp +++ b/autotests/integration/scripting/screenedge_test.cpp @@ -13,7 +13,6 @@ #include "wayland_server.h" #include "workspace.h" #include "scripting/scripting.h" -#include "effect_builtins.h" #define private public #include "screenedge.h" diff --git a/autotests/test_builtin_effectloader.cpp b/autotests/test_builtin_effectloader.cpp deleted file mode 100644 index 905ea07f75..0000000000 --- a/autotests/test_builtin_effectloader.cpp +++ /dev/null @@ -1,534 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2014 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#include "effectloader.h" -#include "effects/effect_builtins.h" -#include "mock_effectshandler.h" -#include "scripting/scriptedeffect.h" // for mocking ScriptedEffect::create -#include "testutils.h" -// KDE -#include -#include -// Qt -#include -#include -#include -Q_DECLARE_METATYPE(KWin::CompositingType) -Q_DECLARE_METATYPE(KWin::LoadEffectFlag) -Q_DECLARE_METATYPE(KWin::LoadEffectFlags) -Q_DECLARE_METATYPE(KWin::BuiltInEffect) -Q_DECLARE_METATYPE(KWin::Effect*) - -Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core") - -namespace KWin -{ - -ScriptedEffect *ScriptedEffect::create(const KPluginMetaData&) -{ - return nullptr; -} - -bool ScriptedEffect::supported() -{ - return true; -} - -} - -class TestBuiltInEffectLoader : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void initTestCase(); - void testHasEffect_data(); - void testHasEffect(); - void testKnownEffects(); - void testSupported_data(); - void testSupported(); - void testLoadEffect_data(); - void testLoadEffect(); - void testLoadBuiltInEffect_data(); - void testLoadBuiltInEffect(); - void testLoadAllEffects(); -}; - -void TestBuiltInEffectLoader::initTestCase() -{ - qApp->setProperty("x11Connection", QVariant::fromValue(QX11Info::connection())); -} - -void TestBuiltInEffectLoader::testHasEffect_data() -{ - QTest::addColumn("name"); - QTest::addColumn("expected"); - - QTest::newRow("blur") << QStringLiteral("blur") << true; - QTest::newRow("with kwin4_effect_ prefix") << QStringLiteral("kwin4_effect_blur") << false; - QTest::newRow("case sensitive") << QStringLiteral("BlUR") << true; - QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << true; - QTest::newRow("Contrast") << QStringLiteral("contrast") << true; - QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true; - QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true; - QTest::newRow("FallApart") << QStringLiteral("fallapart") << true; - QTest::newRow("Glide") << QStringLiteral("glide") << true; - QTest::newRow("HighlightWindow") << QStringLiteral("highlightwindow") << true; - QTest::newRow("Invert") << QStringLiteral("invert") << true; - QTest::newRow("Kscreen") << QStringLiteral("kscreen") << true; - QTest::newRow("LookingGlass") << QStringLiteral("lookingglass") << true; - QTest::newRow("MagicLamp") << QStringLiteral("magiclamp") << true; - QTest::newRow("Magnifier") << QStringLiteral("magnifier") << true; - QTest::newRow("MouseClick") << QStringLiteral("mouseclick") << true; - QTest::newRow("MouseMark") << QStringLiteral("mousemark") << true; - QTest::newRow("PresentWindows") << QStringLiteral("presentwindows") << true; - QTest::newRow("Resize") << QStringLiteral("resize") << true; - QTest::newRow("ScreenEdge") << QStringLiteral("screenedge") << true; - QTest::newRow("ScreenShot") << QStringLiteral("screenshot") << true; - QTest::newRow("Sheet") << QStringLiteral("sheet") << true; - QTest::newRow("ShowFps") << QStringLiteral("showfps") << true; - QTest::newRow("ShowPaint") << QStringLiteral("showpaint") << true; - QTest::newRow("Slide") << QStringLiteral("slide") << true; - QTest::newRow("SlideBack") << QStringLiteral("slideback") << true; - QTest::newRow("SlidingPopups") << QStringLiteral("slidingpopups") << true; - QTest::newRow("SnapHelper") << QStringLiteral("snaphelper") << true; - QTest::newRow("StartupFeedback") << QStringLiteral("startupfeedback") << true; - QTest::newRow("ThumbnailAside") << QStringLiteral("thumbnailaside") << true; - QTest::newRow("Touchpoints") << QStringLiteral("touchpoints") << true; - QTest::newRow("TrackMouse") << QStringLiteral("trackmouse") << true; - QTest::newRow("WindowGeometry") << QStringLiteral("windowgeometry") << true; - QTest::newRow("WobblyWindows") << QStringLiteral("wobblywindows") << true; - QTest::newRow("Zoom") << QStringLiteral("zoom") << true; - QTest::newRow("Non Existing") << QStringLiteral("InvalidName") << false; - QTest::newRow("Fade - Scripted") << QStringLiteral("fade") << false; - QTest::newRow("Fade - Scripted + kwin4_effect") << QStringLiteral("kwin4_effect_fade") << false; -} - -void TestBuiltInEffectLoader::testHasEffect() -{ - QFETCH(QString, name); - QFETCH(bool, expected); - - KWin::BuiltInEffectLoader loader; - QCOMPARE(loader.hasEffect(name), expected); -} - -void TestBuiltInEffectLoader::testKnownEffects() -{ - QStringList expectedEffects; - expectedEffects << QStringLiteral("blur") - << QStringLiteral("colorpicker") - << QStringLiteral("contrast") - << QStringLiteral("desktopgrid") - << QStringLiteral("diminactive") - << QStringLiteral("fallapart") - << QStringLiteral("glide") - << QStringLiteral("highlightwindow") - << QStringLiteral("invert") - << QStringLiteral("kscreen") - << QStringLiteral("lookingglass") - << QStringLiteral("magiclamp") - << QStringLiteral("magnifier") - << QStringLiteral("mouseclick") - << QStringLiteral("mousemark") - << QStringLiteral("overview") - << QStringLiteral("presentwindows") - << QStringLiteral("resize") - << QStringLiteral("screenedge") - << QStringLiteral("screenshot") - << QStringLiteral("screentransform") - << QStringLiteral("sheet") - << QStringLiteral("showfps") - << QStringLiteral("showpaint") - << QStringLiteral("slide") - << QStringLiteral("slideback") - << QStringLiteral("slidingpopups") - << QStringLiteral("snaphelper") - << QStringLiteral("startupfeedback") - << QStringLiteral("thumbnailaside") - << QStringLiteral("touchpoints") - << QStringLiteral("trackmouse") - << QStringLiteral("windowgeometry") - << QStringLiteral("wobblywindows") - << QStringLiteral("zoom"); - - KWin::BuiltInEffectLoader loader; - QStringList result = loader.listOfKnownEffects(); - QCOMPARE(result.size(), expectedEffects.size()); - std::sort(result.begin(), result.end()); - for (int i = 0; i < expectedEffects.size(); ++i) { - QCOMPARE(result.at(i), expectedEffects.at(i)); - } -} - -void TestBuiltInEffectLoader::testSupported_data() -{ - QTest::addColumn("name"); - QTest::addColumn("expected"); - QTest::addColumn("type"); - QTest::addColumn("animationsSupported"); - - const KWin::CompositingType qc = KWin::QPainterCompositing; - const KWin::CompositingType oc = KWin::OpenGLCompositing; - - QTest::newRow("blur") << QStringLiteral("blur") << false << qc << true; - // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL - QTest::newRow("blur-GL") << QStringLiteral("blur") << false << oc << true; - QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << false << qc << true; - QTest::newRow("Colorpicker-GL") << QStringLiteral("colorpicker") << true << oc << true; - QTest::newRow("Contrast") << QStringLiteral("contrast") << false << qc << true; - // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL - QTest::newRow("Contrast-GL") << QStringLiteral("contrast") << false << oc << true; - QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << qc << true; - QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << qc << true; - QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << qc << true; - QTest::newRow("FallApart-GL") << QStringLiteral("fallapart") << true << oc << true; - QTest::newRow("Glide") << QStringLiteral("glide") << false << qc << true; - QTest::newRow("Glide-GL") << QStringLiteral("glide") << true << oc << true; - QTest::newRow("Glide-GL-no-anim") << QStringLiteral("glide") << false << oc << false; - QTest::newRow("HighlightWindow") << QStringLiteral("highlightwindow") << true << qc << true; - QTest::newRow("Invert") << QStringLiteral("invert") << false << qc << true; - QTest::newRow("Invert-GL") << QStringLiteral("invert") << true << oc << true; - QTest::newRow("Kscreen") << QStringLiteral("kscreen") << true << qc << true; - QTest::newRow("LookingGlass") << QStringLiteral("lookingglass") << false << qc << true; - // Tries to create an opengl texture and crashes. -// QTest::newRow("LookingGlass-GL") << QStringLiteral("lookingglass") << true << oc << true; - QTest::newRow("MagicLamp") << QStringLiteral("magiclamp") << false << qc << true; - QTest::newRow("MagicLamp-GL") << QStringLiteral("magiclamp") << true << oc << true; - QTest::newRow("MagicLamp-GL-no-anim") << QStringLiteral("magiclamp") << false << oc << false; - QTest::newRow("Magnifier") << QStringLiteral("magnifier") << false << qc << false; - QTest::newRow("MouseClick") << QStringLiteral("mouseclick") << true << qc << true; - QTest::newRow("MouseMark") << QStringLiteral("mousemark") << true << qc << true; - QTest::newRow("Overview") << QStringLiteral("overview") << false << qc << false; - QTest::newRow("OverviewGL") << QStringLiteral("overview") << true << oc << true; - QTest::newRow("PresentWindows") << QStringLiteral("presentwindows") << true << qc << true; - QTest::newRow("Resize") << QStringLiteral("resize") << true << qc << true; - QTest::newRow("ScreenEdge") << QStringLiteral("screenedge") << true << qc << true; - QTest::newRow("ScreenShot") << QStringLiteral("screenshot") << false << qc << false; - QTest::newRow("Sheet") << QStringLiteral("sheet") << false << qc << true; - QTest::newRow("Sheet-GL") << QStringLiteral("sheet") << true << oc << true; - QTest::newRow("Sheet-GL-no-anim") << QStringLiteral("sheet") << false << oc << false; - QTest::newRow("ShowFps") << QStringLiteral("showfps") << true << qc << true; - QTest::newRow("ShowPaint") << QStringLiteral("showpaint") << true << qc << true; - QTest::newRow("Slide") << QStringLiteral("slide") << true << qc << true; - QTest::newRow("SlideBack") << QStringLiteral("slideback") << true << qc << true; - QTest::newRow("SlidingPopups") << QStringLiteral("slidingpopups") << true << qc << true; - QTest::newRow("SnapHelper") << QStringLiteral("snaphelper") << true << qc << true; - QTest::newRow("StartupFeedback") << QStringLiteral("startupfeedback") << false << qc << true; - QTest::newRow("StartupFeedback-GL") << QStringLiteral("startupfeedback") << true << oc << true; - QTest::newRow("ThumbnailAside") << QStringLiteral("thumbnailaside") << true << qc << true; - QTest::newRow("TouchPoints") << QStringLiteral("touchpoints") << true << qc << true; - QTest::newRow("TrackMouse") << QStringLiteral("trackmouse") << true << qc << true; - QTest::newRow("WindowGeometry") << QStringLiteral("windowgeometry") << true << qc << true; - QTest::newRow("WobblyWindows") << QStringLiteral("wobblywindows") << false << qc << true; - QTest::newRow("WobblyWindows-GL") << QStringLiteral("wobblywindows") << true << oc << true; - QTest::newRow("WobblyWindows-GL-no-anim") << QStringLiteral("wobblywindows") << false << oc << false; - QTest::newRow("Zoom") << QStringLiteral("zoom") << true << qc << true; - QTest::newRow("Non Existing") << QStringLiteral("InvalidName") << false << qc << true; - QTest::newRow("Fade - Scripted") << QStringLiteral("fade") << false << qc << true; - QTest::newRow("Fade - Scripted + kwin4_effect") << QStringLiteral("kwin4_effect_fade") << false << qc << true; -} - -void TestBuiltInEffectLoader::testSupported() -{ - QFETCH(QString, name); - QFETCH(bool, expected); - QFETCH(KWin::CompositingType, type); - QFETCH(bool, animationsSupported); - - MockEffectsHandler mockHandler(type); - mockHandler.setAnimationsSupported(animationsSupported); - QCOMPARE(mockHandler.animationsSupported(), animationsSupported); - KWin::BuiltInEffectLoader loader; - QCOMPARE(loader.isEffectSupported(name), expected); -} - -void TestBuiltInEffectLoader::testLoadEffect_data() -{ - QTest::addColumn("name"); - QTest::addColumn("expected"); - QTest::addColumn("type"); - - const KWin::CompositingType qc = KWin::QPainterCompositing; - const KWin::CompositingType oc = KWin::OpenGLCompositing; - - QTest::newRow("blur") << QStringLiteral("blur") << false << qc; - // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL - QTest::newRow("blur-GL") << QStringLiteral("blur") << false << oc; - QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << false << qc; - QTest::newRow("Colorpicker-GL") << QStringLiteral("colorpicker") << true << oc; - QTest::newRow("Contrast") << QStringLiteral("contrast") << false << qc; - // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL - QTest::newRow("Contrast-GL") << QStringLiteral("contrast") << false << oc; - QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << qc; - QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << qc; - QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << qc; - QTest::newRow("FallApart-GL") << QStringLiteral("fallapart") << true << oc; - QTest::newRow("Glide") << QStringLiteral("glide") << false << qc; - QTest::newRow("Glide-GL") << QStringLiteral("glide") << true << oc; - QTest::newRow("HighlightWindow") << QStringLiteral("highlightwindow") << true << qc; - QTest::newRow("Invert") << QStringLiteral("invert") << false << qc; - QTest::newRow("Invert-GL") << QStringLiteral("invert") << true << oc; - QTest::newRow("Kscreen") << QStringLiteral("kscreen") << true << qc; - QTest::newRow("LookingGlass") << QStringLiteral("lookingglass") << false << qc; - // Tries to create an opengl texture and crashes. -// QTest::newRow("LookingGlass-GL") << QStringLiteral("lookingglass") << true << oc; - QTest::newRow("MagicLamp") << QStringLiteral("magiclamp") << false << qc; - QTest::newRow("MagicLamp-GL") << QStringLiteral("magiclamp") << true << oc; - QTest::newRow("Magnifier") << QStringLiteral("magnifier") << false << qc; - QTest::newRow("MouseClick") << QStringLiteral("mouseclick") << true << qc; - QTest::newRow("MouseMark") << QStringLiteral("mousemark") << true << qc; - QTest::newRow("Overview") << QStringLiteral("overview") << false << qc; - QTest::newRow("OverviewGL") << QStringLiteral("overview") << true << oc; - QTest::newRow("PresentWindows") << QStringLiteral("presentwindows") << true << qc; - QTest::newRow("Resize") << QStringLiteral("resize") << true << qc; - QTest::newRow("ScreenEdge") << QStringLiteral("screenedge") << true << qc; - QTest::newRow("ScreenShot") << QStringLiteral("screenshot") << false << qc; - QTest::newRow("Sheet") << QStringLiteral("sheet") << false << qc; - QTest::newRow("Sheet-GL") << QStringLiteral("sheet") << true << oc; - // TODO: Accesses EffectFrame and crashes -// QTest::newRow("ShowFps") << QStringLiteral("showfps") << true << xc; - QTest::newRow("ShowPaint") << QStringLiteral("showpaint") << true << qc; - QTest::newRow("Slide") << QStringLiteral("slide") << true << qc; - QTest::newRow("SlideBack") << QStringLiteral("slideback") << true << qc; - QTest::newRow("SlidingPopups") << QStringLiteral("slidingpopups") << true << qc; - QTest::newRow("SnapHelper") << QStringLiteral("snaphelper") << true << qc; - QTest::newRow("StartupFeedback") << QStringLiteral("startupfeedback") << false << qc; - // Tries to load shader and makes our test abort -// QTest::newRow("StartupFeedback-GL") << QStringLiteral("startupfeedback") << true << oc; - QTest::newRow("ThumbnailAside") << QStringLiteral("thumbnailaside") << true << qc; - QTest::newRow("Touchpoints") << QStringLiteral("touchpoints") << true << qc; - QTest::newRow("TrackMouse") << QStringLiteral("trackmouse") << true << qc; - // TODO: Accesses EffectFrame and crashes -// QTest::newRow("WindowGeometry") << QStringLiteral("windowgeometry") << true << xc; - QTest::newRow("WobblyWindows") << QStringLiteral("wobblywindows") << false << qc; - QTest::newRow("WobblyWindows-GL") << QStringLiteral("wobblywindows") << true << oc; - QTest::newRow("Zoom") << QStringLiteral("zoom") << true << qc; - QTest::newRow("Non Existing") << QStringLiteral("InvalidName") << false << qc; - QTest::newRow("Fade - Scripted") << QStringLiteral("fade") << false << qc; - QTest::newRow("Fade - Scripted + kwin4_effect") << QStringLiteral("kwin4_effect_fade") << false << qc; -} - -void TestBuiltInEffectLoader::testLoadEffect() -{ - QFETCH(QString, name); - QFETCH(bool, expected); - QFETCH(KWin::CompositingType, type); - - QScopedPointer mockHandler(new MockEffectsHandler(type)); - KWin::BuiltInEffectLoader loader; - KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); - loader.setConfig(config); - - qRegisterMetaType(); - QSignalSpy spy(&loader, &KWin::BuiltInEffectLoader::effectLoaded); - // connect to signal to ensure that we delete the Effect again as the Effect doesn't have a parent - connect(&loader, &KWin::BuiltInEffectLoader::effectLoaded, - [&name](KWin::Effect *effect, const QString &effectName) { - QCOMPARE(effectName, name); - effect->deleteLater(); - } - ); - // try to load the Effect - QCOMPARE(loader.loadEffect(name), expected); - // loading again should fail - QVERIFY(!loader.loadEffect(name)); - // signal spy should have got the signal if it was expected - QCOMPARE(spy.isEmpty(), !expected); - if (!spy.isEmpty()) { - QCOMPARE(spy.count(), 1); - // if we caught a signal it should have the effect name we passed in - QList arguments = spy.takeFirst(); - QCOMPARE(arguments.count(), 2); - QCOMPARE(arguments.at(1).toString(), name); - } - spy.clear(); - QVERIFY(spy.isEmpty()); - - // now if we wait for the events being processed, the effect will get deleted and it should load again - QTest::qWait(1); - QCOMPARE(loader.loadEffect(name), expected); - // signal spy should have got the signal if it was expected - QCOMPARE(spy.isEmpty(), !expected); - if (!spy.isEmpty()) { - QCOMPARE(spy.count(), 1); - // if we caught a signal it should have the effect name we passed in - QList arguments = spy.takeFirst(); - QCOMPARE(arguments.count(), 2); - QCOMPARE(arguments.at(1).toString(), name); - } -} - -void TestBuiltInEffectLoader::testLoadBuiltInEffect_data() -{ - // TODO: this test cannot yet test the checkEnabledByDefault functionality as that requires - // mocking enough of GL to get the blur effect to think it's supported and enabled by default - QTest::addColumn("effect"); - QTest::addColumn("name"); - QTest::addColumn("expected"); - QTest::addColumn("type"); - QTest::addColumn("loadFlags"); - - const KWin::CompositingType qc = KWin::QPainterCompositing; - const KWin::CompositingType oc = KWin::OpenGLCompositing; - - const KWin::LoadEffectFlags checkDefault = KWin::LoadEffectFlag::Load | KWin::LoadEffectFlag::CheckDefaultFunction; - const KWin::LoadEffectFlags forceFlags = KWin::LoadEffectFlag::Load; - const KWin::LoadEffectFlags dontLoadFlags = KWin::LoadEffectFlags(); - - // enabled by default, but not supported - QTest::newRow("blur") << KWin::BuiltInEffect::Blur << QStringLiteral("blur") << false << oc << checkDefault; - // enabled by default - QTest::newRow("HighlightWindow") << KWin::BuiltInEffect::HighlightWindow << QStringLiteral("highlightwindow") << true << qc << checkDefault; - // supported but not enabled by default - QTest::newRow("LookingGlass") << KWin::BuiltInEffect::LookingGlass << QStringLiteral("lookingglass") << false << qc << checkDefault; - // not enabled by default - QTest::newRow("MouseClick") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << true << qc << checkDefault; - // Force an Effect which will load - QTest::newRow("MouseClick-Force") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << true << qc << forceFlags; - // Force an Effect which is not supported - QTest::newRow("LookingGlass-Force") << KWin::BuiltInEffect::LookingGlass << QStringLiteral("lookingglass") << false << qc << forceFlags; - // Force the Effect as supported - // Enforce no load of effect which is enabled by default - QTest::newRow("HighlightWindow-DontLoad") << KWin::BuiltInEffect::HighlightWindow << QStringLiteral("highlightwindow") << false << qc << dontLoadFlags; - // Enforce no load of effect which is not enabled by default, but enforced - QTest::newRow("MouseClick-DontLoad") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << false << qc << dontLoadFlags; -} - -void TestBuiltInEffectLoader::testLoadBuiltInEffect() -{ - QFETCH(KWin::BuiltInEffect, effect); - QFETCH(QString, name); - QFETCH(bool, expected); - QFETCH(KWin::CompositingType, type); - QFETCH(KWin::LoadEffectFlags, loadFlags); - - QScopedPointer mockHandler(new MockEffectsHandler(type)); - KWin::BuiltInEffectLoader loader; - KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); - loader.setConfig(config); - - qRegisterMetaType(); - QSignalSpy spy(&loader, &KWin::BuiltInEffectLoader::effectLoaded); - // connect to signal to ensure that we delete the Effect again as the Effect doesn't have a parent - connect(&loader, &KWin::BuiltInEffectLoader::effectLoaded, - [&name](KWin::Effect *effect, const QString &effectName) { - QCOMPARE(effectName, name); - effect->deleteLater(); - } - ); - // try to load the Effect - QCOMPARE(loader.loadEffect(effect, loadFlags), expected); - // loading again should fail - QVERIFY(!loader.loadEffect(effect, loadFlags)); - - // signal spy should have got the signal if it was expected - QCOMPARE(spy.isEmpty(), !expected); - if (!spy.isEmpty()) { - QCOMPARE(spy.count(), 1); - // if we caught a signal it should have the effect name we passed in - QList arguments = spy.takeFirst(); - QCOMPARE(arguments.count(), 2); - QCOMPARE(arguments.at(1).toString(), name); - } - spy.clear(); - QVERIFY(spy.isEmpty()); - - // now if we wait for the events being processed, the effect will get deleted and it should load again - QTest::qWait(1); - QCOMPARE(loader.loadEffect(effect, loadFlags), expected); - // signal spy should have got the signal if it was expected - QCOMPARE(spy.isEmpty(), !expected); - if (!spy.isEmpty()) { - QCOMPARE(spy.count(), 1); - // if we caught a signal it should have the effect name we passed in - QList arguments = spy.takeFirst(); - QCOMPARE(arguments.count(), 2); - QCOMPARE(arguments.at(1).toString(), name); - } -} - -void TestBuiltInEffectLoader::testLoadAllEffects() -{ - QScopedPointermockHandler(new MockEffectsHandler(KWin::QPainterCompositing)); - KWin::BuiltInEffectLoader loader; - - KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); - - // prepare the configuration to hard enable/disable the effects we want to load - KConfigGroup plugins = config->group("Plugins"); - plugins.writeEntry(QStringLiteral("desktopgridEnabled"), false); - plugins.writeEntry(QStringLiteral("highlightwindowEnabled"), false); - plugins.writeEntry(QStringLiteral("kscreenEnabled"), false); - plugins.writeEntry(QStringLiteral("presentwindowsEnabled"), false); - plugins.writeEntry(QStringLiteral("screenedgeEnabled"), false); - plugins.writeEntry(QStringLiteral("screenshotEnabled"), false); - plugins.writeEntry(QStringLiteral("slideEnabled"), false); - plugins.writeEntry(QStringLiteral("slidingpopupsEnabled"), false); - plugins.writeEntry(QStringLiteral("startupfeedbackEnabled"), false); - plugins.writeEntry(QStringLiteral("zoomEnabled"), false); - // enable lookingglass as it's not supported - plugins.writeEntry(QStringLiteral("lookingglassEnabled"), true); - plugins.sync(); - - loader.setConfig(config); - - qRegisterMetaType(); - QSignalSpy spy(&loader, &KWin::BuiltInEffectLoader::effectLoaded); - // connect to signal to ensure that we delete the Effect again as the Effect doesn't have a parent - connect(&loader, &KWin::BuiltInEffectLoader::effectLoaded, - [](KWin::Effect *effect) { - effect->deleteLater(); - } - ); - - // the config is prepared so that no Effect gets loaded! - loader.queryAndLoadAll(); - - // we need to wait some time because it's queued - QVERIFY(!spy.wait(10)); - - // now let's prepare a config which has one effect explicitly enabled - plugins.writeEntry(QStringLiteral("mouseclickEnabled"), true); - plugins.sync(); - - loader.queryAndLoadAll(); - // should load one effect in first go - QVERIFY(spy.wait(10)); - // and afterwards it should not load another one - QVERIFY(!spy.wait(10)); - - QCOMPARE(spy.size(), 1); - // if we caught a signal it should have the effect name we passed in - QList arguments = spy.takeFirst(); - QCOMPARE(arguments.count(), 2); - QCOMPARE(arguments.at(1).toString(), QStringLiteral("mouseclick")); - spy.clear(); - - // let's delete one of the default entries - plugins.deleteEntry(QStringLiteral("kscreenEnabled")); - plugins.sync(); - - QVERIFY(spy.isEmpty()); - loader.queryAndLoadAll(); - - // let's use qWait as we need to wait for two signals to be emitted - QTest::qWait(100); - QCOMPARE(spy.size(), 2); - QStringList loadedEffects; - for (auto &list : spy) { - QCOMPARE(list.size(), 2); - loadedEffects << list.at(1).toString(); - } - std::sort(loadedEffects.begin(), loadedEffects.end()); - QCOMPARE(loadedEffects.at(0), QStringLiteral("kscreen")); - QCOMPARE(loadedEffects.at(1), QStringLiteral("mouseclick")); -} - -Q_CONSTRUCTOR_FUNCTION(forceXcb) -QTEST_MAIN(TestBuiltInEffectLoader) -#include "test_builtin_effectloader.moc" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 012609af28..9031400efc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -184,7 +184,6 @@ set_target_properties(kwin PROPERTIES ) target_link_libraries(kwin - kwin4_effect_builtins kwineffects kwinglutils @@ -266,7 +265,12 @@ qt5_generate_dbus_interface(virtualkeyboard_dbus.h org.kde.kwin.VirtualKeyboard. generate_export_header(kwin EXPORT_FILE_NAME kwin_export.h) add_executable(kwin_x11 main_x11.cpp) -target_link_libraries(kwin_x11 kwin KF5::Crash Qt::X11Extras) +target_link_libraries(kwin_x11 + kwin4_effect_builtins + kwin + KF5::Crash + Qt::X11Extras +) install(TARGETS kwin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) install(TARGETS kwin_x11 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) @@ -278,6 +282,7 @@ add_executable(kwin_wayland tabletmodemanager.cpp ) target_link_libraries(kwin_wayland + kwin4_effect_builtins kwin KF5::Crash KWinXwaylandServerModule diff --git a/src/effectloader.cpp b/src/effectloader.cpp index 74c834c89b..2f5adc1e9f 100644 --- a/src/effectloader.cpp +++ b/src/effectloader.cpp @@ -11,7 +11,6 @@ // KWin #include #include -#include "effects/effect_builtins.h" #include "plugin.h" #include "scripting/scriptedeffect.h" #include "utils.h" @@ -64,115 +63,6 @@ LoadEffectFlags AbstractEffectLoader::readConfig(const QString &effectName, bool return LoadEffectFlags(); } -BuiltInEffectLoader::BuiltInEffectLoader(QObject *parent) - : AbstractEffectLoader(parent) - , m_queue(new EffectLoadQueue(this)) -{ -} - -BuiltInEffectLoader::~BuiltInEffectLoader() -{ -} - -bool BuiltInEffectLoader::hasEffect(const QString &name) const -{ - return BuiltInEffects::available(internalName(name)); -} - -bool BuiltInEffectLoader::isEffectSupported(const QString &name) const -{ - return BuiltInEffects::supported(BuiltInEffects::builtInForName(internalName(name))); -} - -QStringList BuiltInEffectLoader::listOfKnownEffects() const -{ - return BuiltInEffects::availableEffectNames(); -} - -bool BuiltInEffectLoader::loadEffect(const QString &name) -{ - return loadEffect(name, BuiltInEffects::builtInForName(internalName(name)), LoadEffectFlag::Load); -} - -void BuiltInEffectLoader::queryAndLoadAll() -{ - const QList effects = BuiltInEffects::availableEffects(); - for (BuiltInEffect effect : effects) { - // check whether it is already loaded - if (m_loadedEffects.contains(effect)) { - continue; - } - const QString key = BuiltInEffects::nameForEffect(effect); - const LoadEffectFlags flags = readConfig(key, BuiltInEffects::enabledByDefault(effect)); - if (flags.testFlag(LoadEffectFlag::Load)) { - m_queue->enqueue(qMakePair(effect, flags)); - } - } -} - -bool BuiltInEffectLoader::loadEffect(BuiltInEffect effect, LoadEffectFlags flags) -{ - return loadEffect(BuiltInEffects::nameForEffect(effect), effect, flags); -} - -bool BuiltInEffectLoader::loadEffect(const QString &name, BuiltInEffect effect, LoadEffectFlags flags) -{ - if (effect == BuiltInEffect::Invalid) { - return false; - } - if (!flags.testFlag(LoadEffectFlag::Load)) { - qCDebug(KWIN_CORE) << "Loading flags disable effect: " << name; - return false; - } - // check that it is not already loaded - if (m_loadedEffects.contains(effect)) { - return false; - } - - // supported might need a context -#ifndef KWIN_UNIT_TEST - effects->makeOpenGLContextCurrent(); -#endif - if (!BuiltInEffects::supported(effect)) { - qCDebug(KWIN_CORE) << "Effect is not supported: " << name; - return false; - } - - if (flags.testFlag(LoadEffectFlag::CheckDefaultFunction)) { - if (!BuiltInEffects::checkEnabledByDefault(effect)) { - qCDebug(KWIN_CORE) << "Enabled by default function disables effect: " << name; - return false; - } - } - - // ok, now we can try to create the Effect - Effect *e = BuiltInEffects::create(effect); - if (!e) { - qCDebug(KWIN_CORE) << "Failed to create effect: " << name; - return false; - } - // insert in our loaded effects - m_loadedEffects.insert(effect, e); - connect(e, &Effect::destroyed, this, - [this, effect]() { - m_loadedEffects.remove(effect); - } - ); - qCDebug(KWIN_CORE) << "Successfully loaded built-in effect: " << name; - Q_EMIT effectLoaded(e, name); - return true; -} - -QString BuiltInEffectLoader::internalName(const QString& name) const -{ - return name.toLower(); -} - -void BuiltInEffectLoader::clear() -{ - m_queue->clear(); -} - static const QString s_nameProperty = QStringLiteral("X-KDE-PluginInfo-Name"); static const QString s_jsConstraint = QStringLiteral("[X-Plasma-API] == 'javascript'"); static const QString s_serviceType = QStringLiteral("KWin/Effect"); @@ -621,9 +511,8 @@ void PluginEffectLoader::clear() EffectLoader::EffectLoader(QObject *parent) : AbstractEffectLoader(parent) { - m_loaders << new BuiltInEffectLoader(this) + m_loaders << new StaticPluginEffectLoader(this) << new ScriptedEffectLoader(this) - << new StaticPluginEffectLoader(this) << new PluginEffectLoader(this); for (auto it = m_loaders.constBegin(); it != m_loaders.constEnd(); ++it) { connect(*it, &AbstractEffectLoader::effectLoaded, this, &AbstractEffectLoader::effectLoaded); diff --git a/src/effectloader.h b/src/effectloader.h index 4d312fd624..c74c424921 100644 --- a/src/effectloader.h +++ b/src/effectloader.h @@ -24,7 +24,6 @@ namespace KWin { class Effect; class EffectPluginFactory; -enum class BuiltInEffect; /** * @brief Flags defining how a Loader should load an Effect. @@ -268,32 +267,6 @@ private: QQueue> m_queue; }; -/** - * @brief Can load the Built-In-Effects - */ -class BuiltInEffectLoader : public AbstractEffectLoader -{ - Q_OBJECT -public: - explicit BuiltInEffectLoader(QObject *parent = nullptr); - ~BuiltInEffectLoader() override; - - bool hasEffect(const QString &name) const override; - bool isEffectSupported(const QString &name) const override; - QStringList listOfKnownEffects() const override; - - void clear() override; - void queryAndLoadAll() override; - bool loadEffect(const QString& name) override; - bool loadEffect(BuiltInEffect effect, LoadEffectFlags flags); - -private: - bool loadEffect(const QString &name, BuiltInEffect effect, LoadEffectFlags flags); - QString internalName(const QString &name) const; - EffectLoadQueue *m_queue; - QMap m_loadedEffects; -}; - /** * @brief Can load scripted Effects */ diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt index 3213dd3ee9..6d19f5dbd9 100644 --- a/src/effects/CMakeLists.txt +++ b/src/effects/CMakeLists.txt @@ -57,17 +57,9 @@ macro(KWIN4_ADD_EFFECT_BACKEND name type) ) endmacro() -# Adds effect plugin with given name. Sources are given after the name -macro(KWIN4_ADD_EFFECT name) - kwin4_add_effect_backend(${name} SHARED ${ARGN}) - - set_target_properties(${name} PROPERTIES VERSION 1.0.0 SOVERSION 1) - set_target_properties(${name} PROPERTIES OUTPUT_NAME ${name}) - install(TARGETS ${name} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -endmacro() - macro(KWIN4_ADD_EFFECT_MODULE name) kwin4_add_effect_backend(${name} OBJECT ${ARGN}) + target_compile_definitions(${name} PRIVATE QT_STATICPLUGIN) endmacro() # Install the KWin/Effect service type @@ -144,14 +136,13 @@ add_subdirectory(wobblywindows) # Add the builtins plugin set(kwin4_effect_builtins_sources - effect_builtins.cpp logging.cpp ../service_utils.cpp ) qt5_add_resources(kwin4_effect_builtins_sources shaders.qrc) -kwin4_add_effect(kwin4_effect_builtins ${kwin4_effect_builtins_sources}) +kwin4_add_effect_backend(kwin4_effect_builtins STATIC ${kwin4_effect_builtins_sources}) target_link_libraries(kwin4_effect_builtins PRIVATE kwin4_effect_blur kwin4_effect_colorpicker diff --git a/src/effects/backgroundcontrast/CMakeLists.txt b/src/effects/backgroundcontrast/CMakeLists.txt index 1d743d2e0a..46accd8f92 100644 --- a/src/effects/backgroundcontrast/CMakeLists.txt +++ b/src/effects/backgroundcontrast/CMakeLists.txt @@ -5,5 +5,6 @@ set(contrast_SOURCES contrast.cpp contrastshader.cpp + main.cpp ) kwin4_add_effect_module(kwin4_effect_contrast ${contrast_SOURCES}) diff --git a/src/effects/backgroundcontrast/main.cpp b/src/effects/backgroundcontrast/main.cpp new file mode 100644 index 0000000000..1dc54c5109 --- /dev/null +++ b/src/effects/backgroundcontrast/main.cpp @@ -0,0 +1,20 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "contrast.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED_ENABLED(ContrastEffectFactory, + ContrastEffect, + "metadata.json", + return ContrastEffect::supported();, + return ContrastEffect::enabledByDefault();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/backgroundcontrast/metadata.json b/src/effects/backgroundcontrast/metadata.json new file mode 100644 index 0000000000..d8dc710852 --- /dev/null +++ b/src/effects/backgroundcontrast/metadata.json @@ -0,0 +1,15 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Improve contrast and readability behind semi-transparent windows", + "Id": "contrast", + "License": "GPL", + "Name": "Background contrast", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "enabledByDefaultMethod": true + } +} \ No newline at end of file diff --git a/src/effects/blur/CMakeLists.txt b/src/effects/blur/CMakeLists.txt index 467221e391..7c93c3b8f5 100644 --- a/src/effects/blur/CMakeLists.txt +++ b/src/effects/blur/CMakeLists.txt @@ -4,6 +4,7 @@ set(blur_SOURCES blur.cpp blurshader.cpp + main.cpp ) kconfig_add_kcfg_files(blur_SOURCES diff --git a/src/effects/blur/main.cpp b/src/effects/blur/main.cpp new file mode 100644 index 0000000000..b7f0362894 --- /dev/null +++ b/src/effects/blur/main.cpp @@ -0,0 +1,20 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "blur.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED_ENABLED(BlurEffectFactory, + BlurEffect, + "metadata.json", + return BlurEffect::supported();, + return BlurEffect::enabledByDefault();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/blur/metadata.json b/src/effects/blur/metadata.json new file mode 100644 index 0000000000..222b88f889 --- /dev/null +++ b/src/effects/blur/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Blurs the background behind semi-transparent windows", + "Id": "blur", + "License": "GPL", + "Name": "Blur", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_blur_config", + "org.kde.kwin.effect": { + "enabledByDefaultMethod": true + } +} \ No newline at end of file diff --git a/src/effects/colorpicker/CMakeLists.txt b/src/effects/colorpicker/CMakeLists.txt index b27ec10856..32ad3d150f 100644 --- a/src/effects/colorpicker/CMakeLists.txt +++ b/src/effects/colorpicker/CMakeLists.txt @@ -3,6 +3,7 @@ set(colorpicker_SOURCES colorpicker.cpp + main.cpp ) kwin4_add_effect_module(kwin4_effect_colorpicker ${colorpicker_SOURCES}) diff --git a/src/effects/colorpicker/main.cpp b/src/effects/colorpicker/main.cpp new file mode 100644 index 0000000000..708dbcf763 --- /dev/null +++ b/src/effects/colorpicker/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "colorpicker.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(ColorPickerEffectFactory, + ColorPickerEffect, + "metadata.json", + return ColorPickerEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/colorpicker/metadata.json b/src/effects/colorpicker/metadata.json new file mode 100644 index 0000000000..2ccbb27aac --- /dev/null +++ b/src/effects/colorpicker/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "Supports picking a color", + "EnabledByDefault": true, + "Id": "colorpicker", + "License": "GPL", + "Name": "Color Picker", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "internal": true + } +} \ No newline at end of file diff --git a/src/effects/desktopgrid/CMakeLists.txt b/src/effects/desktopgrid/CMakeLists.txt index c693c8b0d5..d31fa7d8e6 100644 --- a/src/effects/desktopgrid/CMakeLists.txt +++ b/src/effects/desktopgrid/CMakeLists.txt @@ -4,6 +4,7 @@ install(FILES main.qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/desktopgr set(desktopgrid_SOURCES desktopgrid.cpp + main.cpp ) kconfig_add_kcfg_files(desktopgrid_SOURCES diff --git a/src/effects/desktopgrid/desktopgrid.cpp b/src/effects/desktopgrid/desktopgrid.cpp index aa3ea2a092..dd696caab7 100644 --- a/src/effects/desktopgrid/desktopgrid.cpp +++ b/src/effects/desktopgrid/desktopgrid.cpp @@ -15,7 +15,6 @@ #include "desktopgridconfig.h" #include "../presentwindows/presentwindows_proxy.h" -#include "../effect_builtins.h" #include #include @@ -1102,7 +1101,7 @@ void DesktopGridEffect::setup() // setup the motion managers if (clickBehavior == SwitchDesktopAndActivateWindow) - m_proxy = static_cast(effects->getProxy(BuiltInEffects::nameForEffect(BuiltInEffect::PresentWindows))); + m_proxy = static_cast(effects->getProxy(QStringLiteral("presentwindows"))); if (isUsingPresentWindows()) { m_proxy->reCreateGrids(); // revalidation on multiscreen, bug #351724 for (int i = 1; i <= effects->numberOfDesktops(); i++) { diff --git a/src/effects/desktopgrid/main.cpp b/src/effects/desktopgrid/main.cpp new file mode 100644 index 0000000000..4027068bbc --- /dev/null +++ b/src/effects/desktopgrid/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "desktopgrid.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(DesktopGridEffectFactory, + DesktopGridEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/desktopgrid/metadata.json b/src/effects/desktopgrid/metadata.json new file mode 100644 index 0000000000..38b399f825 --- /dev/null +++ b/src/effects/desktopgrid/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Window Management", + "Description": "Zoom out so all desktops are displayed side-by-side in a grid", + "EnabledByDefault": true, + "Id": "desktopgrid", + "License": "GPL", + "Name": "Desktop Grid", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_desktopgrid_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/desktop_grid.mp4" + } +} \ No newline at end of file diff --git a/src/effects/diminactive/CMakeLists.txt b/src/effects/diminactive/CMakeLists.txt index ab5a3bd7a7..4411a76fa2 100644 --- a/src/effects/diminactive/CMakeLists.txt +++ b/src/effects/diminactive/CMakeLists.txt @@ -3,6 +3,7 @@ set(diminactive_SOURCES diminactive.cpp + main.cpp ) kconfig_add_kcfg_files(diminactive_SOURCES diff --git a/src/effects/diminactive/main.cpp b/src/effects/diminactive/main.cpp new file mode 100644 index 0000000000..5caee38514 --- /dev/null +++ b/src/effects/diminactive/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "diminactive.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(DimInactiveEffectFactory, + DimInactiveEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/diminactive/metadata.json b/src/effects/diminactive/metadata.json new file mode 100644 index 0000000000..d10c1be59b --- /dev/null +++ b/src/effects/diminactive/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Focus", + "Description": "Darken inactive windows", + "EnabledByDefault": false, + "Id": "diminactive", + "License": "GPL", + "Name": "Dim Inactive", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_diminactive_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/dim_inactive.mp4" + } +} \ No newline at end of file diff --git a/src/effects/effect_builtins.cpp b/src/effects/effect_builtins.cpp deleted file mode 100644 index fb5679935c..0000000000 --- a/src/effects/effect_builtins.cpp +++ /dev/null @@ -1,751 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2014 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#include "effect_builtins.h" -#ifdef EFFECT_BUILTINS -// common effects -#include "backgroundcontrast/contrast.h" -#include "blur/blur.h" -#include "colorpicker/colorpicker.h" -#include "kscreen/kscreen.h" -#include "overview/overvieweffect.h" -#include "presentwindows/presentwindows.h" -#include "screenedge/screenedgeeffect.h" -#include "screenshot/screenshot.h" -#include "screentransform/screentransform.h" -#include "slidingpopups/slidingpopups.h" -// Common effects only relevant to desktop -#include "desktopgrid/desktopgrid.h" -#include "diminactive/diminactive.h" -#include "fallapart/fallapart.h" -#include "highlightwindow/highlightwindow.h" -#include "magiclamp/magiclamp.h" -#include "resize/resize.h" -#include "showfps/showfps.h" -#include "showpaint/showpaint.h" -#include "slide/slide.h" -#include "slideback/slideback.h" -#include "thumbnailaside/thumbnailaside.h" -#include "touchpoints/touchpoints.h" -#include "windowgeometry/windowgeometry.h" -#include "zoom/zoom.h" -// OpenGL-specific effects for desktop -#include "glide/glide.h" -#include "invert/invert.h" -#include "lookingglass/lookingglass.h" -#include "magnifier/magnifier.h" -#include "mouseclick/mouseclick.h" -#include "mousemark/mousemark.h" -#include "sheet/sheet.h" -#include "snaphelper/snaphelper.h" -#include "startupfeedback/startupfeedback.h" -#include "trackmouse/trackmouse.h" -#include "wobblywindows/wobblywindows.h" -#endif - -#include -#include - -#ifndef EFFECT_BUILTINS -#define EFFECT_FALLBACK nullptr, nullptr, nullptr, -#else -#define EFFECT_FALLBACK -#endif - -namespace KWin -{ - -namespace BuiltInEffects -{ - -template -inline Effect *createHelper() -{ - return new T(); -} - -static const QVector &effectData() -{ - static const QVector s_effectData = { - { - QString(), - QString(), - QString(), - QString(), - QString(), - QUrl(), - false, - false, - nullptr, - nullptr, - nullptr, - QString() - }, { - QStringLiteral("blur"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Blur"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Blurs the background behind semi-transparent windows"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &BlurEffect::supported, - &BlurEffect::enabledByDefault, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_blur_config") - }, { - QStringLiteral("colorpicker"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Color Picker"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Supports picking a color"), - QStringLiteral("Accessibility"), - QString(), - QUrl(), - true, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - &ColorPickerEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("contrast"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Background contrast"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Improve contrast and readability behind semi-transparent windows"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &ContrastEffect::supported, - &ContrastEffect::enabledByDefault, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("desktopgrid"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Grid"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Zoom out so all desktops are displayed side-by-side in a grid"), - QStringLiteral("Window Management"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/desktop_grid.mp4")), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_desktopgrid_config") - }, { - QStringLiteral("diminactive"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Dim Inactive"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Darken inactive windows"), - QStringLiteral("Focus"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/dim_inactive.mp4")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_diminactive_config") - }, { - QStringLiteral("fallapart"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Fall Apart"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Closed windows fall into pieces"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &FallApartEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("glide"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Glide"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Glide windows as they appear or disappear"), - QStringLiteral("Window Open/Close Animation"), - QStringLiteral("toplevel-open-close-animation"), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &GlideEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_glide_config") - }, { - QStringLiteral("highlightwindow"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Highlight Window"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Highlight the appropriate window when hovering over taskbar entries"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("invert"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Invert"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Inverts the color of the desktop and windows"), - QStringLiteral("Accessibility"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/invert.mp4")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &InvertEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_invert_config") - }, { - QStringLiteral("kscreen"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Kscreen"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Helper Effect for KScreen"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("lookingglass"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Looking Glass"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "A screen magnifier that looks like a fisheye lens"), - QStringLiteral("Accessibility"), - QStringLiteral("magnifiers"), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/looking_glass.ogv")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &LookingGlassEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_lookingglass_config") - }, { - QStringLiteral("magiclamp"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Magic Lamp"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Simulate a magic lamp when minimizing windows"), - QStringLiteral("Appearance"), - QStringLiteral("minimize"), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/magic_lamp.ogv")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &MagicLampEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_magiclamp_config") - }, { - QStringLiteral("magnifier"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Magnifier"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Magnify the section of the screen that is near the mouse cursor"), - QStringLiteral("Accessibility"), - QStringLiteral("magnifiers"), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/magnifier.ogv")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &MagnifierEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_magnifier_config") - }, { - QStringLiteral("mouseclick"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Mouse Click Animation"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Creates an animation whenever a mouse button is clicked. This is useful for screenrecordings/presentations"), - QStringLiteral("Accessibility"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/mouse_click.mp4")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_mouseclick_config") - }, { - QStringLiteral("mousemark"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Mouse Mark"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Allows you to draw lines on the desktop"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_mousemark_config") - }, { - QStringLiteral("overview"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Overview"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Allows you to overview virtual desktops and windows"), - QStringLiteral("Window Management"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/present_windows.mp4")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &OverviewEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_overview_config") - }, { - QStringLiteral("presentwindows"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Present Windows"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Zoom out until all opened windows can be displayed side-by-side"), - QStringLiteral("Window Management"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/present_windows.mp4")), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_presentwindows_config") - }, { - QStringLiteral("resize"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Resize Window"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Resizes windows with a fast texture scale instead of updating contents"), - QStringLiteral("Window Management"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_resize_config") - }, { - QStringLiteral("screenedge"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Screen Edge"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Highlights a screen edge when approaching"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("screenshot"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Screenshot"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Helper effect for screenshot tools"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - &ScreenShotEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("screentransform"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Transform"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Animates display transformations"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - &ScreenTransformEffect::supported, - nullptr, -#endif - EFFECT_FALLBACK QString() - }, { - QStringLiteral("sheet"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Sheet"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Make modal dialogs smoothly fly in and out when they are shown or hidden"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &SheetEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("showfps"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Show FPS"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display KWin's performance in the corner of the screen"), - QStringLiteral("Tools"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_showfps_config") - }, { - QStringLiteral("showpaint"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Show Paint"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Highlight areas of the desktop that have been recently updated"), - QStringLiteral("Tools"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_showpaint_config") - }, { - QStringLiteral("slide"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Slide"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Slide desktops when switching virtual desktops"), - QStringLiteral("Virtual Desktop Switching Animation"), - QStringLiteral("desktop-animations"), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/slide.ogv")), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &SlideEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_slide_config") - }, { - QStringLiteral("slideback"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Slide Back"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Slide back windows when another window is raised"), - QStringLiteral("Focus"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("slidingpopups"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Sliding popups"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Sliding animation for Plasma popups"), - QStringLiteral("Appearance"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/sliding_popups.mp4")), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &SlidingPopupsEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("snaphelper"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Snap Helper"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Help you locate the center of the screen when moving a window"), - QStringLiteral("Accessibility"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/snap_helper.mp4")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("startupfeedback"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Startup Feedback"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Helper effect for startup feedback"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - &StartupFeedbackEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("thumbnailaside"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Thumbnail Aside"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display window thumbnails on the edge of the screen"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_thumbnailaside_config") - }, { - QStringLiteral("touchpoints"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Touch Points"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Visualize touch points"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QString() - }, { - QStringLiteral("trackmouse"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Track Mouse"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display a mouse cursor locating effect when activated"), - QStringLiteral("Accessibility"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/track_mouse.mp4")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_trackmouse_config") - }, { - QStringLiteral("windowgeometry"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Window Geometry"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display window geometries on move/resize"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - false, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_windowgeometry_config") - }, { - QStringLiteral("wobblywindows"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Wobbly Windows"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Deform windows while they are moving"), - QStringLiteral("Appearance"), - QString(), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/wobbly_windows.ogv")), - false, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - &WobblyWindowsEffect::supported, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_wobblywindows_config") - }, { - QStringLiteral("zoom"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Zoom"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Magnify the entire desktop"), - QStringLiteral("Accessibility"), - QStringLiteral("magnifiers"), - QUrl(QStringLiteral("https://files.kde.org/plasma/kwin/effect-videos/zoom.ogv")), - true, - false, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr, -#endif -EFFECT_FALLBACK - QStringLiteral("kwin_zoom_config") - } - }; - return s_effectData; -} - -static inline int index(BuiltInEffect effect) -{ - return static_cast(effect); -} - -Effect *create(BuiltInEffect effect) -{ - const EffectData &data = effectData(effect); - if (data.createFunction == nullptr) { - return nullptr; - } - return data.createFunction(); -} - -bool available(const QString &name) -{ - auto it = std::find_if(effectData().begin(), effectData().end(), - [name](const EffectData &data) { - return data.name == name; - } - ); - return it != effectData().end(); -} - -bool supported(BuiltInEffect effect) -{ - if (effect == BuiltInEffect::Invalid) { - return false; - } - const EffectData &data = effectData(effect); - if (data.supportedFunction == nullptr) { - return true; - } - return data.supportedFunction(); -} - -bool checkEnabledByDefault(BuiltInEffect effect) -{ - if (effect == BuiltInEffect::Invalid) { - return false; - } - const EffectData &data = effectData(effect); - if (data.enabledFunction == nullptr) { - return true; - } - return data.enabledFunction(); -} - -bool enabledByDefault(BuiltInEffect effect) -{ - return effectData(effect).enabled; -} - -QStringList availableEffectNames() -{ - QStringList result; - for (const EffectData &data : effectData()) { - if (data.name.isEmpty()) { - continue; - } - result << data.name; - } - return result; -} - -QList< BuiltInEffect > availableEffects() -{ - QList result; - for (int i = index(BuiltInEffect::Invalid) + 1; i <= index(BuiltInEffect::Zoom); ++i) { - result << BuiltInEffect(i); - } - return result; -} - -BuiltInEffect builtInForName(const QString &name) -{ - auto it = std::find_if(effectData().begin(), effectData().end(), - [name](const EffectData &data) { - return data.name == name; - } - ); - if (it == effectData().end()) { - return BuiltInEffect::Invalid; - } - return BuiltInEffect(std::distance(effectData().begin(), it)); -} - -QString nameForEffect(BuiltInEffect effect) -{ - return effectData(effect).name; -} - -const EffectData &effectData(BuiltInEffect effect) -{ - return effectData().at(index(effect)); -} - -} // BuiltInEffects - -} // namespace diff --git a/src/effects/effect_builtins.h b/src/effects/effect_builtins.h index d86a0e3657..e01b7574ac 100644 --- a/src/effects/effect_builtins.h +++ b/src/effects/effect_builtins.h @@ -8,88 +8,42 @@ */ #ifndef KWIN_EFFECT_BUILTINS_H #define KWIN_EFFECT_BUILTINS_H -#include -#include -#include -#include -namespace KWin -{ -class Effect; - -/** - * Defines all the built in effects. - */ -enum class BuiltInEffect -{ - Invalid, ///< not a valid Effect - Blur, - ColorPicker, - Contrast, - DesktopGrid, - DimInactive, - FallApart, - Glide, - HighlightWindow, - Invert, - Kscreen, - LookingGlass, - MagicLamp, - Magnifier, - MouseClick, - MouseMark, - Overview, - PresentWindows, - Resize, - ScreenEdge, - ScreenShot, - ScreenTransform, - Sheet, - ShowFps, - ShowPaint, - Slide, - SlideBack, - SlidingPopups, - SnapHelper, - StartupFeedback, - ThumbnailAside, - TouchPoints, - TrackMouse, - WindowGeometry, - WobblyWindows, - Zoom -}; - -namespace BuiltInEffects -{ - -struct EffectData { - QString name; - QString displayName; - QString comment; - QString category; - QString exclusiveCategory; - QUrl video; - bool enabled; - bool internal; - std::function createFunction; - std::function supportedFunction; - std::function enabledFunction; - QString configModule; -}; - -KWINEFFECTS_EXPORT Effect *create(BuiltInEffect effect); -KWINEFFECTS_EXPORT bool available(const QString &name); -KWINEFFECTS_EXPORT bool supported(BuiltInEffect effect); -KWINEFFECTS_EXPORT bool checkEnabledByDefault(BuiltInEffect effect); -KWINEFFECTS_EXPORT bool enabledByDefault(BuiltInEffect effect); -KWINEFFECTS_EXPORT QString nameForEffect(BuiltInEffect effect); -KWINEFFECTS_EXPORT BuiltInEffect builtInForName(const QString &name); -KWINEFFECTS_EXPORT QStringList availableEffectNames(); -KWINEFFECTS_EXPORT QList availableEffects(); -KWINEFFECTS_EXPORT const EffectData &effectData(BuiltInEffect effect); -} - -} +#define KWIN_IMPORT_BUILTIN_EFFECTS \ + Q_IMPORT_PLUGIN(BlurEffectFactory) \ + Q_IMPORT_PLUGIN(ColorPickerEffectFactory) \ + Q_IMPORT_PLUGIN(ContrastEffectFactory) \ + Q_IMPORT_PLUGIN(DesktopGridEffectFactory) \ + Q_IMPORT_PLUGIN(DimInactiveEffectFactory) \ + Q_IMPORT_PLUGIN(FallApartEffectFactory) \ + Q_IMPORT_PLUGIN(GlideEffectFactory) \ + Q_IMPORT_PLUGIN(HighlightWindowEffectFactory) \ + Q_IMPORT_PLUGIN(InvertEffectFactory) \ + Q_IMPORT_PLUGIN(KscreenEffectFactory) \ + Q_IMPORT_PLUGIN(LookingGlassEffectFactory) \ + Q_IMPORT_PLUGIN(MagicLampEffectFactory) \ + Q_IMPORT_PLUGIN(MagnifierEffectFactory) \ + Q_IMPORT_PLUGIN(MouseClickEffectFactory) \ + Q_IMPORT_PLUGIN(MouseMarkEffectFactory) \ + Q_IMPORT_PLUGIN(OverviewEffectFactory) \ + Q_IMPORT_PLUGIN(PresentWindowsEffectFactory) \ + Q_IMPORT_PLUGIN(ResizeEffectFactory) \ + Q_IMPORT_PLUGIN(ScreenEdgeEffectFactory) \ + Q_IMPORT_PLUGIN(ScreenShotEffectFactory) \ + Q_IMPORT_PLUGIN(ScreenTransformEffectFactory) \ + Q_IMPORT_PLUGIN(SheetEffectFactory) \ + Q_IMPORT_PLUGIN(ShowFpsEffectFactory) \ + Q_IMPORT_PLUGIN(ShowPaintEffectFactory) \ + Q_IMPORT_PLUGIN(SlideEffectFactory) \ + Q_IMPORT_PLUGIN(SlideBackEffectFactory) \ + Q_IMPORT_PLUGIN(SlidingPopupsEffectFactory) \ + Q_IMPORT_PLUGIN(SnapHelperEffectFactory) \ + Q_IMPORT_PLUGIN(StartupFeedbackEffectFactory) \ + Q_IMPORT_PLUGIN(ThumbnailAsideEffectFactory) \ + Q_IMPORT_PLUGIN(TouchPointsEffectFactory) \ + Q_IMPORT_PLUGIN(TrackMouseEffectFactory) \ + Q_IMPORT_PLUGIN(WindowGeometryFactory) \ + Q_IMPORT_PLUGIN(WobblyWindowsEffectFactory) \ + Q_IMPORT_PLUGIN(ZoomEffectFactory) #endif diff --git a/src/effects/fallapart/CMakeLists.txt b/src/effects/fallapart/CMakeLists.txt index f1f15fa1be..35c398e089 100644 --- a/src/effects/fallapart/CMakeLists.txt +++ b/src/effects/fallapart/CMakeLists.txt @@ -4,6 +4,7 @@ # Source files set(fallapart_SOURCES fallapart.cpp + main.cpp ) kconfig_add_kcfg_files(fallapart_SOURCES diff --git a/src/effects/fallapart/main.cpp b/src/effects/fallapart/main.cpp new file mode 100644 index 0000000000..3c05496ea9 --- /dev/null +++ b/src/effects/fallapart/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "fallapart.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(FallApartEffectFactory, + FallApartEffect, + "metadata.json", + return FallApartEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/fallapart/metadata.json b/src/effects/fallapart/metadata.json new file mode 100644 index 0000000000..9f60048e42 --- /dev/null +++ b/src/effects/fallapart/metadata.json @@ -0,0 +1,13 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Closed windows fall into pieces", + "EnabledByDefault": false, + "Id": "fallapart", + "License": "GPL", + "Name": "Fall Apart", + "ServiceTypes": [ + "KWin/Effect" + ] + } +} \ No newline at end of file diff --git a/src/effects/glide/CMakeLists.txt b/src/effects/glide/CMakeLists.txt index ae3fe2f12a..2636591b7b 100644 --- a/src/effects/glide/CMakeLists.txt +++ b/src/effects/glide/CMakeLists.txt @@ -3,6 +3,7 @@ set(glide_SOURCES glide.cpp + main.cpp ) kconfig_add_kcfg_files(glide_SOURCES diff --git a/src/effects/glide/main.cpp b/src/effects/glide/main.cpp new file mode 100644 index 0000000000..c1793adfa1 --- /dev/null +++ b/src/effects/glide/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "glide.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(GlideEffectFactory, + GlideEffect, + "metadata.json", + return GlideEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/glide/metadata.json b/src/effects/glide/metadata.json new file mode 100644 index 0000000000..d040f085ba --- /dev/null +++ b/src/effects/glide/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Window Open/Close Animation", + "Description": "Glide windows as they appear or disappear", + "EnabledByDefault": false, + "Id": "glide", + "License": "GPL", + "Name": "Glide", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_glide_config", + "org.kde.kwin.effect": { + "exclusiveGroup": "toplevel-open-close-animation" + } +} \ No newline at end of file diff --git a/src/effects/highlightwindow/CMakeLists.txt b/src/effects/highlightwindow/CMakeLists.txt index 621c0714ae..af9bb25a57 100644 --- a/src/effects/highlightwindow/CMakeLists.txt +++ b/src/effects/highlightwindow/CMakeLists.txt @@ -4,6 +4,7 @@ # Source files set(highlightwindow_SOURCES highlightwindow.cpp + main.cpp ) kwin4_add_effect_module(kwin4_effect_highlightwindow ${highlightwindow_SOURCES}) diff --git a/src/effects/highlightwindow/main.cpp b/src/effects/highlightwindow/main.cpp new file mode 100644 index 0000000000..391672dc6a --- /dev/null +++ b/src/effects/highlightwindow/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "highlightwindow.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(HighlightWindowEffectFactory, + HighlightWindowEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/highlightwindow/metadata.json b/src/effects/highlightwindow/metadata.json new file mode 100644 index 0000000000..f29d6321ae --- /dev/null +++ b/src/effects/highlightwindow/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Highlight the appropriate window when hovering over taskbar entries", + "EnabledByDefault": true, + "Id": "highlightwindow", + "License": "GPL", + "Name": "Highlight Window", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "internal": true + } +} \ No newline at end of file diff --git a/src/effects/invert/CMakeLists.txt b/src/effects/invert/CMakeLists.txt index 8973a83830..a2992adc50 100644 --- a/src/effects/invert/CMakeLists.txt +++ b/src/effects/invert/CMakeLists.txt @@ -3,6 +3,7 @@ set(invert_SOURCES invert.cpp + main.cpp ) kwin4_add_effect_module(kwin4_effect_invert ${invert_SOURCES}) diff --git a/src/effects/invert/main.cpp b/src/effects/invert/main.cpp new file mode 100644 index 0000000000..1faa5bc67f --- /dev/null +++ b/src/effects/invert/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "invert.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(InvertEffectFactory, + InvertEffect, + "metadata.json", + return InvertEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/invert/metadata.json b/src/effects/invert/metadata.json new file mode 100644 index 0000000000..35407c838f --- /dev/null +++ b/src/effects/invert/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "Inverts the color of the desktop and windows", + "EnabledByDefault": false, + "Id": "invert", + "License": "GPL", + "Name": "Invert", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_invert_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/invert.mp4" + } +} \ No newline at end of file diff --git a/src/effects/kscreen/CMakeLists.txt b/src/effects/kscreen/CMakeLists.txt index a1f2b3b878..55c6a685e5 100644 --- a/src/effects/kscreen/CMakeLists.txt +++ b/src/effects/kscreen/CMakeLists.txt @@ -4,6 +4,7 @@ # Source files set(kscreen_SOURCES kscreen.cpp + main.cpp ) kconfig_add_kcfg_files(kscreen_SOURCES kscreenconfig.kcfgc) diff --git a/src/effects/kscreen/main.cpp b/src/effects/kscreen/main.cpp new file mode 100644 index 0000000000..af16ee9f97 --- /dev/null +++ b/src/effects/kscreen/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "kscreen.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(KscreenEffectFactory, + KscreenEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/kscreen/metadata.json b/src/effects/kscreen/metadata.json new file mode 100644 index 0000000000..abe50ac59e --- /dev/null +++ b/src/effects/kscreen/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Helper Effect for KScreen", + "EnabledByDefault": true, + "Id": "kscreen", + "License": "GPL", + "Name": "Kscreen", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "internal": true + } +} \ No newline at end of file diff --git a/src/effects/lookingglass/CMakeLists.txt b/src/effects/lookingglass/CMakeLists.txt index 7c4b387ffa..035b310309 100644 --- a/src/effects/lookingglass/CMakeLists.txt +++ b/src/effects/lookingglass/CMakeLists.txt @@ -3,6 +3,7 @@ set(lookingglass_SOURCES lookingglass.cpp + main.cpp ) kconfig_add_kcfg_files(lookingglass_SOURCES diff --git a/src/effects/lookingglass/main.cpp b/src/effects/lookingglass/main.cpp new file mode 100644 index 0000000000..957bb3c211 --- /dev/null +++ b/src/effects/lookingglass/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "lookingglass.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(LookingGlassEffectFactory, + LookingGlassEffect, + "metadata.json", + return LookingGlassEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/lookingglass/metadata.json b/src/effects/lookingglass/metadata.json new file mode 100644 index 0000000000..0c6a166945 --- /dev/null +++ b/src/effects/lookingglass/metadata.json @@ -0,0 +1,18 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "A screen magnifier that looks like a fisheye lens", + "EnabledByDefault": false, + "Id": "lookingglass", + "License": "GPL", + "Name": "Looking Glass", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_lookingglass_config", + "org.kde.kwin.effect": { + "exclusiveGroup": "magnifiers", + "video": "https://files.kde.org/plasma/kwin/effect-videos/looking_glass.ogv" + } +} \ No newline at end of file diff --git a/src/effects/magiclamp/CMakeLists.txt b/src/effects/magiclamp/CMakeLists.txt index 30bcb1a1d4..03c4e3f2b5 100644 --- a/src/effects/magiclamp/CMakeLists.txt +++ b/src/effects/magiclamp/CMakeLists.txt @@ -3,6 +3,7 @@ set(magiclamp_SOURCES magiclamp.cpp + main.cpp ) kconfig_add_kcfg_files(magiclamp_SOURCES diff --git a/src/effects/magiclamp/main.cpp b/src/effects/magiclamp/main.cpp new file mode 100644 index 0000000000..ce042ac748 --- /dev/null +++ b/src/effects/magiclamp/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "magiclamp.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(MagicLampEffectFactory, + MagicLampEffect, + "metadata.json", + return MagicLampEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/magiclamp/metadata.json b/src/effects/magiclamp/metadata.json new file mode 100644 index 0000000000..105cfae9bb --- /dev/null +++ b/src/effects/magiclamp/metadata.json @@ -0,0 +1,18 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Simulate a magic lamp when minimizing windows", + "EnabledByDefault": false, + "Id": "magiclamp", + "License": "GPL", + "Name": "Magic Lamp", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_magiclamp_config", + "org.kde.kwin.effect": { + "exclusiveGroup": "minimize", + "video": "https://files.kde.org/plasma/kwin/effect-videos/magic_lamp.ogv" + } +} \ No newline at end of file diff --git a/src/effects/magnifier/CMakeLists.txt b/src/effects/magnifier/CMakeLists.txt index fa490136f8..945561ed92 100644 --- a/src/effects/magnifier/CMakeLists.txt +++ b/src/effects/magnifier/CMakeLists.txt @@ -3,6 +3,7 @@ set(magnifier_SOURCES magnifier.cpp + main.cpp ) kconfig_add_kcfg_files(magnifier_SOURCES diff --git a/src/effects/magnifier/main.cpp b/src/effects/magnifier/main.cpp new file mode 100644 index 0000000000..aa262d1412 --- /dev/null +++ b/src/effects/magnifier/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "magnifier.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(MagnifierEffectFactory, + MagnifierEffect, + "metadata.json", + return MagnifierEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/magnifier/metadata.json b/src/effects/magnifier/metadata.json new file mode 100644 index 0000000000..e30b7b4c0a --- /dev/null +++ b/src/effects/magnifier/metadata.json @@ -0,0 +1,18 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "Magnify the section of the screen that is near the mouse cursor", + "EnabledByDefault": false, + "Id": "magnifier", + "License": "GPL", + "Name": "Magnifier", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_magnifier_config", + "org.kde.kwin.effect": { + "exclusiveGroup": "magnifiers", + "video": "https://files.kde.org/plasma/kwin/effect-videos/magnifier.ogv" + } +} \ No newline at end of file diff --git a/src/effects/mouseclick/CMakeLists.txt b/src/effects/mouseclick/CMakeLists.txt index db94b6766e..628e4aed63 100644 --- a/src/effects/mouseclick/CMakeLists.txt +++ b/src/effects/mouseclick/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(mouseclick_SOURCES + main.cpp mouseclick.cpp ) diff --git a/src/effects/mouseclick/main.cpp b/src/effects/mouseclick/main.cpp new file mode 100644 index 0000000000..16b1248c11 --- /dev/null +++ b/src/effects/mouseclick/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "mouseclick.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(MouseClickEffectFactory, + MouseClickEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/mouseclick/metadata.json b/src/effects/mouseclick/metadata.json new file mode 100644 index 0000000000..5910be8367 --- /dev/null +++ b/src/effects/mouseclick/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "Creates an animation whenever a mouse button is clicked. This is useful for screenrecordings/presentations", + "EnabledByDefault": false, + "Id": "mouseclick", + "License": "GPL", + "Name": "Mouse Click Animation", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_mouseclick_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/mouse_click.mp4" + } +} \ No newline at end of file diff --git a/src/effects/mousemark/CMakeLists.txt b/src/effects/mousemark/CMakeLists.txt index b9658d49c0..479dc4ff02 100644 --- a/src/effects/mousemark/CMakeLists.txt +++ b/src/effects/mousemark/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(mousemark_SOURCES + main.cpp mousemark.cpp ) diff --git a/src/effects/mousemark/main.cpp b/src/effects/mousemark/main.cpp new file mode 100644 index 0000000000..23acf2583b --- /dev/null +++ b/src/effects/mousemark/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "mousemark.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(MouseMarkEffectFactory, + MouseMarkEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/mousemark/metadata.json b/src/effects/mousemark/metadata.json new file mode 100644 index 0000000000..eb8a738d47 --- /dev/null +++ b/src/effects/mousemark/metadata.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Allows you to draw lines on the desktop", + "EnabledByDefault": false, + "Id": "mousemark", + "License": "GPL", + "Name": "Mouse Mark", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_mousemark_config" +} \ No newline at end of file diff --git a/src/effects/overview/CMakeLists.txt b/src/effects/overview/CMakeLists.txt index 9b130d8fb3..cb51bff73f 100644 --- a/src/effects/overview/CMakeLists.txt +++ b/src/effects/overview/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(kcm) set(overview_SOURCES expoarea.cpp expolayout.cpp + main.cpp overvieweffect.cpp ) diff --git a/src/effects/overview/main.cpp b/src/effects/overview/main.cpp new file mode 100644 index 0000000000..2220556aed --- /dev/null +++ b/src/effects/overview/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "overvieweffect.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(OverviewEffectFactory, + OverviewEffect, + "metadata.json", + return OverviewEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/overview/metadata.json b/src/effects/overview/metadata.json new file mode 100644 index 0000000000..e03a08fe07 --- /dev/null +++ b/src/effects/overview/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Window Management", + "Description": "Allows you to overview virtual desktops and windows", + "EnabledByDefault": false, + "Id": "overview", + "License": "GPL", + "Name": "Overview", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_overview_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/present_windows.mp4" + } +} \ No newline at end of file diff --git a/src/effects/presentwindows/CMakeLists.txt b/src/effects/presentwindows/CMakeLists.txt index 83b119b7c1..86c9ef565c 100644 --- a/src/effects/presentwindows/CMakeLists.txt +++ b/src/effects/presentwindows/CMakeLists.txt @@ -3,6 +3,7 @@ install(FILES main.qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/presentwindows/) set(presentwindows_SOURCES + main.cpp presentwindows.cpp presentwindows_proxy.cpp ) diff --git a/src/effects/presentwindows/main.cpp b/src/effects/presentwindows/main.cpp new file mode 100644 index 0000000000..50e429f208 --- /dev/null +++ b/src/effects/presentwindows/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "presentwindows.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(PresentWindowsEffectFactory, + PresentWindowsEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/presentwindows/metadata.json b/src/effects/presentwindows/metadata.json new file mode 100644 index 0000000000..c9998cbf7f --- /dev/null +++ b/src/effects/presentwindows/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Window Management", + "Description": "Zoom out until all opened windows can be displayed side-by-side", + "EnabledByDefault": true, + "Id": "presentwindows", + "License": "GPL", + "Name": "Present Windows", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_presentwindows_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/present_windows.mp4" + } +} \ No newline at end of file diff --git a/src/effects/resize/CMakeLists.txt b/src/effects/resize/CMakeLists.txt index 0896ed549a..9f8d454cfc 100644 --- a/src/effects/resize/CMakeLists.txt +++ b/src/effects/resize/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(resize_SOURCES + main.cpp resize.cpp ) diff --git a/src/effects/resize/main.cpp b/src/effects/resize/main.cpp new file mode 100644 index 0000000000..54ae93709a --- /dev/null +++ b/src/effects/resize/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "resize.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(ResizeEffectFactory, + ResizeEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/resize/metadata.json b/src/effects/resize/metadata.json new file mode 100644 index 0000000000..94425d712f --- /dev/null +++ b/src/effects/resize/metadata.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Category": "Window Management", + "Description": "Resizes windows with a fast texture scale instead of updating contents", + "EnabledByDefault": false, + "Id": "resize", + "License": "GPL", + "Name": "Resize Window", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_resize_config" +} \ No newline at end of file diff --git a/src/effects/screenedge/CMakeLists.txt b/src/effects/screenedge/CMakeLists.txt index 7ac5ba697e..f9ef4440a8 100644 --- a/src/effects/screenedge/CMakeLists.txt +++ b/src/effects/screenedge/CMakeLists.txt @@ -3,6 +3,7 @@ # Source files set(screenedge_SOURCES + main.cpp screenedgeeffect.cpp ) diff --git a/src/effects/screenedge/main.cpp b/src/effects/screenedge/main.cpp new file mode 100644 index 0000000000..bc0bdcb802 --- /dev/null +++ b/src/effects/screenedge/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "screenedgeeffect.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(ScreenEdgeEffectFactory, + ScreenEdgeEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/screenedge/metadata.json b/src/effects/screenedge/metadata.json new file mode 100644 index 0000000000..4e68b2883d --- /dev/null +++ b/src/effects/screenedge/metadata.json @@ -0,0 +1,13 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Highlights a screen edge when approaching", + "EnabledByDefault": true, + "Id": "screenedge", + "License": "GPL", + "Name": "Screen Edge", + "ServiceTypes": [ + "KWin/Effect" + ] + } +} \ No newline at end of file diff --git a/src/effects/screenshot/CMakeLists.txt b/src/effects/screenshot/CMakeLists.txt index dd85e34474..8458c6b450 100644 --- a/src/effects/screenshot/CMakeLists.txt +++ b/src/effects/screenshot/CMakeLists.txt @@ -3,6 +3,7 @@ # Source files set(screenshot_SOURCES + main.cpp screenshot.cpp screenshotdbusinterface1.cpp screenshotdbusinterface2.cpp diff --git a/src/effects/screenshot/main.cpp b/src/effects/screenshot/main.cpp new file mode 100644 index 0000000000..85618353e0 --- /dev/null +++ b/src/effects/screenshot/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "screenshot.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(ScreenShotEffectFactory, + ScreenShotEffect, + "metadata.json", + return ScreenShotEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/screenshot/metadata.json b/src/effects/screenshot/metadata.json new file mode 100644 index 0000000000..164ca75693 --- /dev/null +++ b/src/effects/screenshot/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Helper effect for screenshot tools", + "EnabledByDefault": true, + "Id": "screenshot", + "License": "GPL", + "Name": "Screenshot", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "internal": true + } +} \ No newline at end of file diff --git a/src/effects/screentransform/CMakeLists.txt b/src/effects/screentransform/CMakeLists.txt index b3b27e618d..64fe3513a4 100644 --- a/src/effects/screentransform/CMakeLists.txt +++ b/src/effects/screentransform/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(screentransform_SOURCES + main.cpp screentransform.cpp ) diff --git a/src/effects/screentransform/main.cpp b/src/effects/screentransform/main.cpp new file mode 100644 index 0000000000..dfe7e6a4ab --- /dev/null +++ b/src/effects/screentransform/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "screentransform.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(ScreenTransformEffectFactory, + ScreenTransformEffect, + "metadata.json", + return ScreenTransformEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/screentransform/metadata.json b/src/effects/screentransform/metadata.json new file mode 100644 index 0000000000..da1ea07528 --- /dev/null +++ b/src/effects/screentransform/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Animates display transformations", + "EnabledByDefault": true, + "Id": "screentransform", + "License": "GPL", + "Name": "Transform", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "internal": true + } +} \ No newline at end of file diff --git a/src/effects/sheet/CMakeLists.txt b/src/effects/sheet/CMakeLists.txt index 2ffec38bc3..18869568d5 100644 --- a/src/effects/sheet/CMakeLists.txt +++ b/src/effects/sheet/CMakeLists.txt @@ -3,6 +3,7 @@ # Source files set(sheet_SOURCES + main.cpp sheet.cpp ) kconfig_add_kcfg_files(sheet_SOURCES sheetconfig.kcfgc) diff --git a/src/effects/sheet/main.cpp b/src/effects/sheet/main.cpp new file mode 100644 index 0000000000..ace16a1995 --- /dev/null +++ b/src/effects/sheet/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "sheet.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(SheetEffectFactory, + SheetEffect, + "metadata.json", + return SheetEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/sheet/metadata.json b/src/effects/sheet/metadata.json new file mode 100644 index 0000000000..d95267c26d --- /dev/null +++ b/src/effects/sheet/metadata.json @@ -0,0 +1,13 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Make modal dialogs smoothly fly in and out when they are shown or hidden", + "EnabledByDefault": false, + "Id": "sheet", + "License": "GPL", + "Name": "Sheet", + "ServiceTypes": [ + "KWin/Effect" + ] + } +} \ No newline at end of file diff --git a/src/effects/showfps/CMakeLists.txt b/src/effects/showfps/CMakeLists.txt index 7f93f68ee5..2c3bdc12f7 100644 --- a/src/effects/showfps/CMakeLists.txt +++ b/src/effects/showfps/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(showfps_SOURCES + main.cpp showfps.cpp ) diff --git a/src/effects/showfps/main.cpp b/src/effects/showfps/main.cpp new file mode 100644 index 0000000000..5aeab0ba88 --- /dev/null +++ b/src/effects/showfps/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "showfps.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(ShowFpsEffectFactory, + ShowFpsEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/showfps/metadata.json b/src/effects/showfps/metadata.json new file mode 100644 index 0000000000..17733848aa --- /dev/null +++ b/src/effects/showfps/metadata.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Category": "Tools", + "Description": "Display KWin's performance in the corner of the screen", + "EnabledByDefault": false, + "Id": "showfps", + "License": "GPL", + "Name": "Show FPS", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_showfps_config" +} \ No newline at end of file diff --git a/src/effects/showpaint/CMakeLists.txt b/src/effects/showpaint/CMakeLists.txt index f160a9b530..353df1267f 100644 --- a/src/effects/showpaint/CMakeLists.txt +++ b/src/effects/showpaint/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(showpaint_SOURCES + main.cpp showpaint.cpp ) diff --git a/src/effects/showpaint/main.cpp b/src/effects/showpaint/main.cpp new file mode 100644 index 0000000000..f9e36b8b59 --- /dev/null +++ b/src/effects/showpaint/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "showpaint.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(ShowPaintEffectFactory, + ShowPaintEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/showpaint/metadata.json b/src/effects/showpaint/metadata.json new file mode 100644 index 0000000000..e75772e3f3 --- /dev/null +++ b/src/effects/showpaint/metadata.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Category": "Tools", + "Description": "Highlight areas of the desktop that have been recently updated", + "EnabledByDefault": false, + "Id": "showpaint", + "License": "GPL", + "Name": "Show Paint", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_showpaint_config" +} \ No newline at end of file diff --git a/src/effects/slide/CMakeLists.txt b/src/effects/slide/CMakeLists.txt index 1dd74b2afa..db8530fbe7 100644 --- a/src/effects/slide/CMakeLists.txt +++ b/src/effects/slide/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(slide_SOURCES + main.cpp slide.cpp ) diff --git a/src/effects/slide/main.cpp b/src/effects/slide/main.cpp new file mode 100644 index 0000000000..37b8bef260 --- /dev/null +++ b/src/effects/slide/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "slide.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(SlideEffectFactory, + SlideEffect, + "metadata.json", + return SlideEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/slide/metadata.json b/src/effects/slide/metadata.json new file mode 100644 index 0000000000..dc3c3afde1 --- /dev/null +++ b/src/effects/slide/metadata.json @@ -0,0 +1,18 @@ +{ + "KPlugin": { + "Category": "Virtual Desktop Switching Animation", + "Description": "Slide desktops when switching virtual desktops", + "EnabledByDefault": true, + "Id": "slide", + "License": "GPL", + "Name": "Slide", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_slide_config", + "org.kde.kwin.effect": { + "exclusiveGroup": "desktop-animations", + "video": "https://files.kde.org/plasma/kwin/effect-videos/slide.ogv" + } +} \ No newline at end of file diff --git a/src/effects/slideback/CMakeLists.txt b/src/effects/slideback/CMakeLists.txt index 1aad267f48..5731a5248b 100644 --- a/src/effects/slideback/CMakeLists.txt +++ b/src/effects/slideback/CMakeLists.txt @@ -3,6 +3,7 @@ # Source files set(slideback_SOURCES + main.cpp slideback.cpp ) diff --git a/src/effects/slideback/main.cpp b/src/effects/slideback/main.cpp new file mode 100644 index 0000000000..cdf68468cc --- /dev/null +++ b/src/effects/slideback/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "slideback.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(SlideBackEffectFactory, + SlideBackEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/slideback/metadata.json b/src/effects/slideback/metadata.json new file mode 100644 index 0000000000..291f8a453f --- /dev/null +++ b/src/effects/slideback/metadata.json @@ -0,0 +1,13 @@ +{ + "KPlugin": { + "Category": "Focus", + "Description": "Slide back windows when another window is raised", + "EnabledByDefault": false, + "Id": "slideback", + "License": "GPL", + "Name": "Slide Back", + "ServiceTypes": [ + "KWin/Effect" + ] + } +} \ No newline at end of file diff --git a/src/effects/slidingpopups/CMakeLists.txt b/src/effects/slidingpopups/CMakeLists.txt index 09c765eb08..955e2c89dc 100644 --- a/src/effects/slidingpopups/CMakeLists.txt +++ b/src/effects/slidingpopups/CMakeLists.txt @@ -3,6 +3,7 @@ # Source files set(slidingpopups_SOURCES + main.cpp slidingpopups.cpp ) diff --git a/src/effects/slidingpopups/main.cpp b/src/effects/slidingpopups/main.cpp new file mode 100644 index 0000000000..5d5804e832 --- /dev/null +++ b/src/effects/slidingpopups/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "slidingpopups.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(SlidingPopupsEffectFactory, + SlidingPopupsEffect, + "metadata.json", + return SlidingPopupsEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/slidingpopups/metadata.json b/src/effects/slidingpopups/metadata.json new file mode 100644 index 0000000000..b86a9a23e1 --- /dev/null +++ b/src/effects/slidingpopups/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Sliding animation for Plasma popups", + "EnabledByDefault": true, + "Id": "slidingpopups", + "License": "GPL", + "Name": "Sliding popups", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/sliding_popups.mp4" + } +} \ No newline at end of file diff --git a/src/effects/snaphelper/CMakeLists.txt b/src/effects/snaphelper/CMakeLists.txt index 6cab21ed4a..a30b7abc8c 100644 --- a/src/effects/snaphelper/CMakeLists.txt +++ b/src/effects/snaphelper/CMakeLists.txt @@ -3,6 +3,7 @@ # Source files set(snaphelper_SOURCES + main.cpp snaphelper.cpp ) diff --git a/src/effects/snaphelper/main.cpp b/src/effects/snaphelper/main.cpp new file mode 100644 index 0000000000..de96f08be3 --- /dev/null +++ b/src/effects/snaphelper/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "snaphelper.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(SnapHelperEffectFactory, + SnapHelperEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/snaphelper/metadata.json b/src/effects/snaphelper/metadata.json new file mode 100644 index 0000000000..12d338957c --- /dev/null +++ b/src/effects/snaphelper/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "Help you locate the center of the screen when moving a window", + "EnabledByDefault": false, + "Id": "snaphelper", + "License": "GPL", + "Name": "Snap Helper", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/snap_helper.mp4" + } +} \ No newline at end of file diff --git a/src/effects/startupfeedback/CMakeLists.txt b/src/effects/startupfeedback/CMakeLists.txt index 03691c958b..451ffbda73 100644 --- a/src/effects/startupfeedback/CMakeLists.txt +++ b/src/effects/startupfeedback/CMakeLists.txt @@ -3,6 +3,7 @@ # Source files set(startupfeedback_SOURCES + main.cpp startupfeedback.cpp ) diff --git a/src/effects/startupfeedback/main.cpp b/src/effects/startupfeedback/main.cpp new file mode 100644 index 0000000000..a3910da2cf --- /dev/null +++ b/src/effects/startupfeedback/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "startupfeedback.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(StartupFeedbackEffectFactory, + StartupFeedbackEffect, + "metadata.json", + return StartupFeedbackEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/startupfeedback/metadata.json b/src/effects/startupfeedback/metadata.json new file mode 100644 index 0000000000..14f8725d5b --- /dev/null +++ b/src/effects/startupfeedback/metadata.json @@ -0,0 +1,16 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Helper effect for startup feedback", + "EnabledByDefault": true, + "Id": "startupfeedback", + "License": "GPL", + "Name": "Startup Feedback", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "org.kde.kwin.effect": { + "internal": true + } +} \ No newline at end of file diff --git a/src/effects/thumbnailaside/CMakeLists.txt b/src/effects/thumbnailaside/CMakeLists.txt index 6a3a1579a0..e8e20dd154 100644 --- a/src/effects/thumbnailaside/CMakeLists.txt +++ b/src/effects/thumbnailaside/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(thumbnailaside_SOURCES + main.cpp thumbnailaside.cpp ) diff --git a/src/effects/thumbnailaside/main.cpp b/src/effects/thumbnailaside/main.cpp new file mode 100644 index 0000000000..429fefe25f --- /dev/null +++ b/src/effects/thumbnailaside/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "thumbnailaside.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(ThumbnailAsideEffectFactory, + ThumbnailAsideEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/thumbnailaside/metadata.json b/src/effects/thumbnailaside/metadata.json new file mode 100644 index 0000000000..b66ef30077 --- /dev/null +++ b/src/effects/thumbnailaside/metadata.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Display window thumbnails on the edge of the screen", + "EnabledByDefault": false, + "Id": "thumbnailaside", + "License": "GPL", + "Name": "Thumbnail Aside", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_thumbnailaside_config" +} \ No newline at end of file diff --git a/src/effects/touchpoints/CMakeLists.txt b/src/effects/touchpoints/CMakeLists.txt index 5a06bb4f7e..98be6e6db0 100644 --- a/src/effects/touchpoints/CMakeLists.txt +++ b/src/effects/touchpoints/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(touchpoints_SOURCES + main.cpp touchpoints.cpp ) diff --git a/src/effects/touchpoints/main.cpp b/src/effects/touchpoints/main.cpp new file mode 100644 index 0000000000..555ace14be --- /dev/null +++ b/src/effects/touchpoints/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "touchpoints.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(TouchPointsEffectFactory, + TouchPointsEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/touchpoints/metadata.json b/src/effects/touchpoints/metadata.json new file mode 100644 index 0000000000..d564940a1e --- /dev/null +++ b/src/effects/touchpoints/metadata.json @@ -0,0 +1,13 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Visualize touch points", + "EnabledByDefault": false, + "Id": "touchpoints", + "License": "GPL", + "Name": "Touch Points", + "ServiceTypes": [ + "KWin/Effect" + ] + } +} \ No newline at end of file diff --git a/src/effects/trackmouse/CMakeLists.txt b/src/effects/trackmouse/CMakeLists.txt index f7db1b2395..5335181206 100644 --- a/src/effects/trackmouse/CMakeLists.txt +++ b/src/effects/trackmouse/CMakeLists.txt @@ -4,6 +4,7 @@ install(FILES data/tm_inner.png data/tm_outer.png DESTINATION ${KDE_INSTALL_DATADIR}/kwin) set(trackmouse_SOURCES + main.cpp trackmouse.cpp ) diff --git a/src/effects/trackmouse/main.cpp b/src/effects/trackmouse/main.cpp new file mode 100644 index 0000000000..eeaa8e6040 --- /dev/null +++ b/src/effects/trackmouse/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "trackmouse.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(TrackMouseEffectFactory, + TrackMouseEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/trackmouse/metadata.json b/src/effects/trackmouse/metadata.json new file mode 100644 index 0000000000..2a416ca42f --- /dev/null +++ b/src/effects/trackmouse/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "Display a mouse cursor locating effect when activated", + "EnabledByDefault": false, + "Id": "trackmouse", + "License": "GPL", + "Name": "Track Mouse", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_trackmouse_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/track_mouse.mp4" + } +} \ No newline at end of file diff --git a/src/effects/windowgeometry/CMakeLists.txt b/src/effects/windowgeometry/CMakeLists.txt index 34ddfa825c..32e67709a0 100644 --- a/src/effects/windowgeometry/CMakeLists.txt +++ b/src/effects/windowgeometry/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(windowgeometry_SOURCES + main.cpp windowgeometry.cpp ) diff --git a/src/effects/windowgeometry/main.cpp b/src/effects/windowgeometry/main.cpp new file mode 100644 index 0000000000..4acf6db81d --- /dev/null +++ b/src/effects/windowgeometry/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "windowgeometry.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(WindowGeometryFactory, + WindowGeometry, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/windowgeometry/metadata.json b/src/effects/windowgeometry/metadata.json new file mode 100644 index 0000000000..84e9261cb6 --- /dev/null +++ b/src/effects/windowgeometry/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Display window geometries on move/resize", + "EnabledByDefault": false, + "Id": "windowgeometry", + "License": "GPL", + "Name": "Window Geometry", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_windowgeometry_config", + "org.kde.kwin.effect": { + "internal": true + } +} \ No newline at end of file diff --git a/src/effects/wobblywindows/CMakeLists.txt b/src/effects/wobblywindows/CMakeLists.txt index 97511a2a36..8e9ff2e872 100644 --- a/src/effects/wobblywindows/CMakeLists.txt +++ b/src/effects/wobblywindows/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(wobblywindows_SOURCES + main.cpp wobblywindows.cpp ) diff --git a/src/effects/wobblywindows/main.cpp b/src/effects/wobblywindows/main.cpp new file mode 100644 index 0000000000..2c40b3388b --- /dev/null +++ b/src/effects/wobblywindows/main.cpp @@ -0,0 +1,19 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "wobblywindows.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY_SUPPORTED(WobblyWindowsEffectFactory, + WobblyWindowsEffect, + "metadata.json", + return WobblyWindowsEffect::supported();) + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/wobblywindows/metadata.json b/src/effects/wobblywindows/metadata.json new file mode 100644 index 0000000000..a3b7ff3499 --- /dev/null +++ b/src/effects/wobblywindows/metadata.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Category": "Appearance", + "Description": "Deform windows while they are moving", + "EnabledByDefault": false, + "Id": "wobblywindows", + "License": "GPL", + "Name": "Wobbly Windows", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_wobblywindows_config", + "org.kde.kwin.effect": { + "video": "https://files.kde.org/plasma/kwin/effect-videos/wobbly_windows.ogv" + } +} \ No newline at end of file diff --git a/src/effects/zoom/CMakeLists.txt b/src/effects/zoom/CMakeLists.txt index b3031ab4b1..f8d5754cd5 100644 --- a/src/effects/zoom/CMakeLists.txt +++ b/src/effects/zoom/CMakeLists.txt @@ -2,6 +2,7 @@ # Effect set(zoom_SOURCES + main.cpp zoom.cpp ) diff --git a/src/effects/zoom/main.cpp b/src/effects/zoom/main.cpp new file mode 100644 index 0000000000..d670b909ea --- /dev/null +++ b/src/effects/zoom/main.cpp @@ -0,0 +1,18 @@ +/* + SPDX-FileCopyrightText: 2021 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "zoom.h" + +namespace KWin +{ + +KWIN_EFFECT_FACTORY(ZoomEffectFactory, + ZoomEffect, + "metadata.json") + +} // namespace KWin + +#include "main.moc" diff --git a/src/effects/zoom/metadata.json b/src/effects/zoom/metadata.json new file mode 100644 index 0000000000..bcd7d186d1 --- /dev/null +++ b/src/effects/zoom/metadata.json @@ -0,0 +1,18 @@ +{ + "KPlugin": { + "Category": "Accessibility", + "Description": "Magnify the entire desktop", + "EnabledByDefault": true, + "Id": "zoom", + "License": "GPL", + "Name": "Zoom", + "ServiceTypes": [ + "KWin/Effect" + ] + }, + "X-KDE-ConfigModule": "kwin_zoom_config", + "org.kde.kwin.effect": { + "exclusiveGroup": "magnifiers", + "video": "https://files.kde.org/plasma/kwin/effect-videos/zoom.ogv" + } +} \ No newline at end of file diff --git a/src/kcmkwin/common/CMakeLists.txt b/src/kcmkwin/common/CMakeLists.txt index 38db4f66cb..ed09f21d18 100644 --- a/src/kcmkwin/common/CMakeLists.txt +++ b/src/kcmkwin/common/CMakeLists.txt @@ -21,6 +21,9 @@ target_link_libraries(kcmkwincommon KF5::I18n KF5::Package KF5::KCMUtils + + # EffectsModel dependencies + kwineffects kwin4_effect_builtins ) diff --git a/src/kcmkwin/common/effectsmodel.cpp b/src/kcmkwin/common/effectsmodel.cpp index 4952f3d905..e3a7753878 100644 --- a/src/kcmkwin/common/effectsmodel.cpp +++ b/src/kcmkwin/common/effectsmodel.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -31,8 +32,11 @@ #include #include #include +#include #include +KWIN_IMPORT_BUILTIN_EFFECTS + namespace KWin { @@ -225,39 +229,54 @@ bool EffectsModel::setData(const QModelIndex &index, const QVariant &value, int void EffectsModel::loadBuiltInEffects(const KConfigGroup &kwinConfig) { - const auto builtins = BuiltInEffects::availableEffects(); - for (auto builtin : builtins) { - const BuiltInEffects::EffectData &data = BuiltInEffects::effectData(builtin); + const QVector staticPlugins = QPluginLoader::staticPlugins(); + for (const QStaticPlugin &plugin : staticPlugins) { + if (plugin.metaData().value("IID").toString() != EffectPluginFactory_iid) { + continue; + } + + const KPluginMetaData metaData = KPluginMetaData(plugin.metaData().value("MetaData").toObject(), QString()); + if (!metaData.isValid()) { + continue; + } + EffectData effect; - effect.name = data.displayName; - effect.description = data.comment; + effect.name = metaData.name(); + effect.description = metaData.description(); effect.authorName = i18n("KWin development team"); effect.authorEmail = QString(); // not used at all - effect.license = QStringLiteral("GPL"); - effect.version = QStringLiteral(KWIN_VERSION_STRING); - effect.untranslatedCategory = data.category; - effect.category = translatedCategory(data.category); - effect.serviceName = data.name; - effect.iconName = QStringLiteral("preferences-system-windows"); - effect.enabledByDefault = data.enabled; - effect.enabledByDefaultFunction = (data.enabledFunction != nullptr); + effect.license = metaData.license(); + effect.version = metaData.version(); + effect.untranslatedCategory = metaData.category(); + effect.category = translatedCategory(metaData.category()); + effect.serviceName = metaData.pluginId(); + effect.iconName = metaData.iconName(); + effect.enabledByDefault = metaData.isEnabledByDefault(); + effect.supported = true; + effect.enabledByDefaultFunction = false; + effect.internal = false; + effect.kind = Kind::BuiltIn; + effect.configModule = metaData.value(QStringLiteral("X-KDE-ConfigModule")); + effect.website = QUrl(metaData.website()); + + if (metaData.rawData().contains("org.kde.kwin.effect")) { + const QJsonObject d(metaData.rawData().value("org.kde.kwin.effect").toObject()); + effect.exclusiveGroup = d.value("exclusiveGroup").toString(); + effect.video = QUrl::fromUserInput(d.value("video").toString()); + effect.enabledByDefaultFunction = d.value("enabledByDefaultMethod").toBool(); + effect.internal = d.value("internal").toBool(); + } + const QString enabledKey = QStringLiteral("%1Enabled").arg(effect.serviceName); if (kwinConfig.hasKey(enabledKey)) { effect.status = effectStatus(kwinConfig.readEntry(effect.serviceName + "Enabled", effect.enabledByDefault)); - } else if (data.enabledFunction != nullptr) { + } else if (effect.enabledByDefaultFunction) { effect.status = Status::EnabledUndeterminded; } else { effect.status = effectStatus(effect.enabledByDefault); } - effect.originalStatus = effect.status; - effect.video = data.video; - effect.website = QUrl(); - effect.supported = true; - effect.exclusiveGroup = data.exclusiveCategory; - effect.internal = data.internal; - effect.kind = Kind::BuiltIn; - effect.configModule = data.configModule; + effect.originalStatus = effect.status; effect.configurable = !effect.configModule.isEmpty(); if (shouldStore(effect)) { diff --git a/src/kcmkwin/kwinoptions/CMakeLists.txt b/src/kcmkwin/kwinoptions/CMakeLists.txt index 4fff2a7dab..24c69dce78 100644 --- a/src/kcmkwin/kwinoptions/CMakeLists.txt +++ b/src/kcmkwin/kwinoptions/CMakeLists.txt @@ -3,7 +3,6 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwm\") set(kcm_kwinoptions_PART_SRCS - ${KWin_SOURCE_DIR}/src/effects/effect_builtins.cpp main.cpp mouse.cpp windows.cpp diff --git a/src/kcmkwin/kwinoptions/windows.cpp b/src/kcmkwin/kwinoptions/windows.cpp index 844df0d878..267fdfc136 100644 --- a/src/kcmkwin/kwinoptions/windows.cpp +++ b/src/kcmkwin/kwinoptions/windows.cpp @@ -25,7 +25,6 @@ #include "windows.h" #include "kwinoptions_settings.h" -#include #include #include "kwinoptions_settings.h" @@ -337,9 +336,9 @@ void KMovingConfig::save(void) QStringLiteral("/Effects"), QDBusConnection::sessionBus()); if (m_settings->geometryTip()) { - interface.loadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); + interface.loadEffect(QStringLiteral("windowgeometry")); } else { - interface.unloadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); + interface.unloadEffect(QStringLiteral("windowgeometry")); } } diff --git a/src/kcmkwin/kwinscreenedges/CMakeLists.txt b/src/kcmkwin/kwinscreenedges/CMakeLists.txt index cc028b4696..f3706407ea 100644 --- a/src/kcmkwin/kwinscreenedges/CMakeLists.txt +++ b/src/kcmkwin/kwinscreenedges/CMakeLists.txt @@ -36,8 +36,6 @@ set(kcm_screenedges_LIBS KF5::Package KF5::Plasma KF5::Service - - kwin4_effect_builtins ) target_link_libraries(kcm_kwinscreenedges ${X11_LIBRARIES} ${kcm_screenedges_LIBS}) diff --git a/src/kcmkwin/kwinscreenedges/main.cpp b/src/kcmkwin/kwinscreenedges/main.cpp index d019eb1bd3..8753e7554e 100644 --- a/src/kcmkwin/kwinscreenedges/main.cpp +++ b/src/kcmkwin/kwinscreenedges/main.cpp @@ -10,7 +10,6 @@ */ #include "main.h" -#include #include #include @@ -90,9 +89,9 @@ void KWinScreenEdgesConfig::save() OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), QDBusConnection::sessionBus()); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::Overview)); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::PresentWindows)); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::DesktopGrid)); + interface.reconfigureEffect(QStringLiteral("overview")); + interface.reconfigureEffect(QStringLiteral("presentwindows")); + interface.reconfigureEffect(QStringLiteral("desktopgrid")); KCModule::save(); } @@ -111,12 +110,6 @@ void KWinScreenEdgesConfig::showEvent(QShowEvent *e) monitorShowEvent(); } -// Copied from kcmkwin/kwincompositing/main.cpp -bool KWinScreenEdgesConfig::effectEnabled(const BuiltInEffect &effect, const KConfigGroup &cfg) const -{ - return cfg.readEntry(BuiltInEffects::nameForEffect(effect) + "Enabled", BuiltInEffects::enabledByDefault(effect)); -} - //----------------------------------------------------------------------------- // Monitor @@ -129,12 +122,13 @@ void KWinScreenEdgesConfig::monitorInit() m_form->monitorAddItem(i18n("Activity Manager")); m_form->monitorAddItem(i18n("Application Launcher")); - // Add the effects - const QString presentWindowsName = BuiltInEffects::effectData(BuiltInEffect::PresentWindows).displayName; + // TODO: Find a better way to get the display name of the present windows, the + // desktop grid, and the overview effect. Maybe install metadata.json files? + const QString presentWindowsName = i18n("Present Windows"); m_form->monitorAddItem(i18n("%1 - All Desktops", presentWindowsName)); m_form->monitorAddItem(i18n("%1 - Current Desktop", presentWindowsName)); m_form->monitorAddItem(i18n("%1 - Current Application", presentWindowsName)); - m_form->monitorAddItem(BuiltInEffects::effectData(BuiltInEffect::DesktopGrid).displayName); + m_form->monitorAddItem(i18n("Desktop Grid")); m_form->monitorAddItem(i18n("Toggle window switching")); m_form->monitorAddItem(i18n("Toggle alternative window switching")); @@ -279,16 +273,16 @@ void KWinScreenEdgesConfig::monitorShowEvent() KConfigGroup config(m_config, "Plugins"); // Present Windows - bool enabled = effectEnabled(BuiltInEffect::PresentWindows, config); + bool enabled = config.readEntry("presentwindowsEnabled", true); m_form->monitorItemSetEnabled(PresentWindowsCurrent, enabled); m_form->monitorItemSetEnabled(PresentWindowsAll, enabled); // Desktop Grid - enabled = effectEnabled(BuiltInEffect::DesktopGrid, config); + enabled = config.readEntry("desktopgridEnabled", true); m_form->monitorItemSetEnabled(DesktopGrid, enabled); // Overview - enabled = effectEnabled(BuiltInEffect::Overview, config); + enabled = config.readEntry("overviewEnabled", true); m_form->monitorItemSetEnabled(Overview, enabled); // tabbox, depends on reasonable focus policy. diff --git a/src/kcmkwin/kwinscreenedges/main.h b/src/kcmkwin/kwinscreenedges/main.h index 1f49069583..94b312dc11 100644 --- a/src/kcmkwin/kwinscreenedges/main.h +++ b/src/kcmkwin/kwinscreenedges/main.h @@ -23,7 +23,6 @@ namespace KWin class KWinScreenEdgeData; class KWinScreenEdgesConfigForm; class KWinScreenEdgeScriptSettings; -enum class BuiltInEffect; class KWinScreenEdgesConfig : public KCModule { @@ -59,8 +58,6 @@ private: EffectCount }; - bool effectEnabled(const BuiltInEffect &effect, const KConfigGroup &cfg) const; - void monitorInit(); void monitorLoadSettings(); void monitorLoadDefaultSettings(); diff --git a/src/kcmkwin/kwinscreenedges/touch.cpp b/src/kcmkwin/kwinscreenedges/touch.cpp index 5e06e28864..22ac1404da 100644 --- a/src/kcmkwin/kwinscreenedges/touch.cpp +++ b/src/kcmkwin/kwinscreenedges/touch.cpp @@ -10,7 +10,6 @@ */ #include "touch.h" -#include #include #include @@ -83,9 +82,9 @@ void KWinScreenEdgesConfig::save() OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), QDBusConnection::sessionBus()); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::Overview)); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::PresentWindows)); - interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::DesktopGrid)); + interface.reconfigureEffect(QStringLiteral("overview")); + interface.reconfigureEffect(QStringLiteral("presentwindows")); + interface.reconfigureEffect(QStringLiteral("desktopgrid")); KCModule::save(); } @@ -104,12 +103,6 @@ void KWinScreenEdgesConfig::showEvent(QShowEvent* e) monitorShowEvent(); } -// Copied from kcmkwin/kwincompositing/main.cpp -bool KWinScreenEdgesConfig::effectEnabled(const BuiltInEffect& effect, const KConfigGroup& cfg) const -{ - return cfg.readEntry(BuiltInEffects::nameForEffect(effect) + "Enabled", BuiltInEffects::enabledByDefault(effect)); -} - //----------------------------------------------------------------------------- // Monitor @@ -127,12 +120,13 @@ void KWinScreenEdgesConfig::monitorInit() m_form->monitorAddItem(i18n("Activity Manager")); m_form->monitorAddItem(i18n("Application Launcher")); - // Add the effects - const QString presentWindowsName = BuiltInEffects::effectData(BuiltInEffect::PresentWindows).displayName; + // TODO: Find a better way to get the display name of the present windows, the + // desktop grid, and the overview effect. Maybe install metadata.json files? + const QString presentWindowsName = i18n("Present Windows"); m_form->monitorAddItem(i18n("%1 - All Desktops", presentWindowsName)); m_form->monitorAddItem(i18n("%1 - Current Desktop", presentWindowsName)); m_form->monitorAddItem(i18n("%1 - Current Application", presentWindowsName)); - m_form->monitorAddItem(BuiltInEffects::effectData(BuiltInEffect::DesktopGrid).displayName); + m_form->monitorAddItem(i18n("Desktop Grid")); m_form->monitorAddItem(i18n("Toggle window switching")); m_form->monitorAddItem(i18n("Toggle alternative window switching")); @@ -258,16 +252,16 @@ void KWinScreenEdgesConfig::monitorShowEvent() KConfigGroup config(m_config, "Plugins"); // Present Windows - bool enabled = effectEnabled(BuiltInEffect::PresentWindows, config); + bool enabled = config.readEntry("presentwindowsEnabled", true); m_form->monitorItemSetEnabled(PresentWindowsCurrent, enabled); m_form->monitorItemSetEnabled(PresentWindowsAll, enabled); // Desktop Grid - enabled = effectEnabled(BuiltInEffect::DesktopGrid, config); + enabled = config.readEntry("desktopgridEnabled", true); m_form->monitorItemSetEnabled(DesktopGrid, enabled); // Overview - enabled = effectEnabled(BuiltInEffect::Overview, config); + enabled = config.readEntry("overviewEnabled", true); m_form->monitorItemSetEnabled(Overview, enabled); // tabbox, depends on reasonable focus policy. diff --git a/src/kcmkwin/kwinscreenedges/touch.h b/src/kcmkwin/kwinscreenedges/touch.h index 0036f0f3b6..862d5b3acc 100644 --- a/src/kcmkwin/kwinscreenedges/touch.h +++ b/src/kcmkwin/kwinscreenedges/touch.h @@ -23,7 +23,6 @@ namespace KWin class KWinTouchScreenData; class KWinTouchScreenEdgeConfigForm; class KWinTouchScreenScriptSettings; -enum class BuiltInEffect; class KWinScreenEdgesConfig : public KCModule { @@ -59,8 +58,6 @@ private: EffectCount }; - bool effectEnabled(const BuiltInEffect &effect, const KConfigGroup &cfg) const; - void monitorInit(); void monitorLoadSettings(); void monitorLoadDefaultSettings(); diff --git a/src/kcmkwin/kwintabbox/CMakeLists.txt b/src/kcmkwin/kwintabbox/CMakeLists.txt index e4c48a9ab3..8481d75fc1 100644 --- a/src/kcmkwin/kwintabbox/CMakeLists.txt +++ b/src/kcmkwin/kwintabbox/CMakeLists.txt @@ -32,8 +32,6 @@ target_link_libraries(kcm_kwintabbox KF5::Service XCB::XCB - - kwin4_effect_builtins ) install(TARGETS kcm_kwintabbox DESTINATION ${KDE_INSTALL_PLUGINDIR} ) diff --git a/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfg b/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfg index d337bc81ec..c3f3a1bce5 100644 --- a/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfg +++ b/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfg @@ -6,7 +6,7 @@ - BuiltInEffects::enabledByDefault(BuiltInEffect::HighlightWindow) + true diff --git a/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfgc b/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfgc index 93564cdb6c..38a966b75a 100644 --- a/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfgc +++ b/src/kcmkwin/kwintabbox/kwinpluginssettings.kcfgc @@ -1,7 +1,6 @@ File=kwinpluginssettings.kcfg NameSpace=KWin::TabBox ClassName=PluginsSettings -IncludeFiles=effect_builtins.h Mutators=true DefaultValueGetters=true ParentInConstructor=true diff --git a/src/kcmkwin/kwintabbox/main.cpp b/src/kcmkwin/kwintabbox/main.cpp index 338886f1c7..3cd16746f4 100644 --- a/src/kcmkwin/kwintabbox/main.cpp +++ b/src/kcmkwin/kwintabbox/main.cpp @@ -8,7 +8,6 @@ SPDX-License-Identifier: GPL-2.0-or-later */ #include "main.h" -#include #include // Qt diff --git a/src/kcmkwin/kwintabbox/main.h b/src/kcmkwin/kwintabbox/main.h index 63c66bcadf..a00e2babcc 100644 --- a/src/kcmkwin/kwintabbox/main.h +++ b/src/kcmkwin/kwintabbox/main.h @@ -18,7 +18,6 @@ namespace KWin { class KWinTabBoxConfigForm; -enum class BuiltInEffect; namespace TabBox { class KWinTabboxData; diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index ac668bb928..2e18f6350b 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -8,6 +8,7 @@ */ #include "main_wayland.h" #include "composite.h" +#include "effect_builtins.h" #include "inputmethod.h" #include "workspace.h" #include @@ -59,6 +60,8 @@ #include #include +KWIN_IMPORT_BUILTIN_EFFECTS + Q_IMPORT_PLUGIN(KWinIntegrationPlugin) Q_IMPORT_PLUGIN(KGlobalAccelImpl) Q_IMPORT_PLUGIN(KWindowSystemKWinPlugin) diff --git a/src/main_x11.cpp b/src/main_x11.cpp index 2662261ece..2674282d3d 100644 --- a/src/main_x11.cpp +++ b/src/main_x11.cpp @@ -12,6 +12,7 @@ #include +#include "effect_builtins.h" #include "platform.h" #include "sm.h" #include "workspace.h" @@ -46,6 +47,8 @@ Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtWarningMsg) +KWIN_IMPORT_BUILTIN_EFFECTS + namespace KWin { diff --git a/src/plugins/windowsystem/windoweffects.cpp b/src/plugins/windowsystem/windoweffects.cpp index 1011a1b31c..60690cae36 100644 --- a/src/plugins/windowsystem/windoweffects.cpp +++ b/src/plugins/windowsystem/windoweffects.cpp @@ -4,7 +4,6 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ #include "windoweffects.h" -#include "effect_builtins.h" #include "effects.h" #include @@ -46,11 +45,11 @@ bool WindowEffects::isEffectAvailable(KWindowEffects::Effect effect) auto e = static_cast(effects); switch (effect) { case KWindowEffects::BackgroundContrast: - return e->isEffectLoaded(BuiltInEffects::nameForEffect(BuiltInEffect::Contrast)); + return e->isEffectLoaded(QStringLiteral("contrast")); case KWindowEffects::BlurBehind: - return e->isEffectLoaded(BuiltInEffects::nameForEffect(BuiltInEffect::Blur)); + return e->isEffectLoaded(QStringLiteral("blur")); case KWindowEffects::Slide: - return e->isEffectLoaded(BuiltInEffects::nameForEffect(BuiltInEffect::SlidingPopups)); + return e->isEffectLoaded(QStringLiteral("slidingpopups")); default: // plugin does not provide integration for other effects return false;