<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/render.c, branch 1.12.1</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.12.1</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.12.1'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2022-04-24T10:04:06Z</updated>
<entry>
<title>render: fix refresh logic of pending csd|search|url</title>
<updated>2022-04-24T10:04:06Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-24T10:04:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2cbcfb315909969c126f9fd322c68236151a17e7'/>
<id>urn:sha1:2cbcfb315909969c126f9fd322c68236151a17e7</id>
<content type='text'>
Our CSDs, the search-box and URL labels are all implemented using
sub-surfaces, synchronized with the main grid.

This means we *must* commit the main surface as well, when updating
one of these sub-surfaces.

The logic for doing so in the frame callback was flawed, and only
triggered when the main grid was actually dirty.

That is, e.g. search box updates that did not also resulted in grid
updates (for example - pasting a search criteria that doesn’t match),
did not result in a UI refresh.

Closes #1040
</content>
</entry>
<entry>
<title>render: overlay: reset ‘start_col’ after handling the first row</title>
<updated>2022-04-17T17:26:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-17T17:26:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2085621bf471ad6f944d52268b7441b590aeb5cc'/>
<id>urn:sha1:2085621bf471ad6f944d52268b7441b590aeb5cc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: refactor: remove ‘struct config’ pointer from wayland struct</title>
<updated>2022-04-17T14:34:04Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-17T14:29:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=24ee3dcc10c5e1cf57456cc39fa0b5e8700a06ed'/>
<id>urn:sha1:24ee3dcc10c5e1cf57456cc39fa0b5e8700a06ed</id>
<content type='text'>
The global config doesn’t necessarily reflect the correct
configuration to use - we should *always* use the current terminal
instance’s conf pointer.

* Move selection override modifier mask to the key_binding_set struct
* Always warn if XDG activation is unavailable, not just if
  bell.urgent is set (we no longer have access to this information)
* Pass ‘bool presentation_timings’ as a parameter to wayl_init()
* Remove ‘presentation_timings’ member from the ‘terminal’ struct

Closes #932
</content>
</entry>
<entry>
<title>render: overlay: apply weston quirk</title>
<updated>2022-04-17T09:04:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-17T09:04:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9e3c71c27735ae3a534affc71e26a82e0310c96b'/>
<id>urn:sha1:9e3c71c27735ae3a534affc71e26a82e0310c96b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>search/render: initial support for highlighting all visible matches</title>
<updated>2022-04-16T17:26:20Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-09T15:57:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=90c91d61482920881bb0c1ecf4babc001b3f598d'/>
<id>urn:sha1:90c91d61482920881bb0c1ecf4babc001b3f598d</id>
<content type='text'>
Before this patch, only the currently “selected” match was
highlighted (by having the “selected” attribute, and by *not* dimming
it, like the rest of the grid during a scrollback search).

With this patch, we now highlight matches within the viewport. While
searching, only the “primary” match is searched-for, and tracked.

Then, when rendering a frame, we find all “secondary” matches as
well. “holes” are added to the search-mode overlay by the means of an
search-match iterator.

The iterator’s text matching logic is *very* similar to what we do
when the search criteria has been updated, and we re-search the
scrollback. It should be possible to refactor this, and share code.
</content>
</entry>
<entry>
<title>render: implement ‘flash’ and search mode’s ‘dimming’ with a sub-surface</title>
<updated>2022-04-16T16:31:02Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T15:49:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=78fcdc578755af0c3a52a46521dbb4d9804ab790'/>
<id>urn:sha1:78fcdc578755af0c3a52a46521dbb4d9804ab790</id>
<content type='text'>
Search mode and ‘flash’ (OSC-555) both achieves similar visual
effects: flash tints the entire window yellow, and search mode dims
it (except the search match).

But, they do so in completely different ways. Search mode is detected
in render_cell(), and the colors are then dimmed there.

Flash is implemented by blending a yellow, semi-transparent color on
top of the rendered grid.

This patch replaces those two implementations with a single one. We
add a new sub-surface, called the ‘overlay’. In normal mode, it’s
unmapped.

When either search mode, or flash, is enabled, we enable it, and
fill it with a semi-transparent color. Yellow for ‘flash’, and
“black” (i.e. no color) for search mode.

The compositor then blends it with the grid. Hopefully on the GPU,
meaning it’ll be faster than if we blend in software.

There are more performance benefits however. By using a separate
surface, we can do much better damage tracking.

The normal grid rendering code no longer have to care about neither
search mode, nor flash. Thus, we get rid of a couple of ‘if’
statements in render_cell(), which is nice. But more importantly, we
can drop full grid repaints in a couple of circumstances:

* Entering/exiting search mode
* Every frame while flash is active

