Allow windows to specify their own depth.
commit39a5f3da0b0844e5544e2108699b9a5a4057ea83
authorIain Patterson <wm@iain.cx>
Mon, 20 Aug 2012 14:18:21 +0000 (20 15:18 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Tue, 21 Aug 2012 23:24:41 +0000 (22 00:24 +0100)
tree0c2ce9b15b3a1f2842e7858999882189c8b00ba9
parent5fe41600254cc0cbb19a1edc596bcbfc91d075e9
Allow windows to specify their own depth.

Accept windows' depth, visual and colormap instead of always using those
of the root window.  Internal windows such as menus behave as before.

In conjunction with a compositing manager on a display supporting the
RENDER extension windows can now manage their own opacity.

I wrote the patch after reading the FAQ for urxvt, which says,
regarding transparency support:

"3. Use an ARGB visual:

  urxvt -depth 32 -fg grey90 -bg rgba:0000/0000/4444/cccc

This requires XFT support, and the support of your X-server. If that
doesn't work for you, blame Xorg and Keith Packard. ARGB visuals
aren't there yet, no matter what they claim. Rxvt-Unicode contains the
necessary bugfixes and workarounds for Xft and Xlib to make it work,
but that doesn't mean that your WM has the required kludges in place."

  In conjunction with a compositing manager (I tested compton) it does
work and urxvt draws a semi-transparent background with fully opaque
foreground text and scrollbars; much prettier than applying a blanket
transparency value over the whole window with the compositing manager.
Other application windows I tested were, as expected, drawn the same
as before.

  I verified that urxvt is drawn in the same way when using xfwm4
(with builtin compositing).  Since Window Maker doesn't (at time of
writing) have its own compositing manager I should clarify that one is
required to see any benefit from this patch.

  Whether or not this feature is useful for any application other than
urxvt I don't know, though I assume that an application which chose an
ARGB visual in the same way would be able to draw itself prettily.

  On a display without RENDER things work just as they do without the
patch.  I have, however, only been able to test on a fairly standard
TrueColor display supporting multiple colour depths with 24bpp being
the default.  Testing with more ... exotic ... display types would
probably be advisable.
src/framewin.c
src/framewin.h
src/icon.c
src/menu.c
src/wcore.c
src/wcore.h
src/window.c