• Immutable Page
  • Info
  • Attachments

Function callbacks

Compiz++ now uses the boost::function template class for all its function callbacks instead ot the normal functions pointers. They can be used like normal function pointers for static functions. In combination with boost::bind they can also be used to call class member functions or functions with different/additional parameters.

See: http://www.boost.org/doc/libs/1_37_0/doc/html/function.html http://www.boost.org/doc/libs/1_37_0/libs/bind/bind.html

Example:

FooScreen::fooFunctionIsTooGoodForYou (NormalParam1, NormalParam2, NormalParam3, int awesome
{
...
}

and to bind it with BCOP for example:

FooScreen::FooScreen :
   FooOptions,
   ...
{
...

   optionSetNormalnitiate (fooNormalFunction)
   optionSetAwesomeInitiate (boost::bind (fooFunctionIsTooGoodForYou, _1, _2, _3, 42))
}

Development/Compiz++Documentation/C++FunctionCallbacks (last edited 2009-01-14 01:24:46 by SamSpilsbury)