Now, when rendering the search mode overlay, we do want to do some
damage tracking, also of the overlay.

This, since search mode doesn’t dim the *entire* window. The search
match is *not* dimmed. This is implemented by punching a hole in the
overlay sub-surface. That is, we make part of it *fully*
transparent. The basic idea is to set a clip region that excludes the
search match, and then dim the rest of the overlay.

It’s slightly more complicated than that however, if we want to reuse
the last frame’s overlay buffer (i.e we don’t want to re-render
the *entire* overlay every frame).

In short, we need to:

* Clear (punch hole) in areas that are part of this frame’s search
  match, but not the last frame’s (since those parts are _already_
  cleared).
* Dim the areas that were part of the last frame’s search match, but
  aren’t anymore (the rest of the overlay should already be dimmed).

To do this, we save the last frame’s “holes” (as a pixman
region). Then, when rendering the next frame, we first calculate the
new frame’s “holes” region.

The region to clear is “this frame’s holes minus last frame’s holes”
The region to dim is “last frame’s holes minus this frames holes”.

Finally, we compute the bounding box of all modified cells by taking
the union of the two diff regions mentioned above. This allows us to
limit the buffer damage sent to the compositor.
</content>
</entry>
<entry>
<title>wayland: optionally disable pointer input on subsurfaces</title>
<updated>2022-04-16T15:41:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T15:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=129deaffa82650a1383f5816aa46f4a78a73b2ed'/>
<id>urn:sha1:129deaffa82650a1383f5816aa46f4a78a73b2ed</id>
<content type='text'>
We have a number of sub-surfaces for which we are *not* interrested in
pointer (or touch) input.

Up until now, we’ve manually dealt with these, by recognizing these
surfaces in all pointer events, and ignoring them.

But, lo and behold, there are better ways of doing this. By clearing
the subsurface’s input region, the compositor will do this for us -
when a pointer is outside a surface’s input region, the event is
passed to the next surface underneath it.

This is exactly what we want! Do this for all subsurfaces, *except*
the CSDs.
</content>
</entry>
<entry>
<title>render: take (visible) CSD border size into account when setting initial size</title>
<updated>2022-04-16T09:42:26Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T09:37:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=979f48a62f4d42f0d9637976cacf16d7bbcb2b84'/>
<id>urn:sha1:979f48a62f4d42f0d9637976cacf16d7bbcb2b84</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: add helper functions wayl_win_csd_{titlebar,borders}_visible()</title>
<updated>2022-04-16T09:42:25Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T09:26:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f9103d4381cab9d6c10024ab8fbcdb35b14ef239'/>
<id>urn:sha1:f9103d4381cab9d6c10024ab8fbcdb35b14ef239</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: take visible border width into account when setting window geometry</title>
<updated>2022-04-16T08:57:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-16T08:47:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0e477e2c5e55fd391aa5adef32789a9b7c3f3024'/>
<id>urn:sha1:0e477e2c5e55fd391aa5adef32789a9b7c3f3024</id>
<content type='text'>
This fixes e.g. window snapping in GNOME.
</content>
</entry>
<entry>
<title>refactor: add a ‘range’ struct, grouping a start and end coord together</title>
<updated>2022-04-09T13:09:02Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-09T13:09:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5b1f1602bccfb7c37e50a8509f44b24e9aa3b5d1'/>
<id>urn:sha1:5b1f1602bccfb7c37e50a8509f44b24e9aa3b5d1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: ensure an underline cursor is not positioned too low</title>
<updated>2022-04-06T16:17:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-05T17:18:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5ce1589c60feb7a9c41377f732955f6108d183ac'/>
<id>urn:sha1:5ce1589c60feb7a9c41377f732955f6108d183ac</id>
<content type='text'>
The underline cursor is positioned just below regular underlines. A
bug in the positioning logic related to this, sometimes resulted in
the cursor being thinner than what it should be, or even invisible.

Fixes #1005
</content>
</entry>
<entry>
<title>config: rename csd.color.close -&gt; quit</title>
<updated>2022-02-09T16:51:05Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-08T19:12:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=757768dbe5a61a5fbfc628ad554f26add0397e42'/>
<id>urn:sha1:757768dbe5a61a5fbfc628ad554f26add0397e42</id>
<content type='text'>
This fixes a compilation error on FreeBSD:

../../foot/render.c:2055:45: error: no member named 'epoll_shim_close' in 'struct config::(anonymous at ../../foot/config.h:254:9)'
        conf_color = &amp;term-&gt;conf-&gt;csd.color.close;
                      ~~~~~~~~~~~~~~~~~~~~~ ^

