Commit graph

6043 commits

Author SHA1 Message Date
Daniel Eklöf
9da7152f83
slave: don't skip setting environment variables when using a custom environment
When launching footclient with -E,--client-environment the environment
variables that should be set by foot, wasn't.

Those variables are:

* TERM
* COLORTERM
* PWD
* SHELL

and all variables defined by the user in the [environment] section in
foot.ini.

In the same way, we did not *unset* TERM_PROGRAM and
TERM_PROGRAM_VERSION.

This patch fixes it by "cloning" the custom environment, making it
mutable, and then adding/removing the variables above from it.

Instead of calling setenv()/unsetenv() directly, we add the wrapper
functions add_to_env() and del_from_env().

When *not* using a custom environment, they simply call
setenv()/unsetenv().

When we *are* using a custom environment, add_to_env() first loops all
existing variables, looking for a match. If a match is found, it's
updated with the new value. If it's not found, a new entry is added.

del_from_env() loops all entries, and removes it when a match is
found. If no match is found, nothing is done.

The mutable environment is allocated on the heap, but never free:d. We
don't need to free it, since it's only allocated after forking, in the
child process.

Closes #1568
2024-01-11 16:37:17 +01:00
Daniel Eklöf
208008d717
config: fix cloning of env_vars tllist
When cloning a config struct, the env_vars tllist wasn't correctly
copied. We did correctly iterate and duplicate all old entries, but we
did *not* reset the list in the cloned struct before doing so.

This meant the list contained entries shared with the original list,
causing double free:s in --server mode.
2024-01-10 16:41:03 +01:00
Daniel Eklöf
a2283c8229
wayland: surface_scale_explicit_width_height(): dont assert width/height are valid for scale, take 2
764248bb0d modified
wayl_surface_scale_explicit_width_height() to not assert the surface
size is valid for the given scaling factor. This, since that function
is only used when scaling a mouse pointer surface.

However, that commit only updated the code path run when fractional
scaling is available (i.e. when the compositor implements the
fractional-scale-v1 protocol).

The legacy code path, that does integer scaling, was still asserting
the surface width/height were divisible with the scaling factor.

For the same reasons this isn't true with fractional scaling
available, it's not true with integer scaling. Fix by skipping the
assertions.

This patch also converts the assertions to more verbose BUG() calls,
that prints more information on the numbers involved.

Closes #1573
2024-01-09 16:47:41 +01:00
Daniel Eklöf
0ca4633898
slave: ignore return value of chdir()
It's not critical.

Fixes

    ../slave.c: In function ‘slave_spawn’:
    ../slave.c:410:9: error: ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
      410 |         chdir("/");
          |         ^~~~~~~~~~
2024-01-05 08:12:32 +01:00
Daniel Eklöf
66f25bb434
slave: chdir to / after spawning the client application
With this patch, the terminal process now changes PWD to / after
spawning the client application.

This ensures the terminal process itself does not "lock" a
directory. For example, we may keep a mount point from being
unmounted.

Closes #1528
2024-01-03 14:07:15 +01:00
LmbMaxim
14472cdbd9
Add poimandres theme 2024-01-03 13:33:31 +01:00
Daniel Eklöf
e5f5a74e81
changelog: formatting 2024-01-03 13:31:35 +01:00
Sivecano
05e6fd969a
support numpad in unicode mode 2024-01-03 13:30:51 +01:00
Craig Barnes
3b3477d657 appstream: update releases list 2023-12-06 16:23:18 +00:00
eugenrh
242767d373 theme: electrophoretic
A theme for grayscale electrophoretic displays (e-ink), which aims
to maximize the contrast between the text and the white background.
2023-11-14 18:30:28 +00:00
Gregory Anders
8b2b65bbbc terminfo: add terminator to conditional in Sync
I'm not sure if this is _strictly_ necessary, but according to the
terminfo specification [1] a conditional string should be terminated
with `%;`.

[1]: https://man7.org/linux/man-pages/man5/terminfo.5.html
2023-11-13 19:10:15 -06:00
Daniel Eklöf
ca46edfe6f
changelog: double close config file descriptor 2023-10-27 16:23:57 +02:00
Jan Palus
8e1b51be10
config: reset conf file descriptor after closing file stream
conf file descriptor is closed once again during cleanup at the end of
config_load() if descriptor >= 0. avoid double closing by assigning
negative value to fd after first close.

