PDA

View Full Version : Compiz Plugin Templates


PaK
December 12th, 2006, 06:04 PM
Few months ago David released this right now this template is probably out of date but i thnik this is good start to create new plugin template with some documentation how plugins works and put result of that work into wiki off cours :)

http://people.freedesktop.org/~davidr/compiz-plugin-templates.tar.bz2

mikedee
December 12th, 2006, 06:15 PM
Have a look at my hello world plugin in this forum, it is basically a template but it is documented and responds to a key binding.

goma
May 23rd, 2008, 05:17 AM
Can anyone tell me how out of date this plugin template is? I know it is out-of-date, but i have been in search of something like this so just wondering if it is usable at all.. Thanks.

b0le
May 23rd, 2008, 06:01 AM
Completely out of date. I suggest looking at http://wiki.compiz-fusion.org/Development/ExamplePlugins

goma
May 23rd, 2008, 07:55 PM
K cool thanks. Example plugins still look like complete gibberish to me (being new to compiz and advanced programming), but I guess if I study them enough I can figure it out. Hopefully one day someone will write a guide as to what exactly all of the compiz functions(within a plugin) that need to be called do.

SmSpillaz
May 24th, 2008, 12:11 AM
Really quickly:

initDisplay/Screen/Window()
Code you want to execute when a display, screen or window appears. Usually, plugins create a struct of variables for that window, allocate some memory, allocate what is called a 'private index' to store those variables in that window then use that private index as a pointer to the struct they just created

finiDisplay/Screen/Window()
Code you want to execute when one of these goes away. Usually just frees stuff in memory, stops rendering etc.

WRAP/UNWRAP()
This is difficult to explain as it involves replacing actual compiz functions with your own, but it essentially means (if you use it properly, like other plugins do) "When compiz calls this function, call mine, then the one that wanted to be called before it, then the one before it (for all plugins wrapping it) then the compiz one. It basically means for example, with a paint function, compiz repaints the window, then your plugin says 'Let me do something with the transformation matrix and paint attrib here, then the plugin loaded before me can do that'

preparePaintScreen() (WRAPPABLE)
Use this to determine how long it has been since the last repaint for accurate animation and slow-mo etc

paintWindow () (WRAPABLE) (Paint an actual window, use this if you want to transform the window itself)

paintOutput () (WRAPPABLE) (Draw things on the actual screen)

damageWindowRect () (WRAPPABLE) Use this when you need to set an area to damage for the window once painting is done so it gets painted again (neccessary for animation)

handleEvent () (WRAPPABLE) Use this to grab X Events

Actions (myFunctionInitiate, called from the action initiator (see the section on bcop on the wiki for this)), do something when an action is called (keypress that you wanted, etc)
Have a look in other plugins to do what other wrappable functions and actions do. Those are the basics. From there, you can mix with whatever you want.

goma
May 24th, 2008, 12:26 AM
I have to say I wasn't actually expecting anyone to explain all that to me. :D THANKS!!!! I have to run out now so I can't really read it all but I really do appreciate it, and will study them until i have them ingrained in my head. Someone should sticky the post.

I hope to write at least one functional plugin before the summer is over, so thanks for the help.