diff --git a/effects.cpp b/effects.cpp index c93782e89b..82a50fbcea 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1482,7 +1482,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault) } if (Effect *e = loadBuiltInEffect(internalname.remove(QStringLiteral("kwin4_effect_")).toUtf8(), checkDefault)) { - effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, e)); + effect_order.insert(e->requestedEffectChainPosition(), EffectPair(name, e)); effectsChanged(); return true; } @@ -1563,7 +1563,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault) Effect* e = create(); - effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, e)); + effect_order.insert(e->requestedEffectChainPosition(), EffectPair(name, e)); effectsChanged(); effect_libraries[ name ] = library; @@ -1600,12 +1600,12 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi qDebug() << "Could not locate the effect script"; return false; } - ScriptedEffect *effect = ScriptedEffect::create(name, scriptFile); + ScriptedEffect *effect = ScriptedEffect::create(name, scriptFile, service->property(QStringLiteral("X-KDE-Ordering")).toInt()); if (!effect) { qDebug() << "Could not initialize scripted effect: " << name; return false; } - effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, effect)); + effect_order.insert(effect->requestedEffectChainPosition(), EffectPair(name, effect)); effectsChanged(); return true; } diff --git a/effects/backgroundcontrast/contrast.desktop b/effects/backgroundcontrast/contrast.desktop index 4f321f0437..c926937a0b 100644 --- a/effects/backgroundcontrast/contrast.desktop +++ b/effects/backgroundcontrast/contrast.desktop @@ -72,6 +72,5 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=76 X-KWin-Requires-OpenGL=true X-KWin-Requires-Shaders=true diff --git a/effects/backgroundcontrast/contrast.h b/effects/backgroundcontrast/contrast.h index ea61400c0f..da7999d897 100644 --- a/effects/backgroundcontrast/contrast.h +++ b/effects/backgroundcontrast/contrast.h @@ -52,6 +52,10 @@ public: virtual bool provides(Feature feature); + int requestedEffectChainPosition() const override { + return 76; + } + public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow *w); void slotPropertyNotify(KWin::EffectWindow *w, long atom); diff --git a/effects/blur/blur.desktop b/effects/blur/blur.desktop index 58d87854fa..edb382664d 100644 --- a/effects/blur/blur.desktop +++ b/effects/blur/blur.desktop @@ -165,6 +165,5 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=75 X-KWin-Requires-OpenGL=true X-KWin-Requires-Shaders=true diff --git a/effects/blur/blur.h b/effects/blur/blur.h index d12c692016..fe70b6de45 100644 --- a/effects/blur/blur.h +++ b/effects/blur/blur.h @@ -57,6 +57,10 @@ public: } virtual bool provides(Feature feature); + int requestedEffectChainPosition() const override { + return 75; + } + public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow *w); void slotWindowDeleted(KWin::EffectWindow *w); diff --git a/effects/coverswitch/coverswitch.h b/effects/coverswitch/coverswitch.h index 75ebdfb58a..17307e4e49 100644 --- a/effects/coverswitch/coverswitch.h +++ b/effects/coverswitch/coverswitch.h @@ -91,6 +91,10 @@ public: return secondaryTabBox; } + int requestedEffectChainPosition() const override { + return 50; + } + public Q_SLOTS: void slotWindowClosed(KWin::EffectWindow *c); void slotTabBoxAdded(int mode); diff --git a/effects/cube/cube.desktop b/effects/cube/cube.desktop index 5ae4e925f2..f69e329508 100644 --- a/effects/cube/cube.desktop +++ b/effects/cube/cube.desktop @@ -164,6 +164,5 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Requires-OpenGL=true X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/desktop_cube.ogv diff --git a/effects/cube/cube.h b/effects/cube/cube.h index 71338c91dd..8adb6c5f2d 100644 --- a/effects/cube/cube.h +++ b/effects/cube/cube.h @@ -68,6 +68,10 @@ public: virtual void windowInputMouseEvent(QEvent* e); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + // proxy functions virtual void* proxy(); void registerCubeInsideEffect(CubeInsideEffect* effect); diff --git a/effects/cube/cubeslide.desktop b/effects/cube/cubeslide.desktop index 9023e670a3..4e781e785b 100644 --- a/effects/cube/cubeslide.desktop +++ b/effects/cube/cubeslide.desktop @@ -146,7 +146,6 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Requires-OpenGL=true X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/desktop_cube_animation.ogv X-KWin-Exclusive-Category=desktop-animations diff --git a/effects/cube/cubeslide.h b/effects/cube/cubeslide.h index 4f346c0fb4..92369f18a6 100644 --- a/effects/cube/cubeslide.h +++ b/effects/cube/cubeslide.h @@ -49,6 +49,10 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + static bool supported(); // for properties diff --git a/effects/dashboard/dashboard.desktop b/effects/dashboard/dashboard.desktop index 25ff4eca8f..7b9ab23a15 100644 --- a/effects/dashboard/dashboard.desktop +++ b/effects/dashboard/dashboard.desktop @@ -145,5 +145,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=85 X-KWin-Internal=true diff --git a/effects/dashboard/dashboard.h b/effects/dashboard/dashboard.h index 2b1ba239a9..9c46f12ebf 100644 --- a/effects/dashboard/dashboard.h +++ b/effects/dashboard/dashboard.h @@ -43,6 +43,10 @@ public: virtual void reconfigure(ReconfigureFlags); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 85; + } + // for properties qreal configuredBrightness() const { return brightness; diff --git a/effects/desktopgrid/desktopgrid.desktop b/effects/desktopgrid/desktopgrid.desktop index e6fc40fafd..31014e30f8 100644 --- a/effects/desktopgrid/desktopgrid.desktop +++ b/effects/desktopgrid/desktopgrid.desktop @@ -157,5 +157,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/desktop_grid.mp4 diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h index a9d5577e1e..9c31b6729e 100644 --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -70,6 +70,10 @@ public: virtual bool borderActivated(ElectricBorder border); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + enum { LayoutPager, LayoutAutomatic, LayoutCustom }; // Layout modes // for properties diff --git a/effects/diminactive/diminactive.desktop b/effects/diminactive/diminactive.desktop index 62704f7141..5e4f990258 100644 --- a/effects/diminactive/diminactive.desktop +++ b/effects/diminactive/diminactive.desktop @@ -160,5 +160,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/dim_inactive.mp4 diff --git a/effects/diminactive/diminactive.h b/effects/diminactive/diminactive.h index 32fec7f538..3eee204d3e 100644 --- a/effects/diminactive/diminactive.h +++ b/effects/diminactive/diminactive.h @@ -45,6 +45,10 @@ public: virtual void prePaintScreen(ScreenPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); + int requestedEffectChainPosition() const override { + return 50; + } + // for properties bool isDimPanels() const { return dim_panels; diff --git a/effects/fallapart/fallapart.desktop b/effects/fallapart/fallapart.desktop index 6705e7db20..e44380b264 100644 --- a/effects/fallapart/fallapart.desktop +++ b/effects/fallapart/fallapart.desktop @@ -160,5 +160,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=70 X-KWin-Requires-OpenGL=true diff --git a/effects/fallapart/fallapart.h b/effects/fallapart/fallapart.h index 6b23c030b0..6ac3d93914 100644 --- a/effects/fallapart/fallapart.h +++ b/effects/fallapart/fallapart.h @@ -40,6 +40,10 @@ public: virtual void postPaintScreen(); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 70; + } + // for properties int configuredBlockSize() const { return blockSize; diff --git a/effects/flipswitch/flipswitch.desktop b/effects/flipswitch/flipswitch.desktop index 70f1ff598e..dc9a7c1653 100644 --- a/effects/flipswitch/flipswitch.desktop +++ b/effects/flipswitch/flipswitch.desktop @@ -148,6 +148,5 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Requires-OpenGL=true X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/flip_switch.mp4 diff --git a/effects/flipswitch/flipswitch.h b/effects/flipswitch/flipswitch.h index 460a9aab3f..058e6b3835 100644 --- a/effects/flipswitch/flipswitch.h +++ b/effects/flipswitch/flipswitch.h @@ -53,6 +53,10 @@ public: virtual void windowInputMouseEvent(QEvent* e); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + static bool supported(); // for properties diff --git a/effects/glide/glide.desktop b/effects/glide/glide.desktop index 0f0a4fe4fd..6191766756 100644 --- a/effects/glide/glide.desktop +++ b/effects/glide/glide.desktop @@ -134,5 +134,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Requires-OpenGL=true diff --git a/effects/glide/glide.h b/effects/glide/glide.h index 487fe30670..81e11a9699 100644 --- a/effects/glide/glide.h +++ b/effects/glide/glide.h @@ -47,6 +47,10 @@ public: virtual void postPaintWindow(EffectWindow* w); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + static bool supported(); // for properties diff --git a/effects/highlightwindow/highlightwindow.desktop b/effects/highlightwindow/highlightwindow.desktop index b5505338b7..02491a22d1 100644 --- a/effects/highlightwindow/highlightwindow.desktop +++ b/effects/highlightwindow/highlightwindow.desktop @@ -146,6 +146,5 @@ X-KDE-PluginInfo-Category=Appearance X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-Ordering=70 X-KDE-Library=kwin4_effect_builtins X-KWin-Internal=true diff --git a/effects/highlightwindow/highlightwindow.h b/effects/highlightwindow/highlightwindow.h index 4cfd2081e4..ea2a1ea4f2 100644 --- a/effects/highlightwindow/highlightwindow.h +++ b/effects/highlightwindow/highlightwindow.h @@ -38,6 +38,10 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 70; + } + public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow* w); void slotWindowClosed(KWin::EffectWindow *w); diff --git a/effects/kscreen/kscreen.desktop b/effects/kscreen/kscreen.desktop index 922da46899..fc6860ff5b 100644 --- a/effects/kscreen/kscreen.desktop +++ b/effects/kscreen/kscreen.desktop @@ -91,7 +91,6 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=99 X-KWin-Requires-OpenGL=false X-KWin-Requires-Shaders=false X-KWin-Internal=true diff --git a/effects/kscreen/kscreen.h b/effects/kscreen/kscreen.h index 278deeda09..b6b5c7a029 100644 --- a/effects/kscreen/kscreen.h +++ b/effects/kscreen/kscreen.h @@ -43,6 +43,10 @@ public: void reconfigure(ReconfigureFlags flags); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 99; + } + private Q_SLOTS: void propertyNotify(KWin::EffectWindow *window, long atom); diff --git a/effects/logout/logout.desktop b/effects/logout/logout.desktop index 13da61a1b8..ad89f18e56 100644 --- a/effects/logout/logout.desktop +++ b/effects/logout/logout.desktop @@ -165,4 +165,3 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=85 diff --git a/effects/logout/logout.h b/effects/logout/logout.h index 0180e28bbc..8cb6f24756 100644 --- a/effects/logout/logout.h +++ b/effects/logout/logout.h @@ -47,6 +47,10 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 85; + } + // for properties bool isUseBlur() const { return useBlur; diff --git a/effects/magiclamp/magiclamp.desktop b/effects/magiclamp/magiclamp.desktop index d2c6f87e06..c3e3005b66 100644 --- a/effects/magiclamp/magiclamp.desktop +++ b/effects/magiclamp/magiclamp.desktop @@ -156,7 +156,6 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Requires-OpenGL=true X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/magic_lamp.ogv X-KWin-Exclusive-Category=minimize diff --git a/effects/magiclamp/magiclamp.h b/effects/magiclamp/magiclamp.h index 0a6b0f4f18..373c9930ae 100644 --- a/effects/magiclamp/magiclamp.h +++ b/effects/magiclamp/magiclamp.h @@ -43,6 +43,10 @@ public: virtual void postPaintScreen(); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + static bool supported(); // for properties diff --git a/effects/minimizeanimation/minimizeanimation.desktop b/effects/minimizeanimation/minimizeanimation.desktop index 8eae515f13..70b2bc3020 100644 --- a/effects/minimizeanimation/minimizeanimation.desktop +++ b/effects/minimizeanimation/minimizeanimation.desktop @@ -163,6 +163,5 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/minimize.ogv X-KWin-Exclusive-Category=minimize diff --git a/effects/minimizeanimation/minimizeanimation.h b/effects/minimizeanimation/minimizeanimation.h index 7e71625657..f6fd13d2e8 100644 --- a/effects/minimizeanimation/minimizeanimation.h +++ b/effects/minimizeanimation/minimizeanimation.h @@ -45,6 +45,10 @@ public: virtual void postPaintScreen(); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + public Q_SLOTS: void slotWindowDeleted(KWin::EffectWindow *w); void slotWindowMinimized(KWin::EffectWindow *w); diff --git a/effects/presentwindows/presentwindows.desktop b/effects/presentwindows/presentwindows.desktop index fc19bf2ac9..9386f75054 100644 --- a/effects/presentwindows/presentwindows.desktop +++ b/effects/presentwindows/presentwindows.desktop @@ -159,5 +159,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=70 X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/present_windows.mp4 diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index ac2699a337..594e5ad4ab 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -124,6 +124,10 @@ public: virtual void grabbedKeyboardEvent(QKeyEvent *e); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 70; + } + enum { LayoutNatural, LayoutRegularGrid, LayoutFlexibleGrid }; // Layout modes enum PresentWindowsMode { ModeAllDesktops, // Shows windows of all desktops diff --git a/effects/resize/resize.desktop b/effects/resize/resize.desktop index 480ef0259a..7d11ba5042 100644 --- a/effects/resize/resize.desktop +++ b/effects/resize/resize.desktop @@ -131,4 +131,3 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=60 diff --git a/effects/resize/resize.h b/effects/resize/resize.h index 5b1610fe06..4b79bbc98e 100644 --- a/effects/resize/resize.h +++ b/effects/resize/resize.h @@ -44,6 +44,10 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void reconfigure(ReconfigureFlags); + int requestedEffectChainPosition() const override { + return 60; + } + bool isTextureScale() const { return m_features & TextureScale; } diff --git a/effects/screenedge/screenedgeeffect.desktop b/effects/screenedge/screenedgeeffect.desktop index d241796439..e4103a844a 100644 --- a/effects/screenedge/screenedgeeffect.desktop +++ b/effects/screenedge/screenedgeeffect.desktop @@ -94,4 +94,3 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=90 diff --git a/effects/screenedge/screenedgeeffect.h b/effects/screenedge/screenedgeeffect.h index 7e1b78a8d4..94e7c6d3f6 100644 --- a/effects/screenedge/screenedgeeffect.h +++ b/effects/screenedge/screenedgeeffect.h @@ -39,6 +39,11 @@ public: virtual void prePaintScreen(ScreenPrePaintData &data, int time); virtual void paintScreen(int mask, QRegion region, ScreenPaintData &data); virtual bool isActive() const; + + int requestedEffectChainPosition() const override { + return 90; + } + private Q_SLOTS: void edgeApproaching(ElectricBorder border, qreal factor, const QRect &geometry); void cleanup(); diff --git a/effects/screenshot/screenshot.desktop b/effects/screenshot/screenshot.desktop index 8750badfdd..39069aaed8 100644 --- a/effects/screenshot/screenshot.desktop +++ b/effects/screenshot/screenshot.desktop @@ -128,5 +128,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Internal=true diff --git a/effects/screenshot/screenshot.h b/effects/screenshot/screenshot.h index a7439df458..eed72a54ba 100644 --- a/effects/screenshot/screenshot.h +++ b/effects/screenshot/screenshot.h @@ -42,6 +42,10 @@ public: virtual void postPaintScreen(); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + static bool supported(); static void convertFromGLImage(QImage &img, int w, int h); public Q_SLOTS: diff --git a/effects/sheet/sheet.desktop b/effects/sheet/sheet.desktop index c92def33ed..f47653c4fc 100644 --- a/effects/sheet/sheet.desktop +++ b/effects/sheet/sheet.desktop @@ -146,5 +146,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=60 X-KWin-Requires-OpenGL=true diff --git a/effects/sheet/sheet.h b/effects/sheet/sheet.h index 79fbf557e0..4b69a17d64 100644 --- a/effects/sheet/sheet.h +++ b/effects/sheet/sheet.h @@ -43,6 +43,10 @@ public: virtual void postPaintWindow(EffectWindow* w); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 60; + } + static bool supported(); // for properties diff --git a/effects/slide/slide.desktop b/effects/slide/slide.desktop index 39925badc5..59f3db28c4 100644 --- a/effects/slide/slide.desktop +++ b/effects/slide/slide.desktop @@ -151,6 +151,5 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/slide.ogv X-KWin-Exclusive-Category=desktop-animations diff --git a/effects/slide/slide.h b/effects/slide/slide.h index 2e2f2ff5a6..0bfe5ab366 100644 --- a/effects/slide/slide.h +++ b/effects/slide/slide.h @@ -43,6 +43,10 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + private Q_SLOTS: void slotDesktopChanged(int old, int current); diff --git a/effects/slideback/slideback.desktop b/effects/slideback/slideback.desktop index c460e71935..8b96681a78 100644 --- a/effects/slideback/slideback.desktop +++ b/effects/slideback/slideback.desktop @@ -118,4 +118,3 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 diff --git a/effects/slideback/slideback.h b/effects/slideback/slideback.h index 2bed4a0798..c71502e5e4 100644 --- a/effects/slideback/slideback.h +++ b/effects/slideback/slideback.h @@ -42,6 +42,10 @@ public: virtual void postPaintScreen(); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 50; + } + public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow *w); void slotWindowDeleted(KWin::EffectWindow *w); diff --git a/effects/slidingpopups/slidingpopups.desktop b/effects/slidingpopups/slidingpopups.desktop index a8f76e8e0b..f47d571366 100644 --- a/effects/slidingpopups/slidingpopups.desktop +++ b/effects/slidingpopups/slidingpopups.desktop @@ -141,5 +141,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=40 X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/sliding_popups.mp4 diff --git a/effects/slidingpopups/slidingpopups.h b/effects/slidingpopups/slidingpopups.h index 77f0103b49..ac3cf101d4 100644 --- a/effects/slidingpopups/slidingpopups.h +++ b/effects/slidingpopups/slidingpopups.h @@ -44,6 +44,10 @@ public: virtual void postPaintWindow(EffectWindow* w); virtual void reconfigure(ReconfigureFlags flags); virtual bool isActive() const; + + int requestedEffectChainPosition() const override { + return 40; + } // TODO react also on virtual desktop changes // for properties diff --git a/effects/startupfeedback/startupfeedback.desktop b/effects/startupfeedback/startupfeedback.desktop index 148f40b8e4..333d17aaad 100644 --- a/effects/startupfeedback/startupfeedback.desktop +++ b/effects/startupfeedback/startupfeedback.desktop @@ -122,6 +122,5 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=90 X-KWin-Requires-OpenGL=true X-KWin-Internal=true diff --git a/effects/startupfeedback/startupfeedback.h b/effects/startupfeedback/startupfeedback.h index 4982d14cb3..ca4d747abe 100644 --- a/effects/startupfeedback/startupfeedback.h +++ b/effects/startupfeedback/startupfeedback.h @@ -43,6 +43,10 @@ public: virtual void postPaintScreen(); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 90; + } + static bool supported(); private Q_SLOTS: diff --git a/effects/windowgeometry/windowgeometry.desktop b/effects/windowgeometry/windowgeometry.desktop index 901911fb45..f28d6941c1 100644 --- a/effects/windowgeometry/windowgeometry.desktop +++ b/effects/windowgeometry/windowgeometry.desktop @@ -129,6 +129,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-EnabledByDefault=false # The plugin (library) which contains the effect. One library may contain more effects. X-KDE-Library=kwin4_effect_builtins -# The order in which this effect is loaded. Lower numbers are loaded first. -X-KDE-Ordering=90 X-KWin-Internal=true diff --git a/effects/windowgeometry/windowgeometry.h b/effects/windowgeometry/windowgeometry.h index 3ee29209ba..276eaf1d2d 100644 --- a/effects/windowgeometry/windowgeometry.h +++ b/effects/windowgeometry/windowgeometry.h @@ -42,6 +42,10 @@ public: void paintScreen(int mask, QRegion region, ScreenPaintData &data); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 90; + } + // for properties bool isHandlesMoves() const { return iHandleMoves; diff --git a/effects/wobblywindows/wobblywindows.desktop b/effects/wobblywindows/wobblywindows.desktop index 82e5f539b4..5cca7f8786 100644 --- a/effects/wobblywindows/wobblywindows.desktop +++ b/effects/wobblywindows/wobblywindows.desktop @@ -157,6 +157,5 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=45 X-KWin-Requires-OpenGL=true X-KWin-Video-Url=http://files.kde.org/plasma/kwin/effect-videos/wobbly_windows.ogv diff --git a/effects/wobblywindows/wobblywindows.h b/effects/wobblywindows/wobblywindows.h index 69d1f879ea..165ec726aa 100644 --- a/effects/wobblywindows/wobblywindows.h +++ b/effects/wobblywindows/wobblywindows.h @@ -53,6 +53,10 @@ public: virtual void postPaintScreen(); virtual bool isActive() const; + int requestedEffectChainPosition() const override { + return 45; + } + // Wobbly model parameters void setStiffness(qreal stiffness); void setDrag(qreal drag); diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 5bdb2c8c30..328d712b5d 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -603,6 +603,11 @@ double Effect::animationTime(int defaultTime) return qMax(defaultTime * effects->animationTimeFactor(), 1.); } +int Effect::requestedEffectChainPosition() const +{ + return 0; +} + //**************************************** // EffectsHandler //**************************************** diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 7daeac6971..a190b03323 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -528,6 +528,20 @@ public: */ virtual QString debug(const QString ¶meter) const; + /** + * Reimplement this method to indicate where in the Effect chain the Effect should be placed. + * + * A low number indicates early chain position, thus before other Effects got called, a high + * number indicates a late position. The returned number should be in the interval [0, 100]. + * The default value is 0. + * + * In KWin4 this information was provided in the Effect's desktop file as property + * X-KDE-Ordering. In the case of Scripted Effects this property is still used. + * + * @since 5.0 + **/ + virtual int requestedEffectChainPosition() const; + static QPoint cursorPos(); /** diff --git a/scripting/scriptedeffect.cpp b/scripting/scriptedeffect.cpp index f3ef8f2465..713c2f29f0 100644 --- a/scripting/scriptedeffect.cpp +++ b/scripting/scriptedeffect.cpp @@ -380,16 +380,17 @@ ScriptedEffect *ScriptedEffect::create(KService::Ptr effect) qDebug() << "Could not locate the effect script"; return nullptr; } - return ScriptedEffect::create(name, scriptFile); + return ScriptedEffect::create(name, scriptFile, effect->property(QStringLiteral("X-KDE-Ordering")).toInt()); } -ScriptedEffect *ScriptedEffect::create(const QString& effectName, const QString& pathToScript) +ScriptedEffect *ScriptedEffect::create(const QString& effectName, const QString& pathToScript, int chainPosition) { ScriptedEffect *effect = new ScriptedEffect(); if (!effect->init(effectName, pathToScript)) { delete effect; return nullptr; } + effect->m_chainPosition = chainPosition; return effect; } @@ -398,6 +399,7 @@ ScriptedEffect::ScriptedEffect() , m_engine(new QScriptEngine(this)) , m_scriptFile(QString()) , m_config(nullptr) + , m_chainPosition(0) { connect(m_engine, SIGNAL(signalHandlerException(QScriptValue)), SLOT(signalHandlerException(QScriptValue))); } diff --git a/scripting/scriptedeffect.h b/scripting/scriptedeffect.h index 3a333d0bd9..39af241b3e 100644 --- a/scripting/scriptedeffect.h +++ b/scripting/scriptedeffect.h @@ -104,10 +104,13 @@ public: return m_scriptFile; } virtual void reconfigure(ReconfigureFlags flags); + int requestedEffectChainPosition() const override { + return m_chainPosition; + } QString activeConfig() const; void setActiveConfig(const QString &name); static ScriptedEffect *create(KService::Ptr effect); - static ScriptedEffect *create(const QString &effectName, const QString &pathToScript); + static ScriptedEffect *create(const QString &effectName, const QString &pathToScript, int chainPosition); virtual ~ScriptedEffect(); /** * Whether another effect has grabbed the @p w with the given @p grabRole. @@ -155,6 +158,7 @@ private: QHash m_shortcutCallbacks; QHash > m_screenEdgeCallbacks; KConfigLoader *m_config; + int m_chainPosition; }; }