Hi all,

sending this mail also to Plasma to get more feedback.

*Background*:
As you might know the KWin effect library does not provide a stable ABI which 
would be a 
requirement to move most of the effects out of KWin or to get developers having 
their own 
effects on kde-look. KWin ships in  my opinion too many effects and many are in 
a bad or 
proof of concept state. Nevertheless for obvious reasons I do not want to 
delete them.

*How to fix the problem?*:
We need a stable ABI. So I have been thinking a lot on how to get there. The 
Effects library 
provides two pure virtual classes "EffectsHandler" and "EffectWindow" which are 
both used 
by the effects and implemented in core. The problem now is that extending for 
example 
EffectWindow by adding a new virtual method would break the ABI.

*Idea how to fix it*:
Now I want to outline how I think we can fix it. The general idea is to keep 
the interface to the 
effects stable by removing all virtuals from EffectsHandler and EffectWindow 
and to delegate 
to a pure virtual EffectBridge which is implemented in core. Whenever we need a 
new 
method we add a subclass to EffectBridge and add the virtual. The 
EffectsHandler itself can 
just be extended with the new method without breaking ABI.

Example code EfffectsHandler header:
class EffectsHandlerPrivate;
public class EffectsHandler
{
public:
    void setNumberOfDesktops(int newDesktops);

private:
    const EffectsHandlerPrivate *d;
};

Example code EffectsHandler cpp:
class EffectsHandlerPrivate
{
public:
    EffectsBridge* bridge;
}

void EffectsHandler::setNumberOfDesktops(int newDesktops)
{
    d->bridge->setNumberOfDesktops(2);
}

Example code for Bridge:
public class EffectsBridge
{
public:
    virtual void setNumberOfDesktops = 0;
};

Example code for adding new virtual method:
public class EffectsBridge2 : public EffectsBridge
{
public:
    virtual bool isWayland() const = 0;
};

class EffectsHandlerPrivate
{
public:
    EffectsBridge2* bridge;
}

So I hope to get some feedback on whether this will work. I would target this 
change to 
happen just before or at Tokamak and hope to get some API review by Kevin.

Disclaimer:
Even after that change we cannot make the ABI stable in 4.7 as there is also 
some work 
needed on other parts like the GLUtils or WindowPaintData.

Cheers
Martin

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to