[compiz] re-work option initialization

David Reveman davidr at novell.com
Thu Mar 29 02:02:52 PDT 2007


Dennis Kasprzyk and I have been discussing some changes to how options
are initialized.

Problems with how options are currently initialized.

1. Helper functions are not used to initialize options, which means that
if we make a change to the option structure, all option initialization
code needs to be updated. Using helper functions will also reduces the
amount of duplicate code.

2. No convenient way to get the initial value of an option once it's
been modified.

3. An option can't be initialized without compiz running.


2 and 3 are of interest to configuration backends that like to be able
to do offline readout of option information and some kind of standard
default value. 3, might be hard to provide for all kind of plugins as
some might rely on a unique plugin loader to be present so I'm not sure
that I want to recommend a configuration backend to do this. However,
it's easy to provide for plugins built as shared libraries and I don't
want to prevent anyone from doing this if they wish to.


Here's our current idea for how we can solve these issues:

Add

typedef Bool (*InitPlugin(Display|Screen)OptionProc) (CompOption *o,
                                                      int        index);

or

typedef Bool (*InitPlugin(Display|Screen)OptionsProc) (CompOption **o);

and the number of display and screen options to the plugin vTable. I
prefer the function prototype with the index as it's a bit more
flexible.

We can add a set of option initialization macros to compiz.h or helper
functions to a library, which will make the initPluginOption function in
each plugin minimal.

Action options will be changed to contain a string or KeySym instead of
the current key-code.

- David



More information about the compiz mailing list