Join GitHub today
Use separate pixmaps for each edge of a container #3479
I'm submitting a…
[x] Bug [ ] Feature Request [ ] Documentation Request [ ] Other (Please describe in detail)
i3 uses a single pixmap that covers the entire window.
To reduce memory usage, we could use separate pixmaps for the edges (top, bottom, left right) to draw titlebar + borders, and leave the inside of the windows without a (useless) pixmap. See #2742 (comment) for details.
This was referenced
Oct 26, 2018
Assuming you are fine with depending on cairo's tee surface support (IIRC this is not enabled by default in cairo), you could create a "virtual cairo surface with holes" to draw to:
A tee surface contains a list of other cairo surfaces. Each drawing operation on the tee surface is done to all the underlying surfaces.
For each of the four pixmaps, you create a cairo surface. You use
No idea if this works correctly (I wouldn't be surprised if cairo had bugs in this area, partly because this would explain why tee surfaces are not enabled by default). But if this works, it would be the least invasive change to the existing drawing code. Plus, the existing drawing code itself would not become more complicated.
(The alternative would be to not use a tee surface, but instead run the existing drawing code four times, once for each of the sub-surfaces)