[kwin] Add a virtual Effect::requestedEffectChainPosition
This method replaces the X-KDE-ORDERING property in the Effect's desktop files. This change is a preparation step for integrating the new Effect Loader which doesn't read the ordering information. Thus it needs to be provided by the Effect itself so that the EffectsHandler can properly insert it into the chain. Also for the built-in Effects on the long run it doesn't make much sense to install the desktop files. And binary plugin effects will migrate to json metadata which also doesn't have the KService::Ptr. Thus overall it simplifies to read this information directly from the Effect.
This commit is contained in:
parent
42ff5e0c08
commit
3bbc9436db
58 changed files with 141 additions and 34 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,6 +43,10 @@ public:
|
|||
virtual void postPaintScreen();
|
||||
virtual bool isActive() const;
|
||||
|
||||
int requestedEffectChainPosition() const override {
|
||||
return 50;
|
||||
}
|
||||
|
||||
static bool supported();
|
||||
|
||||
// for properties
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,6 +43,10 @@ public:
|
|||
virtual void postPaintScreen();
|
||||
virtual bool isActive() const;
|
||||
|
||||
int requestedEffectChainPosition() const override {
|
||||
return 90;
|
||||
}
|
||||
|
||||
static bool supported();
|
||||
|
||||
private Q_SLOTS:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -603,6 +603,11 @@ double Effect::animationTime(int defaultTime)
|
|||
return qMax(defaultTime * effects->animationTimeFactor(), 1.);
|
||||
}
|
||||
|
||||
int Effect::requestedEffectChainPosition() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//****************************************
|
||||
// EffectsHandler
|
||||
//****************************************
|
||||
|
|
|
@ -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();
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
|
|
@ -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<QAction*, QScriptValue> m_shortcutCallbacks;
|
||||
QHash<int, QList<QScriptValue> > m_screenEdgeCallbacks;
|
||||
KConfigLoader *m_config;
|
||||
int m_chainPosition;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue