[compiz] Python plugin (Python API for Compiz)

Mike Dransfield mike at blueroot.co.uk
Tue Apr 10 09:27:46 PDT 2007

Travis Watkins wrote:
> On 4/9/07, Mike Dransfield <mike at blueroot.co.uk> wrote:
>> Here is my python loader plugin which loads plain python
>> scripts as full plugins.
> Instead of zoomPreparePaintScreen you should just be able to have
> preparePaintScreen and have the C side call WRAP/UNWRAP around running
> this method. Python plugin writers should never have to know about
> WRAP/UNWRAP, just defining a method with the right name should be
> enough to get it called.

I tried something similar to this, originally the plugin used
functions rather than classes (thats why some are still named
zoom*).  When I changed it to use a class for each plugin the wrapped
functions stopped working.  I assumed it was because it
was losing reference to the object instance.

I might have been doing something else wrong though.
The easy solution at the time was add a string with the
method name.  This allows plugin writers more flexibility
although I could just use a default name if none is provided.

Removing WRAP/UNWRAP totally seems virtually impossible
without losing a lot of functionality.  If I make them just provide
a named method then I have to check each plugins attributes
one by one and they would still have to call unwrap/call/wrap
themselves during the wrapped function.  Notice how inactive
calls the core method at a specific point, that would be hard
to do without the wrap function.

If anyone has any ideas on making wrap/unwrap less
complicated without removing the functionality then I would
like to hear about it :)

More information about the compiz mailing list