/usr/local/include/libepoll-shim/epoll-shim/detail/common.h:8:15:
note: expanded from macro 'close': #define close epoll_shim_close
</content>
</entry>
<entry>
<title>Specify a fallback mouse cursor</title>
<updated>2022-02-07T16:45:47Z</updated>
<author>
<name>Ashish SHUKLA</name>
<email>ashish.is@lostca.se</email>
</author>
<published>2022-02-07T15:02:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4df73585e79485280fda2e60c18bbac36eaee491'/>
<id>urn:sha1:4df73585e79485280fda2e60c18bbac36eaee491</id>
<content type='text'>
`text' cursor is not available in lots of cursor themes, but `xterm'
is, so specify `xterm' as a fallback cursor name.
</content>
</entry>
<entry>
<title>render: add render_xcursor_is_valid()</title>
<updated>2022-02-07T16:28:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-01T12:56:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e4f9dc7d581cf134e850bd02a9c4ae3e5989905a'/>
<id>urn:sha1:e4f9dc7d581cf134e850bd02a9c4ae3e5989905a</id>
<content type='text'>
Returns true if the provided cursor name is non-NULL, and exist in the
currently loaded xcursor theme.
</content>
</entry>
<entry>
<title>render: call wl_cursor_theme_get_cursor() earlier</title>
<updated>2022-02-07T16:28:28Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-01T12:51:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=92ebe00927b4c9113d6921f2c70a3f609b8785a9'/>
<id>urn:sha1:92ebe00927b4c9113d6921f2c70a3f609b8785a9</id>
<content type='text'>
Before this patch, wl_cursor_theme_get_cursor() was called in the FDM
hook, just before we’re about to update the mouse cursor “for real”.

This relies on seat-&gt;pointer.xcursor still being valid. This is true
as long as we’re only using our compiled-in static xcursor names, but
not otherwise.

Now, we call wl_cursor_theme_get_cursor() in render_xcursor_set(). At
this point, we *know* seat-&gt;pointer.xcursor is valid.

There is a slight chance of added overhead here, if the client
application is switching mouse grabbing on/off rapidly. Before, the
calls to wl_cursor_theme_get_cursor() would automatically be
throttled.

However, the main point of delaying the actual pointer update to the FDM
hook is to throttle the *Wayland* calls. And this is still happening:
wl_cursor_theme_get_cursor() is client-side only.
</content>
</entry>
<entry>
<title>render: resize: add TODO: translate pivot coords</title>
<updated>2022-02-07T09:42:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-07T09:42:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=003ea4904d79dfce530d77adc29030f9fcd1e6b8'/>
<id>urn:sha1:003ea4904d79dfce530d77adc29030f9fcd1e6b8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: resize: finalize selection before reflowing the grid</title>
<updated>2022-02-07T09:38:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-07T09:38:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a187271ca4ba491c7614de540c4490e0f6fa118d'/>
<id>urn:sha1:a187271ca4ba491c7614de540c4490e0f6fa118d</id>
<content type='text'>
This fixes a crash caused by the selection’s pivot point not being
translated during reflow.

While we could simply reflow the pivot point as well, testing shows
irregular behavior with ongoing selections across window resizes, with
different compositors behaving differently.

For now, we simply finalize the selection, instead of trying to handle
ongoing selections.

Closes #922
</content>
</entry>
<entry>
<title>fcft: adapt to API changes in fcft-3.x</title>
<updated>2022-02-05T16:00:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-21T12:50:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e0227266cabc015c282774ac898e3f52dce943df'/>
<id>urn:sha1:e0227266cabc015c282774ac898e3f52dce943df</id>
<content type='text'>
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.

Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.

For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).

Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.

These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.

For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the  __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.

FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.

Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.

Other fcft API changes:

* fcft_glyph_rasterize() -&gt; fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
</content>
</entry>
<entry>
<title>replace gettimeofday with clock_gettime</title>
<updated>2022-01-15T16:05:45Z</updated>
<author>
<name>Pranjal Kole</name>
<email>pranjal.kole7@gmail.com</email>
</author>
<published>2022-01-15T09:26:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0da19a81bc9a94f83bfcf8c5af0e3571f751cf38'/>
<id>urn:sha1:0da19a81bc9a94f83bfcf8c5af0e3571f751cf38</id>
<content type='text'>
POSIX.1-2008 has marked gettimeofday(2) as obsolete, recommending the
use of clock_gettime(2) instead.

CLOCK_MONOTONIC has been used instead of CLOCK_REALTIME because it is
unaffected by manual changes in the system clock. This makes it better
for our purposes, namely, measuring the difference between two points in
time.

tv_sec has been casted to long in most places since POSIX does not
define the actual type of time_t.
</content>
</entry>
</feed>
