KWin
|
#include <scriptedeffect.h>
Public Slots | |
bool | borderActivated (ElectricBorder border) override |
![]() | |
virtual bool | borderActivated (ElectricBorder border) |
Signals | |
void | configChanged () |
void | animationEnded (KWin::EffectWindow *w, quint64 animationId) |
void | isActiveFullScreenEffectChanged () |
Public Member Functions | |
const QString & | scriptFile () const |
void | reconfigure (ReconfigureFlags flags) override |
int | requestedEffectChainPosition () const override |
QString | activeConfig () const |
void | setActiveConfig (const QString &name) |
~ScriptedEffect () override | |
Q_SCRIPTABLE bool | isGrabbed (KWin::EffectWindow *w, DataRole grabRole) |
Q_SCRIPTABLE bool | grab (KWin::EffectWindow *w, DataRole grabRole, bool force=false) |
Q_SCRIPTABLE bool | ungrab (KWin::EffectWindow *w, DataRole grabRole) |
Q_SCRIPTABLE QJSValue | readConfig (const QString &key, const QJSValue &defaultValue=QJSValue()) |
Q_SCRIPTABLE int | displayWidth () const |
Q_SCRIPTABLE int | displayHeight () const |
Q_SCRIPTABLE int | animationTime (int defaultTime) const |
Q_SCRIPTABLE void | registerShortcut (const QString &objectName, const QString &text, const QString &keySequence, const QJSValue &callback) |
Q_SCRIPTABLE bool | registerScreenEdge (int edge, const QJSValue &callback) |
Q_SCRIPTABLE bool | registerRealtimeScreenEdge (int edge, const QJSValue &callback) |
Q_SCRIPTABLE bool | unregisterScreenEdge (int edge) |
Q_SCRIPTABLE bool | registerTouchScreenEdge (int edge, const QJSValue &callback) |
Q_SCRIPTABLE bool | unregisterTouchScreenEdge (int edge) |
Q_SCRIPTABLE quint64 | animate (KWin::EffectWindow *window, Attribute attribute, int ms, const QJSValue &to, const QJSValue &from=QJSValue(), uint metaData=0, int curve=QEasingCurve::Linear, int delay=0, bool fullScreen=false, bool keepAlive=true, uint shaderId=0) |
Q_SCRIPTABLE QJSValue | animate (const QJSValue &object) |
Q_SCRIPTABLE quint64 | set (KWin::EffectWindow *window, Attribute attribute, int ms, const QJSValue &to, const QJSValue &from=QJSValue(), uint metaData=0, int curve=QEasingCurve::Linear, int delay=0, bool fullScreen=false, bool keepAlive=true, uint shaderId=0) |
Q_SCRIPTABLE QJSValue | set (const QJSValue &object) |
Q_SCRIPTABLE bool | retarget (quint64 animationId, const QJSValue &newTarget, int newRemainingTime=-1) |
Q_SCRIPTABLE bool | retarget (const QList< quint64 > &animationIds, const QJSValue &newTarget, int newRemainingTime=-1) |
Q_SCRIPTABLE bool | freezeInTime (quint64 animationId, qint64 frozenTime) |
Q_SCRIPTABLE bool | freezeInTime (const QList< quint64 > &animationIds, qint64 frozenTime) |
Q_SCRIPTABLE bool | redirect (quint64 animationId, Direction direction, TerminationFlags terminationFlags=TerminateAtSource) |
Q_SCRIPTABLE bool | redirect (const QList< quint64 > &animationIds, Direction direction, TerminationFlags terminationFlags=TerminateAtSource) |
Q_SCRIPTABLE bool | complete (quint64 animationId) |
Q_SCRIPTABLE bool | complete (const QList< quint64 > &animationIds) |
Q_SCRIPTABLE bool | cancel (quint64 animationId) |
Q_SCRIPTABLE bool | cancel (const QList< quint64 > &animationIds) |
Q_SCRIPTABLE QList< int > | touchEdgesForAction (const QString &action) const |
Q_SCRIPTABLE uint | addFragmentShader (ShaderTrait traits, const QString &fragmentShaderFile={}) |
Q_SCRIPTABLE void | setUniform (uint shaderId, const QString &name, const QJSValue &value) |
QHash< int, QJSValueList > & | screenEdgeCallbacks () |
QHash< int, QJSValueList > & | realtimeScreenEdgeCallbacks () |
QString | pluginId () const |
bool | isActiveFullScreenEffect () const |
![]() | |
AnimationEffect () | |
~AnimationEffect () override | |
bool | isActive () const override |
QString | debug (const QString ¶meter) const override |
void | prePaintWindow (EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime) override |
void | paintWindow (const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override |
void | postPaintScreen () override |
![]() | |
CrossFadeEffect (QObject *parent=nullptr) | |
~CrossFadeEffect () override | |
void | drawWindow (const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *window, int mask, const QRegion ®ion, WindowPaintData &data) override |
void | redirect (EffectWindow *window) |
void | unredirect (EffectWindow *window) |
void | setShader (EffectWindow *window, GLShader *shader) |
![]() | |
Effect (QObject *parent=nullptr) | |
~Effect () override | |
virtual void | prePaintScreen (ScreenPrePaintData &data, std::chrono::milliseconds presentTime) |
virtual void | paintScreen (const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion ®ion, Output *screen) |
virtual void | postPaintWindow (EffectWindow *w) |
virtual bool | provides (Feature) |
virtual bool | perform (Feature feature, const QVariantList &arguments) |
virtual void | windowInputMouseEvent (QEvent *e) |
virtual void | grabbedKeyboardEvent (QKeyEvent *e) |
virtual bool | touchDown (qint32 id, const QPointF &pos, std::chrono::microseconds time) |
virtual bool | touchMotion (qint32 id, const QPointF &pos, std::chrono::microseconds time) |
virtual bool | touchUp (qint32 id, std::chrono::microseconds time) |
virtual bool | tabletToolEvent (QTabletEvent *event) |
virtual bool | tabletToolButtonEvent (uint button, bool pressed, quint64 tabletToolId) |
virtual bool | tabletPadButtonEvent (uint button, bool pressed, void *tabletPadId) |
virtual bool | tabletPadStripEvent (int number, int position, bool isFinger, void *tabletPadId) |
virtual bool | tabletPadRingEvent (int number, int position, bool isFinger, void *tabletPadId) |
template<typename T > | |
int | animationTime (int defaultDuration) |
virtual bool | blocksDirectScanout () const |
Static Public Member Functions | |
static ScriptedEffect * | create (const QString &effectName, const QString &pathToScript, int chainPosition, const QString &exclusiveCategory) |
static ScriptedEffect * | create (const KPluginMetaData &effect) |
static bool | supported () |
![]() | |
static int | metaData (MetaType type, uint meta) |
static void | setMetaData (MetaType type, uint value, uint &meta) |
static qreal | qecGaussian (qreal progress) |
static qint64 | clock () |
![]() | |
static bool | supported () |
![]() | |
static QPointF | cursorPos () |
static double | animationTime (const KConfigGroup &cfg, const QString &key, int defaultTime) |
static double | animationTime (int defaultTime) |
static double | interpolate (double x, double y, double a) |
static void | setPositionTransformations (WindowPaintData &data, QRect ®ion, EffectWindow *w, const QRect &r, Qt::AspectRatioMode aspect) |
Protected Member Functions | |
ScriptedEffect () | |
QJSEngine * | engine () const |
bool | init (const QString &effectName, const QString &pathToScript) |
void | animationEnded (KWin::EffectWindow *w, Attribute a, uint meta) override |
![]() | |
quint64 | animate (EffectWindow *w, Attribute a, uint meta, int ms, const FPx2 &to, const QEasingCurve &curve=QEasingCurve(), int delay=0, const FPx2 &from=FPx2(), bool fullScreen=false, bool keepAlive=true, GLShader *shader=nullptr) |
quint64 | set (EffectWindow *w, Attribute a, uint meta, int ms, const FPx2 &to, const QEasingCurve &curve=QEasingCurve(), int delay=0, const FPx2 &from=FPx2(), bool fullScreen=false, bool keepAlive=true, GLShader *shader=nullptr) |
bool | retarget (quint64 animationId, FPx2 newTarget, int newRemainingTime=-1) |
bool | freezeInTime (quint64 animationId, qint64 frozenTime) |
bool | redirect (quint64 animationId, Direction direction, TerminationFlags terminationFlags=TerminateAtSource) |
bool | complete (quint64 animationId) |
bool | cancel (quint64 animationId) |
virtual void | genericAnimation (EffectWindow *w, WindowPaintData &data, float progress, uint meta) |
AniMap | state () const |
Properties | |
QString | pluginId |
bool | isActiveFullScreenEffect |
Additional Inherited Members | |
![]() | |
typedef QMap< EffectWindow *, QPair< QList< AniData >, QRect > > | AniMap |
Definition at line 26 of file scriptedeffect.h.
Definition at line 49 of file scriptedeffect.h.
Enumerator | |
---|---|
GaussianCurve |
Definition at line 61 of file scriptedeffect.h.
|
strong |
Enumerator | |
---|---|
MapTexture | |
UniformColor | |
Modulate | |
AdjustSaturation |
Definition at line 65 of file scriptedeffect.h.
|
overridedefault |
|
protected |
Definition at line 189 of file scriptedeffect.cpp.
QString KWin::ScriptedEffect::activeConfig | ( | ) | const |
uint KWin::ScriptedEffect::addFragmentShader | ( | ShaderTrait | traits, |
const QString & | fragmentShaderFile = {} ) |
Definition at line 789 of file scriptedeffect.cpp.
QJSValue KWin::ScriptedEffect::animate | ( | const QJSValue & | object | ) |
Definition at line 497 of file scriptedeffect.cpp.
quint64 KWin::ScriptedEffect::animate | ( | KWin::EffectWindow * | window, |
Attribute | attribute, | ||
int | ms, | ||
const QJSValue & | to, | ||
const QJSValue & | from = QJSValue(), | ||
uint | metaData = 0, | ||
int | curve = QEasingCurve::Linear, | ||
int | delay = 0, | ||
bool | fullScreen = false, | ||
bool | keepAlive = true, | ||
uint | shaderId = 0 ) |
Definition at line 483 of file scriptedeffect.cpp.
|
overrideprotectedvirtual |
Called whenever an animation ends.
You can reimplement this method to keep a constant transformation for the window (i.e. keep it at some opacity or position) or to start another animation.
w | The animated window. |
a | The animated attribute. |
meta | Originally supplied metadata to animate() or set(). |
Reimplemented from KWin::AnimationEffect.
Definition at line 293 of file scriptedeffect.cpp.
|
signal |
int KWin::ScriptedEffect::animationTime | ( | int | defaultTime | ) | const |
Definition at line 684 of file scriptedeffect.cpp.
|
overrideslot |
Definition at line 655 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::cancel | ( | const QList< quint64 > & | animationIds | ) |
Definition at line 574 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::cancel | ( | quint64 | animationId | ) |
Definition at line 569 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::complete | ( | const QList< quint64 > & | animationIds | ) |
Definition at line 562 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::complete | ( | quint64 | animationId | ) |
Definition at line 557 of file scriptedeffect.cpp.
|
signal |
Signal emitted whenever the effect's config changed.
|
static |
Definition at line 158 of file scriptedeffect.cpp.
|
static |
Definition at line 171 of file scriptedeffect.cpp.
int KWin::ScriptedEffect::displayHeight | ( | ) | const |
Definition at line 679 of file scriptedeffect.cpp.
int KWin::ScriptedEffect::displayWidth | ( | ) | const |
Definition at line 674 of file scriptedeffect.cpp.
|
protected |
Definition at line 784 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::freezeInTime | ( | const QList< quint64 > & | animationIds, |
qint64 | frozenTime ) |
Definition at line 538 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::freezeInTime | ( | quint64 | animationId, |
qint64 | frozenTime ) |
Definition at line 533 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::grab | ( | KWin::EffectWindow * | w, |
DataRole | grabRole, | ||
bool | force = false ) |
Grabs the window with the specified role.
w | The window. |
grabRole | The grab role. |
force | By default, if the window is already grabbed by another effect, then that window won't be grabbed by effect that called this method. If you would like to grab a window even if it's grabbed by another effect, then pass true . |
true
if the window was grabbed successfully, otherwise false
. Definition at line 593 of file scriptedeffect.cpp.
|
protected |
Definition at line 211 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::isActiveFullScreenEffect | ( | ) | const |
Definition at line 304 of file scriptedeffect.cpp.
|
signal |
bool KWin::ScriptedEffect::isGrabbed | ( | KWin::EffectWindow * | w, |
ScriptedEffect::DataRole | grabRole ) |
Whether another effect has grabbed the w
with the given grabRole
.
w | The window to check |
grabRole | The grab role to check |
true
if another window has grabbed the effect, false
otherwise Definition at line 583 of file scriptedeffect.cpp.
QString KWin::ScriptedEffect::pluginId | ( | ) | const |
Definition at line 299 of file scriptedeffect.cpp.
QJSValue KWin::ScriptedEffect::readConfig | ( | const QString & | key, |
const QJSValue & | defaultValue = QJSValue() ) |
Reads the value from the configuration data for the given key.
key | The key to search for |
defaultValue | The value to return if the key is not found |
Definition at line 666 of file scriptedeffect.cpp.
|
inline |
Definition at line 178 of file scriptedeffect.h.
|
overridevirtual |
Called when configuration changes (either the effect's or KWin's global).
In OpenGL based compositing, the frameworks ensures that the context is current when the Effect is reconfigured. If this method is called from within the Effect it is required to ensure that the context is current if the implementation does OpenGL calls.
Reimplemented from KWin::Effect.
Definition at line 627 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::redirect | ( | const QList< quint64 > & | animationIds, |
Direction | direction, | ||
TerminationFlags | terminationFlags = TerminateAtSource ) |
Definition at line 550 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::redirect | ( | quint64 | animationId, |
Direction | direction, | ||
TerminationFlags | terminationFlags = TerminateAtSource ) |
Definition at line 545 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::registerRealtimeScreenEdge | ( | int | edge, |
const QJSValue & | callback ) |
Definition at line 706 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::registerScreenEdge | ( | int | edge, |
const QJSValue & | callback ) |
Definition at line 689 of file scriptedeffect.cpp.
void KWin::ScriptedEffect::registerShortcut | ( | const QString & | objectName, |
const QString & | text, | ||
const QString & | keySequence, | ||
const QJSValue & | callback ) |
Definition at line 636 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::registerTouchScreenEdge | ( | int | edge, |
const QJSValue & | callback ) |
Definition at line 755 of file scriptedeffect.cpp.
|
inlineoverridevirtual |
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.
Reimplemented from KWin::Effect.
Definition at line 77 of file scriptedeffect.h.
bool KWin::ScriptedEffect::retarget | ( | const QList< quint64 > & | animationIds, |
const QJSValue & | newTarget, | ||
int | newRemainingTime = -1 ) |
Definition at line 526 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::retarget | ( | quint64 | animationId, |
const QJSValue & | newTarget, | ||
int | newRemainingTime = -1 ) |
Definition at line 521 of file scriptedeffect.cpp.
|
inline |
Definition at line 173 of file scriptedeffect.h.
|
inline |
Definition at line 72 of file scriptedeffect.h.
QJSValue KWin::ScriptedEffect::set | ( | const QJSValue & | object | ) |
Definition at line 516 of file scriptedeffect.cpp.
quint64 KWin::ScriptedEffect::set | ( | KWin::EffectWindow * | window, |
Attribute | attribute, | ||
int | ms, | ||
const QJSValue & | to, | ||
const QJSValue & | from = QJSValue(), | ||
uint | metaData = 0, | ||
int | curve = QEasingCurve::Linear, | ||
int | delay = 0, | ||
bool | fullScreen = false, | ||
bool | keepAlive = true, | ||
uint | shaderId = 0 ) |
Definition at line 502 of file scriptedeffect.cpp.
void KWin::ScriptedEffect::setActiveConfig | ( | const QString & | name | ) |
void KWin::ScriptedEffect::setUniform | ( | uint | shaderId, |
const QString & | name, | ||
const QJSValue & | value ) |
Definition at line 819 of file scriptedeffect.cpp.
|
static |
Definition at line 184 of file scriptedeffect.cpp.
QList< int > KWin::ScriptedEffect::touchEdgesForAction | ( | const QString & | action | ) | const |
Definition at line 309 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::ungrab | ( | KWin::EffectWindow * | w, |
DataRole | grabRole ) |
Ungrabs the window with the specified role.
w | The window. |
grabRole | The grab role. |
true
if the window was ungrabbed successfully, otherwise false
. Definition at line 610 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::unregisterScreenEdge | ( | int | edge | ) |
Definition at line 743 of file scriptedeffect.cpp.
bool KWin::ScriptedEffect::unregisterTouchScreenEdge | ( | int | edge | ) |
Definition at line 773 of file scriptedeffect.cpp.
|
read |
True if we are the active fullscreen effect
Definition at line 45 of file scriptedeffect.h.
|
read |
The plugin ID of the effect
Definition at line 41 of file scriptedeffect.h.