All pastes #435140 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-11 20:02 UTC
rendered paste body
Hi,
Recently i have worked on re-writing beryl's transparent cube, and ported 3d plugin to compiz.
I'm attaching a patch here that includes the transparent cube patches (i'll post the 3d plugin when i fix some problems that didn't happen in beryl).

this is what my patch includes:

Core Changes:

- BTF / FTB masks.
FTB mask allows compiz to paint the windows in reversed order, front to back. This is needed when we paint a a cube face which is reversed.
BTF mask alome doesn't do anything, but when combined with FTB patch, core will first paint the screen with regular order and after that in reversed order; The plugin that set BTF and FTB mask together is responsible for preventing core from painting the window in the wrong twice. This allows plugins to make more complicated drawing orders. This feature isn't needed for transparent cube, but it is needed for 3d plugin.
This patch was originally written by Dennis Kasprzyk for beryl (who also gave the idea), and now re-written for compiz be me.

-  Wrappable SetClippingPlanes
Just a new wrappable function for setting clipping planes. This is needed for correct clipping od the cube together with 3d plugin.
This patch was written by Dennis Kasprzyk again, and ported to compiz.

Plugin changes:

- Some new events code
Specifically: Rotate sending event to cube / 3d to notify about rotations. This is needed for 3d to initate, and for setting transparent cube on rotate only. Also, 3d sending an event to cube to request to paint all viewports, this is needed for handling some disappearing windows in 3d (the cube face becomes invisible, but the windows that come out 3d are still visible in small parts, but disappear if cube doesn't paint that viewport).
Last, cube is sending unfold event to 3d, needed for preventing 3d to transform the windows in z axis when a window is between 2 viewports.

- Transparent cube
The calculations / painting code done by cube are now changed to make cube to paint the faces in correct drawing order, back faces first, front faces last.
Of course, i disable culling and set the desktop-window opacity to actually make the cube transparent, and make sure cube draws all viewports when the cube is transparent (when the cube isn't transparent, only the front faces are painted).



There are some things that I'm not really sure if they work fine with my patch, or they have bugs:

- Currently, i'm painting all the faces of the cube whith inside cube (only when transparent), while some faces are never visible.
This is needed when zooming out the cube, so i think this is a good idea anyway, but i'd like to know what you think about it.

- Unredirecting fullScreen windows is done by paintScreenRegion which finds the top-fullscreen window. When doing FTB drawing, it will find the bottom-fullscreen window, and when doing both BTF / FTB drawing, it'll find the top and the bottom fullscreen windows. I'm not sure weather this is really wrong, so again I'd like to hear your opinion if my patch makes bugs on this area.

- The cubeCheckFTB function that i wrote (that checks if the next-painted face should be drawn with FTB flag) seems to not work in some occasions with inside cube (works perfectly with outside cube). I don't know why this happens though.

- Because of the calculations-changes i made for making transparent cube to work, xRotate has different values now from what it used to have (it has the rotation of the top-most face, which means between -45 and 45 for 4 sided cube, between -30 and 30 for 3 sided cube etc), and this change results in some weird bugs when rotating the cube with vertical rotations.
I looked at applyScreenTransform, and it looks like the rotation axis that is used for vertical rotating expects the old values of xRotate. This should be fixed, but i'm not sure what is the correct way to do vertical rotations with the "new" values. Do you have any idea how to properly do that?