All pastes #384926 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-07 13:22 UTC
rendered paste body
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 want now to explain here how it works in general.

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

	char *name;
	void *function;
};

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 regist 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.

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

Regards,
Patrick