<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/render.c, branch 1.10.2</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.10.2</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.10.2'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2021-11-30T21:10:27Z</updated>
<entry>
<title>Merge branch 'window-menu'</title>
<updated>2021-11-30T21:10:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-30T21:10:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=90cfdcf1a5ddbaad44a46fb88b8dbafd319ee0ad'/>
<id>urn:sha1:90cfdcf1a5ddbaad44a46fb88b8dbafd319ee0ad</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: fix csd border rendering glitch when width &gt; 5px</title>
<updated>2021-11-29T18:32:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-29T18:23:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3afe317e4637d511bb4f795d20d8e0467c0e42bf'/>
<id>urn:sha1:3afe317e4637d511bb4f795d20d8e0467c0e42bf</id>
<content type='text'>
CSD borders are always *at least* 5px. If url.border-width=0, those
5px are all fully transparent (and act as interactive resize handles).

As csd.border-width increases, the number of transparent pixels
decrease. Once csd.border-width &gt;= 5, the border is fully opaque.

When csd.border-width &gt; 5, then width of the border is (obviously)
more than 5px. But, when rendering the opaque part of the border, we
still used 5px for the invisible part, which caused some pixman
rectangles to have negative x/y coordinates.

This resulted in rendering glitches due to overflows in pixman when
rendering the borders.

The fix is to ensure the total border size is always at least, but
not *always* 5px. That is, set it to max(5, csd.border-width).

This patch also fixes an issue where the CSD borders were not
dimmed (like the titlebar) when the window looses input focus.

Closes #823
</content>
</entry>
<entry>
<title>input: Add support for xdg_toplevl.show_window_menu()</title>
<updated>2021-11-29T15:26:40Z</updated>
<author>
<name>Jonas Ådahl</name>
<email>jadahl@gmail.com</email>
</author>
<published>2021-11-19T14:08:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=38741baf9afc2697c7e508cb87c3b2983de9f0af'/>
<id>urn:sha1:38741baf9afc2697c7e508cb87c3b2983de9f0af</id>
<content type='text'>
This makes, if the compositor supports it, the window menu appear when
right clicking on the title bar.
</content>
</entry>
<entry>
<title>term: track cell color source</title>
<updated>2021-11-20T15:46:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-20T15:29:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d46af6bd7ac7606bf99d63b2453b656a5defb892'/>
<id>urn:sha1:d46af6bd7ac7606bf99d63b2453b656a5defb892</id>
<content type='text'>
Each cell now tracks it’s current color source:

* default fg/bg
* base16 fg/bg (maps to *both* the regular and bright colors)
* base256 fg/bg
* RGB

Note that we don’t have enough bits to separate the regular from the
bright colors. These _shouldn’t_ be the same, so we ought to be
fine...
</content>
</entry>
<entry>
<title>config: add [colors].dim0-7</title>
<updated>2021-11-13T16:39:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-03T13:25:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c01904a2c75e962e5159dd42a640cce3d7370b13'/>
<id>urn:sha1:c01904a2c75e962e5159dd42a640cce3d7370b13</id>
<content type='text'>
This allows you to configure custom colors to be used when colors are
being dimmed (`\E[2m`).

It is implemented by color matching (just like
bold-text-in-bright=palette-based); the color-to-be-dimmed is matched
against the current color palette.

If it matches one of the regular colors (colors 0-7), the
corresponding “dim” color will be used.

If it matches one of the bright colors (colors 8-15), the
corresponding “regular” color will be used (but *only* if the “dim”
color has been set).

Otherwise, the color is dimmed by reducing its luminance.

The default behavior, i.e. when dim0-7 hasn’t been configured, is to
dim by reducing luminance for *all* colors. I.e. we don’t do any color
matching at all. In particular, this means that dimming a bright color
will *not* result in the corresponding “regular” color.

