Shape the window when there is no compositor
On Xfce with compositing off, X11 has no alpha to blend against, so the transparent background came out as a black box around the cat. When a window comes up without an alpha channel, TNCat now cuts the window down to the pixels the drawing covers, using the X11 shape extension, and refreshes that 15 times a second so it follows the animation. A sitting cat in a 120 x 106 window comes out as 96 rectangles over 29 percent of the window, so most of the box is gone. Edges are harder than with a compositor, one bit per pixel, and the log says so and names the Xfce setting that gives smooth ones instead. The image-to-rectangles step is platform independent and folds every device row into its window row, which both halves the rectangle count on a scaled display and keeps a pixel that is opaque in only one of them. xcb and xcb-shape are picked up through pkg-config on Unix and the build still works without them. Opaque mode now paints a neutral card rather than the coat colour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0aceb3665d
commit
d685bf492a
9 files changed
+284
-11
No files matched your search
@@ -102,9 +102,21 @@ This is the main target. Two things to know.
|
||||
**Transparency needs a compositor.** Without one, X11 has no alpha channel to
|
||||
composite against and the transparent window background renders as a black box
|
||||
around the cat. In Xfce it is one checkbox: Settings, Window Manager Tweaks,
|
||||
Compositor, Enable display compositing. TNCat prints a warning naming that
|
||||
setting when its window comes up without an alpha channel. `TNCAT_OPAQUE=1`
|
||||
paints a solid background instead, which is usable but not pretty.
|
||||
Compositor, Enable display compositing. That is the best answer, because alpha
|
||||
gives smooth edges.
|
||||
|
||||
When TNCat sees a window come up without an alpha channel it says so and falls
|
||||
back to shaping the window with the X11 shape extension: the window is cut down
|
||||
to the pixels the cat covers, so there is no box left to be black. The shape is
|
||||
one bit per pixel, so edges are harder than with a compositor, and it is
|
||||
refreshed 15 times a second to follow the animation. Measured on a sitting cat
|
||||
in a 120 x 106 window, the shape is 96 rectangles covering 29 percent of the
|
||||
window.
|
||||
|
||||
Shaping needs `xcb` and `xcb-shape` at build time (`libxcb-shape0-dev` on
|
||||
Debian and Ubuntu, `xcb-util-devel` on SUSE). CMake says so if they are
|
||||
missing, and the build still works without them. `TNCAT_OPAQUE=1` skips the
|
||||
whole question and paints a solid background.
|
||||
|
||||
**Keeping the cat on top.** The default is a frameless `Qt::Tool` window that
|
||||
stays on top. If the window manager puts it behind other windows or shows it in
|
||||
|
||||
Reference in new issue
Block a user