by the time second close happens some other descriptor might be opened
reusing previous number ie it might happen during foot server startup
when syslog message is logged between one close and the other. in this
particular situation, as of this writing, it considers fd=3 for which
following events apply:

1. conf file is opened and fclosed()
2. warning is logged with syslog which leads to opening socket to
   /dev/log which is kept open by glibc (gets fd=3)
3. second close during config_load() closes /dev/log socket descriptor
4. epoll_create() in fdm.c reuses fd=3 again
5. another message is being logged with syslog. glibc notices sendto()
   failure on saved /dev/log descriptor hence it closes it and opens
   new one

Due to epoll descriptor closure foot starts a chain of errors that
lead to startup failure.

Fixes #1531
2023-10-27 16:21:46 +02:00
Jan Palus
ee02e7b07d
main: correct short option case in help output for disabling syslog 2023-10-27 16:20:23 +02:00
xnuk
7ffbb3cc27
man foo.ini.5: Add 'Comma separated list of fonts' example 2023-10-27 16:18:41 +02:00
Daniel Eklöf
02fff24b4f
config: improve validation of color values, default alpha to 0xff
Reject color values that aren't in either RGB, or ARGB format. That
is, color values that aren't hexadecimal numbers with either 6 or 8
digits.

Also, if a color value is allowed to have an alpha component, and the
user left it out, default to 0xff (opaque) rather than 0x00 (fully
transparent).

Closes #1526
2023-10-26 16:25:57 +02:00
Fazzi
85a4e4ccc1 add CCACHE_DISABLE=1 to pgo.sh to avoid errors when ccache is enabled 2023-10-20 10:06:05 +01:00
Daniel Eklöf
642f9910c2
changelog: add new 'unreleased' section 2023-10-17 17:25:47 +02:00
Daniel Eklöf
fe11baa4bc
Merge branch 'releases/1.16' 2023-10-17 17:25:22 +02:00
Daniel Eklöf
8b3dbf0972
meson: bump version to 1.16.2 2023-10-17 17:24:12 +02:00
Daniel Eklöf
47bc28ce55
changelog: prepare for 1.16.2 2023-10-17 17:24:00 +02:00
Daniel Eklöf
f1e7d78c96
Merge branch 'master' into releases/1.16 2023-10-17 17:23:18 +02:00
Daniel Eklöf
3dbb86914c
render: sixel: regression: wrong cell color behind opaque sixels
An opaque sixel that isn't a multiple of the cell size will have some
cells partially visible (either the entire last row, the entire last
column, or both).

These must be rendered before blitting the sixel.

f5f2f5a954 introduced a regression,
where all such cells were rendered as if the cursor was there, giving
them the wrong appearance.

Closes #1520
2023-10-13 18:44:44 +02:00
Daniel Eklöf
857ac224c5
changelog: add new 'unreleased' section 2023-10-12 20:36:28 +02:00
Daniel Eklöf
667095e429
Merge branch 'releases/1.16' 2023-10-12 20:35:48 +02:00
Daniel Eklöf
195eb3356a
meson: bump version to 1.16.1 2023-10-12 16:36:18 +02:00
Daniel Eklöf
c26c6e285a
changelog: prepare for 1.16.1 2023-10-12 16:36:07 +02:00
Daniel Eklöf
ee7e6e7234
Merge branch 'master' into releases/1.16 2023-10-12 16:35:37 +02:00
Daniel Eklöf
f5f2f5a954
render: fix surface damage when rendering sixels.
Pass a damage region to render_row()/render_cell() when rendering
partially visible cells underneath a sixel.

This ensures the affected regions are later reported as 'damaged' to
the Wayland compositor.

Closes #1515
2023-10-12 16:32:00 +02:00
Daniel Eklöf
4aa67e464a
sixel: erase: fix clearing of cell->attrs.clean
When erasing a sixel, the cells underneath it must be marked as
'dirty', in order to be re-rendered.

