<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/terminal.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-26T19:05:17Z</updated>
<entry>
<title>term: reset sixel options when hard resetting the terminal state</title>
<updated>2022-04-26T19:05:17Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-26T19:05:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=32d9895697584988056086cbecdc96375b4b9115'/>
<id>urn:sha1:32d9895697584988056086cbecdc96375b4b9115</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: flash: work around Sway sub-surface unmap bug</title>
<updated>2022-04-26T15:41:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-26T15:24:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=398d96fdb2a18f7652c116639dc17741f5e24404'/>
<id>urn:sha1:398d96fdb2a18f7652c116639dc17741f5e24404</id>
<content type='text'>
Unmapping a sub-surface in Sway does not damage the underlying
surface.

As a result, the OSC-555 escape (“flash”) will leave yellow margins on
~every second frame.

Out of sway, river, weston and mutter, only Sway needs this
workaround.

This is a workaround for https://github.com/swaywm/sway/issues/6960

Closes #1046
</content>
</entry>
<entry>
<title>sixel/terminal: use the new grid and selection APIs</title>
<updated>2022-04-25T18:00:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-25T18:00:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1d4e1b921d351da349ccfbc5d587489d7b77e690'/>
<id>urn:sha1:1d4e1b921d351da349ccfbc5d587489d7b77e690</id>
<content type='text'>
Use grid_row_abs_to_sb() instead of manually “rebasing” row numbers.

Use selection_get_{start,end}() to retrieve the current selection
coordinates.
</content>
</entry>
<entry>
<title>wayland: remove selection_override_modmask member</title>
<updated>2022-04-19T15:24:25Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-19T15:24:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=876044df8d5912f814423815dadd6c192f0cd644'/>
<id>urn:sha1:876044df8d5912f814423815dadd6c192f0cd644</id>
<content type='text'>
This member is no longer valid - we need to use one from the current
key-binding set.
</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>key-binding: new API, for handling sets of key bindings</title>
<updated>2022-04-17T13:39:51Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-17T13:39:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=90a2ca966f657e5fdd82997aad9663e9984f3cc9'/>
<id>urn:sha1:90a2ca966f657e5fdd82997aad9663e9984f3cc9</id>
<content type='text'>
Up until now, our Wayland seats have been tracking key bindings. This
makes sense, since the seat’s keymap determines how the key bindings
are resolved.

However, tying bindings to the seat/keymap alone isn’t enough, since
we also depend on the current configuration (i.e. user settings) when
resolving a key binding.

This means configurations that doesn’t match the wayland object’s
configuration, currently don’t resolve key bindings correctly. This
applies to footclients where the user has overridden key bindings on
the command line (e.g. --override key-bindings.foo=bar).

Thus, to correctly resolve key bindings, each set of key bindings must
be tied *both* to a seat/keymap, *and* a configuration.

This patch introduces a key-binding manager, with an API to
add/remove/lookup, and load/unload keymaps from sets of key bindings.

In the API, sets are tied to a seat and terminal instance, since this
makes the most sense (we need to instantiate, or incref a set whenever
a new terminal instance is created). Internally, the set is tied to a
seat and the terminal’s configuration.

Sets are *added* when a new seat is added, and when a new terminal
instance is created. Since there can only be one instance of each
seat, sets are always removed when a seat is removed.

Terminals on the other hand can re-use the same configuration (and
typically do). Thus, sets ref-count the configuration. In other words,
when instantiating a new terminal, we may not have to instantiate a
new set of key bindings, but can often be incref:ed instead.

Whenever the keymap changes on a seat, all key bindings sets
associated with that seat reloads (re-resolves) their key bindings.

Closes #931
</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>client: add -E,--client-environment</title>
<updated>2022-04-12T13:07:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-11T10:19:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d02124902b4e27c3ed3ef48442ce17c5e0af9d56'/>
<id>urn:sha1:d02124902b4e27c3ed3ef48442ce17c5e0af9d56</id>
<content type='text'>
When this option is used, the child process in the new terminal
instance will inherit its environment from the footclient process,
instead of the foot server’s.

Implemented by sending (yet another) dynamic string list as part of
the client -&gt; server setup packet. When the new option is *not* used,
the setup packet is now 2 bytes larger than before.

On the server side, the slave process now uses execvpe() instead of
execvp(). There’s plumbing to propagate a new ‘envp’ argument from
term_init() all the way down to slave_exec(). If ‘envp’ is NULL, we
use ‘environ’ instead (thus matching the old behavior of execvp()).