Closes #776
</content>
</entry>
<entry>
<title>config: add {str,value}_to_uint{16,32}()</title>
<updated>2021-11-13T10:04:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-06T11:01:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d29c3cf7b76c6a1935684124b4d7cad69de94c78'/>
<id>urn:sha1:d29c3cf7b76c6a1935684124b4d7cad69de94c78</id>
<content type='text'>
This allows us to pass the final pointer directly to the conversion
functions, as well as allowing us to print outside-range errors.
</content>
</entry>
<entry>
<title>render: csd_part: we don’t use the ‘src’ pixman image</title>
<updated>2021-10-29T17:31:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-10-29T17:31:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e69c3e5b1e87a27c86fb4ca27c0078a00f5727ce'/>
<id>urn:sha1:e69c3e5b1e87a27c86fb4ca27c0078a00f5727ce</id>
<content type='text'>
</content>
</entry>
<entry>
<title>csd: add support for a visible border</title>
<updated>2021-10-27T16:32:28Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-10-27T16:27:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5e4de143de6c43ab54a5df7cea169674f8ea79a3'/>
<id>urn:sha1:5e4de143de6c43ab54a5df7cea169674f8ea79a3</id>
<content type='text'>
When we’re using CSDs, we’ve up until now rendered a 5px invisible
border. This border handles interactive resizing. I.e. hovering it
changes the mouse cursor, and mouse button events are used to start an
interactive resize.

This patch makes it possible to color part of (or the entire) border,
with a configurable color.

To facilitate this, two new options have been added:

* csd.border-width
* csd.border-color

border-width defaults to 0, resulting in the look we’re used to.

border-color defaults to the title bar color. If the title bar color
hasn’t been set, it defaults to the default foreground color (just
like the title bar color does).

This means that, setting border-width but not border-color, results in
a border that blends with the title bar.
</content>
</entry>
<entry>
<title>render: tab -&gt; spaces</title>
<updated>2021-10-20T18:03:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-10-20T18:03:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5b66592a57f5b5f5742dbda54d088634205a7a20'/>
<id>urn:sha1:5b66592a57f5b5f5742dbda54d088634205a7a20</id>
<content type='text'>
</content>
</entry>
<entry>
<title>config, render: scrollback indicator: allow configuring scrollback indicator colors</title>
<updated>2021-10-09T20:59:52Z</updated>
<author>
<name>feeptr@codeberg.org</name>
<email>feeptr</email>
</author>
<published>2021-09-27T19:05:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=650cfa18efdc38164600959e90fdaa50f58910e4'/>
<id>urn:sha1:650cfa18efdc38164600959e90fdaa50f58910e4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix crashes when resizing after CSD enabled at runtime with csd.size = 0</title>
<updated>2021-10-04T22:14:58Z</updated>
<author>
<name>feeptr</name>
<email>feeptr@codeberg.org</email>
</author>
<published>2021-09-23T22:17:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=304aacdb7a1dfbe92e4b0e1a419a872bd3ba6113'/>
<id>urn:sha1:304aacdb7a1dfbe92e4b0e1a419a872bd3ba6113</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: turn ‘box-drawings’ array into three dynamically allocated arrays</title>
<updated>2021-09-14T07:50:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-14T07:50:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=37b15adcd8306652ce21804cb6140d1361adc94f'/>
<id>urn:sha1:37b15adcd8306652ce21804cb6140d1361adc94f</id>
<content type='text'>
The box_drawings array is now quite large, and uses up ~4K
when *empty*.

This patch splits it up into three separate, dynamically allocated
arrays; one for the traditional box+line drawing and block elements
glyphs, one for braille, and one for the legacy computing symbols.

When we need to render a glyph, the *entire* array (that it belongs
to) is allocated.

I.e this is one step closer to a dynamic glyph cache (like the one
fcft uses), but doesn’t go all the way.

