[compiz] g-w-d.c -> my head spins

David Reveman davidr at novell.com
Fri Apr 7 05:37:06 PDT 2006


On Thu, 2006-04-06 at 19:37 +0200, Mirco Müller wrote:
> Am Donnerstag, den 06.04.2006, 14:38 +0200 schrieb Mirco Müller:
> 
> > 	I started looking more thoroughly at gnome-window-decorator.c and now
> > my head spins and "hurts"...
> 
> After futher investigation my head now spins the other way round :)
> 
> 	In the meantime I was able to identify all drawing functions
> responsible for the titlebar (I didn't touch the title and buttons),
> frames and shadow-elements. As an example I replaced them with simple
> opaque rects to see what part goes where. Actually I just draw the rects
> for the shadow and completely skip the frame-drawing functions (for
> reasons of clarity I draw the middle part of the titlebar too), because
> I'm currently only interested in the shadows. And this yielded another
> strange fact. Take a look at the attached screenshot. You might want to
> know that the drak grey and white parts should only be drawn in the
> lower left and lower right corner (at least that's what I would expect
> from the code and David's comments). Instead the lower left covers the
> left, lower-left and lower part while the white occupies the lower-right
> and right part.
> 
> 	Yet I have to (hopefully) figure out how the local 2D-window-coordinate
> system works and how it relates to the matrix used in
> draw_shadwo_background().
> 
> 	I think only David can give some insight on why I see the colored
> squares arranged as they are.

I don't think I understand exactly what you're doing and what results
you expect. If you only draw the shadow background then that should be
the only thing you see.

> 
> 	Why did you do it this way David? It appears to be very non-obvious.
> Are there speed-issues demanding such an approach or other things going
> on behind the scene, which I still fail to see?

What way?

The decorator creates minimal pixmaps and coordinates in these pixmaps
are mapped relative to he actual windows. More rectangles that might
seem necessary are used but this is only make the decorations look good
when window changes size and the decorator can't keep up, these
rectangles doesn't cost anything extra. You can try this by suspending
the decorator process and then resize a window. You'll see that the
decorations look good even though the decorator isn't running.

A decorator doesn't have to use that similar "pixmap -> window" mappings
as I'm currently doing in g-w-d, those mappings just work well with the
current decorations.

I know the code lacks comments, g-w-d code is pretty hard to read. I
wrote that code very quickly so that I could release everything at
xdevconf.

-David



More information about the compiz mailing list