Closes #1004
</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>Explicitly initialize sigaction::sa_mask members with sigemptyset(3)</title>
<updated>2022-02-12T12:26:42Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-02-12T12:04:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=23cf80667a36aaff1865fc50afab3f98a796cf14'/>
<id>urn:sha1:23cf80667a36aaff1865fc50afab3f98a796cf14</id>
<content type='text'>
Not doing so before calling sigaction(3) is "undefined" according to
POSIX[1]:

&gt; Applications shall call either sigemptyset() or sigfillset() at least
&gt; once for each object of type sigset_t prior to any other use of that
&gt; object. If such an object is not initialized in this way, but is
&gt; nonetheless supplied as an argument to any of pthread_sigmask(),
&gt; sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(),
&gt; sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or
&gt; sigwaitinfo(), the results are undefined.

The use of designated initializers means that sa_mask members were
still being initialized, but sigset_t is an opaque type and implicit
initialization doesn't necessarily produce the same results as using
sigemptyset(3) (although it typically does on most implementations).

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
</content>
</entry>
<entry>
<title>csi/input: remove private mode 27127</title>
<updated>2022-02-09T20:50:20Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-02-09T20:50:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e32707ffc04a5c4acee62680f080c927d96e1836'/>
<id>urn:sha1:e32707ffc04a5c4acee62680f080c927d96e1836</id>
<content type='text'>
This effectively reverts commit 31c73f0cf01e1d0bdcd1435136b010c1c1ab442c.
</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>term: add term_set_user_mouse_cursor()</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:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0bf92fff058caab7ed3e13a5d488a629b4ac9a46'/>
<id>urn:sha1:0bf92fff058caab7ed3e13a5d488a629b4ac9a46</id>
<content type='text'>
This function allows setting a custom mouse cursor.

This is done by adding a ‘char*’ member to the term struct. When it is
non-NULL, we *always* use that pointer (the exception being when the
pointer is hidden), while the pointer is over the grid. This is
instead of the hand/beam pointers we otherwise would use.
</content>
</entry>
<entry>
<title>term: scrollback-to-text: crash when trying to extract the entire scrollback</title>
<updated>2022-02-07T14:12:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-07T13:56:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=631c63d5a4a46914a521d1a7adcf88caf6b99902'/>
<id>urn:sha1:631c63d5a4a46914a521d1a7adcf88caf6b99902</id>
<content type='text'>
We calculated the ‘start’ row by adding the number of screen rows to
the current grid offset. This works in most cases. But not when the
offset is close to the wrap-around.

This triggered a crash when we tried to access a row number larger
than the number of available grid rows.

Fix by bounding the start row to the number of grid rows.

This unearthed a second bug, where trying to extract the scrollback
resulted in nothing getting copied.

The extraction logic did:

   for (r = start; r != (end + 1); r++)
       ....

This works, as long as end isn’t start-1. When we try to extract the
entire scrollback, it _is_ start-1.

Fix by rewriting the loop logic to check for r==end *after* copying
the row contents, but *before* incrementing r.

Closes #926
</content>
</entry>
<entry>
<title>term: init: initialize selection pivot point coords to -1,-1</title>
<updated>2022-02-07T09:36:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-07T09:36:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b4027118e65ac1f7a8b71d538ed323e23c482fab'/>
<id>urn:sha1:b4027118e65ac1f7a8b71d538ed323e23c482fab</id>
<content type='text'>
While this _shouldn’t_ be necessary (pivot points are only used while
a selection is ongoing). But it doesn’t hurt to initialize them
anyway.
</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>search: remember last searched-for string between searches</title>
<updated>2022-01-29T16:50:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-27T17:36:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=739e7d76b4b70da91c50a53026a83d382dd73bae'/>
<id>urn:sha1:739e7d76b4b70da91c50a53026a83d382dd73bae</id>
<content type='text'>
Regardless of how we exit search mode (commit or cancel), the search
string is remembered.

The next time we enter search mode, the last searched-for string will
be used when searching for the next/prev match (ctrl+r, ctrl+s), and
the search query is empty.
</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>
<entry>
<title>terminal: use CLOCK_MONOTONIC instead of literal.</title>
<updated>2022-01-14T14:39:27Z</updated>
<author>
<name>Érico Nogueira</name>
<email>erico.erc@gmail.com</email>
</author>
<published>2022-01-14T14:39:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5af65d897cae7eb7dbbdc7e967f3cd1e67552a96'/>
<id>urn:sha1:5af65d897cae7eb7dbbdc7e967f3cd1e67552a96</id>
<content type='text'>
CLOCK_MONOTONIC isn't guaranteed to have the same value on all
platforms, and this makes the code more readable.
</content>
</entry>
</feed>