This was not being done correctly; the for loop loops *from* the start
col, meaning the *end* col is *not* sixel->pos.col, as that's
the *number* of columns, not the *end* column.
2023-10-12 16:31:37 +02:00
Daniel Eklöf
c006ac3a07
shm: memfd_create: fallback to not using MFD_NOEXEC_SEAL
MFD_NOEXEC_SEAL was introduced in linux 6.3. Kernels before that
will *reject* memfd_create() calls that set it.

This caused foot to exit (i.e. not start at all), when compiled on
linux >= 6.3, but run on linux < 6.3.

We _do_ want to use MFD_NOEXEC_SEAL, since a) our memory mapped really
shouldn't be executable, and b) to silence a warning on linux >= 6.3.

To handle all cases, first try *with* MFD_NOEXEC_SEAL. If that fails
with EINVAL, retry *without* it.

Closes #1514
2023-10-12 16:16:11 +02:00
Daniel Eklöf
7d7b48f104
changelog: fix link to issue 1077 2023-10-11 18:39:43 +02:00
Daniel Eklöf
4847cc3bd1
changelog: add new 'unreleased' section 2023-10-11 18:19:31 +02:00
Daniel Eklöf
dff9e4ec59
Merge branch 'releases/1.16' 2023-10-11 18:19:10 +02:00
Daniel Eklöf
a9d6eaf937
meson: bump version to 1.16.0 2023-10-11 18:15:01 +02:00
Daniel Eklöf
7131c96b26
changelog: prepare for 1.16.0 2023-10-11 18:14:40 +02:00
Daniel Eklöf
1cafadea6c
changelog: emphasize the new key bindings are for search mode 2023-10-11 18:12:18 +02:00
Daniel Eklöf
6e58bd8351
Merge branch 'fix-font-baseline-calculation'
Closes #1511
Closes #1463
2023-10-11 16:31:53 +02:00
Daniel Eklöf
4449177517
term: cache font baseline
No need to redo the calculation for every single cell we render,
every frame...
2023-10-10 14:23:33 +02:00
Daniel Eklöf
34aa979f46
term_font_baseline(): only center glyph when a custom line-height is being used
When using the font's own line-height, simply set the baseline
'descent' pixels above the bottom of the cell.

This fixes an issue where some fonts appeared "glued" to the top of
the cell, and sometimes getting partially clipped.
2023-10-10 13:52:24 +02:00
Daniel Eklöf
7d126ff414
changelog: fixed font baseline calculation 2023-10-10 10:55:26 +02:00
Daniel Eklöf
41932287cf
Revert "font baseline: use max(font->height, font->ascent + font->descent) when calculating font height"
This reverts commit fd813d0e6c.

The intent of the reverted commit was to align font height calculation
with cell height calculation. However, it turns out this breaks some
fonts. Typically those with large:ish differences in their 'height'
attribute, and their ascent+descent value.

Closes #1511
2023-10-10 10:52:35 +02:00
Daniel Eklöf
4cf2c45baa
render: better description of why we disable transparency in fullscreen 2023-10-10 09:27:00 +02:00
Daniel Eklöf
5c58fc2a28
Merge branch 'visual-bell-remastered'
Closes #1337
2023-10-10 08:15:11 +02:00
Daniel Eklöf
af0feed3e5
changelog: fix issue number for visual bell
1508 refers to the pull request, not the feature request.
2023-10-10 08:14:43 +02:00
Daniel Eklöf
ce64da2fe1
doc: foot.ini.5: move flash{,-alpha} to the bottom of the 'colors' section 2023-10-10 08:13:35 +02:00
Daniel Eklöf
0c6a3731c3
doc: foot.ini.5: flash_alpha -> flash-alpha 2023-10-10 08:13:35 +02:00
Daniel Eklöf
9cf22df784
foot.ini: flash_alpha -> flash-alpha 2023-10-10 08:13:35 +02:00
Daniel Eklöf
eea995637d
term: remove unneeded (and mostly unused) term->flash{,_alpha} 2023-10-10 08:13:35 +02:00
Daniel Eklöf
8a2a450778
doc: foot.ini: flash: tweak grammar, use consistent formatting 2023-10-10 08:13:35 +02:00