KWin
Loading...
Searching...
No Matches
Public Member Functions | List of all members
KWin::PluginEffectLoader Class Reference

#include <effectloader.h>

Inheritance diagram for KWin::PluginEffectLoader:
KWin::AbstractEffectLoader

Public Member Functions

 PluginEffectLoader (QObject *parent=nullptr)
 
 ~PluginEffectLoader () override
 
bool hasEffect (const QString &name) const override
 Whether this Effect Loader can load the Effect with the given name.
 
bool isEffectSupported (const QString &name) const override
 Whether the Effect with the given name is supported by the compositing backend.
 
QStringList listOfKnownEffects () const override
 All the Effects this loader knows of.
 
void clear () override
 Clears the load queue, that is all scheduled Effects are discarded from loading.
 
void queryAndLoadAll () override
 The Effect Loader should query its store for all available effects and try to load them.
 
bool loadEffect (const QString &name) override
 Synchronous loading of the Effect with the given name.
 
bool loadEffect (const KPluginMetaData &info, LoadEffectFlags flags)
 
void setPluginSubDirectory (const QString &directory)
 
- Public Member Functions inherited from KWin::AbstractEffectLoader
 ~AbstractEffectLoader () override
 
virtual void setConfig (KSharedConfig::Ptr config)
 The KSharedConfig this EffectLoader should operate on.
 

Additional Inherited Members

- Signals inherited from KWin::AbstractEffectLoader
void effectLoaded (KWin::Effect *effect, const QString &name)
 The loader emits this signal when it successfully loaded an effect.
 
- Protected Member Functions inherited from KWin::AbstractEffectLoader
 AbstractEffectLoader (QObject *parent=nullptr)
 
LoadEffectFlags readConfig (const QString &effectName, bool defaultValue) const
 Checks the configuration for the Effect identified by effectName.
 

Detailed Description

Definition at line 301 of file effectloader.h.

Constructor & Destructor Documentation

◆ PluginEffectLoader()

KWin::PluginEffectLoader::PluginEffectLoader ( QObject * parent = nullptr)
explicit

Definition at line 251 of file effectloader.cpp.

◆ ~PluginEffectLoader()

KWin::PluginEffectLoader::~PluginEffectLoader ( )
override

Definition at line 257 of file effectloader.cpp.

Member Function Documentation

◆ clear()

void KWin::PluginEffectLoader::clear ( )
overridevirtual

Clears the load queue, that is all scheduled Effects are discarded from loading.

Implements KWin::AbstractEffectLoader.

Definition at line 404 of file effectloader.cpp.

◆ hasEffect()

bool KWin::PluginEffectLoader::hasEffect ( const QString & name) const
overridevirtual

Whether this Effect Loader can load the Effect with the given name.

The Effect Loader determines whether it knows or can find an Effect called name, and thus whether it can attempt to load the Effect.

Parameters
nameThe name of the Effect to look for.
Returns
bool true if the Effect Loader knows this effect, false otherwise

Implements KWin::AbstractEffectLoader.

Definition at line 261 of file effectloader.cpp.

◆ isEffectSupported()

bool KWin::PluginEffectLoader::isEffectSupported ( const QString & name) const
overridevirtual

Whether the Effect with the given name is supported by the compositing backend.

Parameters
nameThe name of the Effect to check.
Returns
bool true if it is supported, false otherwise

Implements KWin::AbstractEffectLoader.

Definition at line 279 of file effectloader.cpp.

◆ listOfKnownEffects()

QStringList KWin::PluginEffectLoader::listOfKnownEffects ( ) const
overridevirtual

All the Effects this loader knows of.

The implementation should re-query its store whenever this method is invoked. It's possible that the store of effects changed (e.g. a new one got installed)

Returns
QStringList The internal names of the known Effects

Implements KWin::AbstractEffectLoader.

Definition at line 313 of file effectloader.cpp.

◆ loadEffect() [1/2]

bool KWin::PluginEffectLoader::loadEffect ( const KPluginMetaData & info,
LoadEffectFlags flags )

Definition at line 333 of file effectloader.cpp.

◆ loadEffect() [2/2]

bool KWin::PluginEffectLoader::loadEffect ( const QString & name)
overridevirtual

Synchronous loading of the Effect with the given name.

Loads the Effect without checking any configuration value or any enabled by default function provided by the Effect.

The loader is expected to apply the following checks: If the Effect is already loaded, the Effect should not get loaded again. Thus the loader is expected to track which Effects it has loaded, and which of those have been destroyed. The loader should check whether the Effect is supported. If the Effect indicates it is not supported, it should not get loaded.

If the Effect loaded successfully the signal effectLoaded(KWin::Effect*,const QString&) must be emitted. Otherwise the user of the loader is not able to get the loaded Effect. It's not returning the Effect as queryAndLoadAll() is working async and thus the users of the loader are expected to be prepared for async loading.

Parameters
nameThe internal name of the Effect which should be loaded
Returns
bool true if the effect could be loaded, false in error case
See also
queryAndLoadAll()
effectLoaded(KWin::Effect*,const QString&)

Implements KWin::AbstractEffectLoader.

Definition at line 324 of file effectloader.cpp.

◆ queryAndLoadAll()

void KWin::PluginEffectLoader::queryAndLoadAll ( )
overridevirtual

The Effect Loader should query its store for all available effects and try to load them.

The Effect Loader is supposed to perform this operation in a highly async way. If there is IO which needs to be performed this should be done in a background thread and a queue should be used to load the effects. The loader should make sure to not load more than one Effect in one event cycle. Loading the Effect has to be performed in the Compositor thread and thus blocks the Compositor. Therefore after loading one Effect all events should get processed first, so that the Compositor can perform a painting pass if needed. To simplify this operation one can use the EffectLoadQueue. This requires to add another loadEffect method with the custom loader specific type to refer to an Effect and LoadEffectFlags.

The LoadEffectFlags have to be determined by querying the configuration with readConfig(). If the Load flag is set the loading can proceed and all the checks from loadEffect(const QString &) have to be applied. In addition if the CheckDefaultFunction flag is set and the Effect provides such a method, it should be queried to determine whether the Effect is enabled by default. If such a method returns false the Effect should not get loaded. If the Effect does not provide a way to query whether it's enabled by default at runtime the flag can get ignored.

If the Effect loaded successfully the signal effectLoaded(KWin::Effect*,const QString&) must be emitted.

See also
loadEffect(const QString &)
effectLoaded(KWin::Effect*,const QString&)

Implements KWin::AbstractEffectLoader.

Definition at line 383 of file effectloader.cpp.

◆ setPluginSubDirectory()

void KWin::PluginEffectLoader::setPluginSubDirectory ( const QString & directory)

Definition at line 399 of file effectloader.cpp.


The documentation for this class was generated from the following files: