Hi,

some of you might noticed that there was recently some discussion on
the Beryl ML about an interface which provides sharing functions and
allows us to do library plugins. One example for this kind of plugins
is text, which was recently ported to that system. I now want to
explain here how it works in general.

Core does save the shared library functions in a CompLibraryFunction struct:
struct _CompLibraryFunction {
        CompLibraryFunction *prev;
        CompLibraryFunction *next;

        char *name;
        void *function;
};

Core also gets a number of utility functions:

void addLibraryFunction (CompDisplay *d, char *name, void *function);
void removeLibraryFunction (CompDisplay *d, char *name);
void* getLibraryFunction (CompDisplay *d, char* name);
void updateLibraryFunction(CompDisplay *d, CompLibraryFunction *func);

You can register a function through addLibraryFunction and remove it
with removeLibraryFunction.
Whenever a function gets added or removed updateLibraryFunction is
called. Like initScreen/finiScreen it's done through a additional
entry in the vTable. It doesn't make sense to make this function
wrap-able, it's just too important and no plugin should be able to
stop or manipulate it.

Plugins which need a shared function can get it through
getLibraryFunction, most likely you will call that in initDisplay and
just save the pointer to the function.

When you want to see how exactly it's used in plugins you can have a
look at text-plugin, which is in beryl-plugins at trunk
(http://bugs.beryl-project.org/browser/trunk/beryl-plugins/src/text.c).

We just want to get some feedback on these ideas. If you are
interested I can provide a patch for compiz too.

Regards,
Patrick
_______________________________________________
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to