This is especially nice for people with
‘box-drawings-uses-font-glyphs=yes’; for them, the custom glyphs now
uses 3*8 bytes (for the three array pointers), instead of 4K.
</content>
</entry>
<entry>
<title>render: codespell: aquire -&gt; acquire</title>
<updated>2021-09-12T17:22:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-03T19:38:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=896825f50c685507797d66c8f0428c3fe8c2d2e0'/>
<id>urn:sha1:896825f50c685507797d66c8f0428c3fe8c2d2e0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>box-drawing: add braille characters</title>
<updated>2021-09-12T17:22:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-02T12:55:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b4c759e2de429c20bf07c9e16162d154152014d9'/>
<id>urn:sha1:b4c759e2de429c20bf07c9e16162d154152014d9</id>
<content type='text'>
Render braille ourselves, instead of using font glyphs. Decoding a
braille character is easy enough; there are 256 codepoints,
represented by an 8-bit integer (i.e. subtract the Unicode codepoint
offset, 0x2800, and you’re left with an integer in the range 0-255).

Each bit corresponds to a dot. The first 6 bits represent the upper 6
dots, while the two last bits represent the fourth (and last) row of
dots.

The hard part is sizing the dots and the spacing between them.

The aim is to have the spacing between the dots be the same size as
the dots themselves, and to have the margins on each side be half the
size of the dots.

In a perfectly sized cell, this means two braille characters next to
each other will be evenly spaced.

This is however almost never the case. The layout logic currently:

* Set dot size to either the width / 4, or height / 8, depending on
  which one is smallest.

* Horizontal spacing is initialized to the width / 4

* Vertical spacing is initialized to the height / 8

* Horizontal margins are initialized to the horizontal spacing / 2

* Vertical margins are initialized to the vertical spacing / 2.

Next, we calculate the number of “remaining” pixels. That is, if we
add the left margin, two dots and the spacing between, how many pixels
are left on the horizontal axis?

These pixels are distributed in the following order (we “stop” as soon
as we run out of pixels):

* If the dot size is 0 (happens for very small font sizes), increase
  it to 1.
* If the margins are 0, increase them to 1.
* If we have enough pixels (need at 2 horizontal and 4 vertical),
  increase the dot size.
* Increase spacing.
* Increase margins.

Closes #702
</content>
</entry>
<entry>
<title>render: unref clip region</title>
<updated>2021-09-04T18:08:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-04T18:08:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=26859a516805cdd8aa8ffd3dc6a9478c8e8ef9bb'/>
<id>urn:sha1:26859a516805cdd8aa8ffd3dc6a9478c8e8ef9bb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>selection: don’t require two cell attr bits for selection updating</title>
<updated>2021-08-16T17:15:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-13T15:45:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ae70596a5034f9fd6bbca6b42e4fe52c42c70d34'/>
<id>urn:sha1:ae70596a5034f9fd6bbca6b42e4fe52c42c70d34</id>
<content type='text'>
When updating the selection (i.e when changing it - adding or removing
cells to the selection), we need to do two things:

* Unset the ‘selected’ bit on all cells that are no longer selected.
* Set the ‘selected’ bit on all cells that *are* selected.

Since it’s quite tricky to calculate the difference between the “old”
and “new” selection, this is done by first un-selecting the old
selection, and then selecting the new, updated selection. I.e. first
we clear the ‘selected’ bit from *all* cells, and then we re-set it on
those cells that are still selected.

This process also dirties the cells, to make sure they are
re-rendered (needed to reflect their new selected/un-selected status).

To avoid dirtying *all* previously selected, and newly selected cells,
we have used an algorithm that first runs a “pre-pass”, marking all
cells that *will* be selected as such. The un-select pass would then
skip (no dirty) cells that have been marked by the pre-pass. Finally,
the select pass would only dirty cells that have *not* been marked by
the pre-pass.

In short, we only dirty cells whose selection state have *changed*.

To do this, we used a second ‘selected’ bit in the cell attribute
struct.

Those bits are *scarce*.

This patch implements an alternative algorithm, that frees up one of
the two ‘selected’ bits.

This is done by lazy allocating a bitmask for the entire grid. The
pre-pass sets bits in the bitmask. Thus, after the pre-pass, the
bitmask has set bits for all cells that *will* be selected.

The un-select pass simply skips cells with a one-bit in the
bitmask. Cells without a one-bit in the bitmask are dirtied, and their
‘selected’ bit is cleared.

The select-pass doesn’t even have to look at the bitmask - if the cell
already has its ‘selected’ bit set, it does nothing. Otherwise it sets
it and dirties the cell.

The bitmask is implemented as an array of arrays of 64-bit
integers. Each outer element represents one row. These pointers are
calloc():ed before starting the pre-pass.

The pre-pass allocates the inner arrays on demand.

The unselect pass is designed to handle both the complete absence of a
bitmask, as well as row entries being NULL (both means the cell
is *not* pre-marked, and will thus be dirtied).
</content>
</entry>
<entry>
<title>render: run the “overflowing glyphs” prepass *before* rendering sixels</title>
<updated>2021-08-11T16:26:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-10T16:33:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=41a8f2fc6556e7b8c9832ede21c6b45f624207cf'/>
<id>urn:sha1:41a8f2fc6556e7b8c9832ede21c6b45f624207cf</id>
<content type='text'>
This fixes an issue where the left-most column of a sixel was
“overwritten” by the cell content.

This patch also rewrites the prepass logic, to try to reduce the
number of loads performed.

The new logic loops each row from left to right, looking for dirty
cells. When a dirty cell is found, we first scan backwards, until we
find a non-overflowing cell. That cell is unaffected by the
overflowing cell we’re currently dealing with.

We can also stop as soon as we see a dirty cell, since that cell will
already have been dealt with.

Then, we scan forward, dirtying cells until we see a non-overflowing
cell. That first non-overflowing cell is also dirtied, but after that
we break.

The last loop, that scans forward, advances the same cell pointer used
in the outer loop.
</content>
</entry>
<entry>
<title>box-drawing: add U+1FB3C-U+1FB6F, U+1FB9A and U+1FB9B</title>
<updated>2021-08-05T16:25:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-03T16:10:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1c43fdbea4751de9a84d24be8320712c85045414'/>
<id>urn:sha1:1c43fdbea4751de9a84d24be8320712c85045414</id>
<content type='text'>
These are the “wedges” from the Unicode 13 “Legacy Computing” symbols.

Closes #474
</content>
</entry>
<entry>
<title>term: consolidate shutdown related state into an anonymous struct</title>
<updated>2021-07-31T17:08:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-31T17:08:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=03f952cf4dcf45d909ce209838a3beb4304358e5'/>
<id>urn:sha1:03f952cf4dcf45d909ce209838a3beb4304358e5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: asynchronous client application termination</title>
<updated>2021-07-31T16:18:48Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-31T16:18:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=384b1c330ffbee4318ee75c97186450f0f6e9e35'/>
<id>urn:sha1:384b1c330ffbee4318ee75c97186450f0f6e9e35</id>
<content type='text'>
When the foot window is closed, and we need to terminate the client application,
do this in an asynchronous fashion:

* Don’t do a blocking call to waitpid(), instead, rely on the reaper callback
* Use a timer FD to implement the timeout before sending SIGKILL (instead of
  using SIGALRM).
* Send SIGTERM immediately (we used to *just* close the PTY, and then wait 2
  seconds before sending SIGTERM).
* Raise the timeout from 2 seconds to 60

Full shutdown now depends on *two* asynchronous tasks - unmapping the window,
and waiting for the client application to terminate.

Only when *both* of these have completed do we proceed and call term_destroy(),
and the user provided shutdown callback.
</content>
</entry>
</feed>
