Commit graph

6538 commits

Author SHA1 Message Date
Daniel Eklöf
cbe1c2fe75
term: shutdown: special case child terminating due to SIGHUP
When closing the window via a compositor shortcut, or clicking the CSD
close button, we kill the client application by sending it SIGHUP (and
then SIGTERM followed by SIGKILL, if it refuses to die).

Many shells either don't catch SIGHUP, causing us to exit with a
non-zero value, or they catch it, and then _they_ exit with a non-zero
value, causing _us_ to propagate that to the user.

This patch changes foot's behavior to "ignore" death-by-sighup, and
always exit with value 0.

The log message is changed to debug level, for SIGHUP only; other
death-by-signal is still logged at the warning level.
2025-02-03 07:50:10 +01:00
Daniel Eklöf
51128a3484
input: match unshifted key-bindings before shifted
That is, try to match e.g. Control+shift+a, before trying to match
Control+A.

In most cases, order doesn't matter. There are however a couple of
symbols where the layout consumes the shift-modifier, and the
generated symbol is the same in both the shifted and unshifted
form. One such example is backspace.

Before this patch, key-bindings with shift-backspace would be ignored,
if there were another key-binding with backspace.

So, for example, if we had one key-binding with Control+Backspace, and
another with Control+Shift+Backspace, the latter would never trigger,
as we would always match the first one.

By checking for unshifted matches first, we ensure
Control+Shift+Backspace does match.
2025-01-31 09:07:42 +01:00
Daniel Eklöf
bee17a95b8
input: ignore key-bindings without modifiers when matching untranslated/raw
When matching the unshifted symbol, or the raw key code, ignore all
key bindings that don't have any modifiers.

This fixes an issue where it was impossible to enter (some of the)
numbers on the keypad, **if** there was a key-binding for
e.g. KP_Page_Up, or KP_Page_Down.
2025-01-31 07:35:54 +01:00
Daniel Eklöf
d24f700256
key-bindings: add keypad variants to existing default key-bindings 2025-01-31 07:29:16 +01:00
Attila Fidan
5286808b6c
input: close fd on no/unrecognized keymap format 2025-01-30 10:58:19 +00:00
Daniel Eklöf
6e2bdd663a
forgejo: config: render as .ini, instead of the default markdown 2025-01-27 13:18:09 +01:00
Daniel Eklöf
c2c8d29272
forgejo: remove "e.g." from placeholder text 2025-01-27 13:16:43 +01:00
Daniel Eklöf
8b408f0039
forgejo: add optional field for terminal multiplexers 2025-01-27 13:15:59 +01:00
Daniel Eklöf
1c7c9f6c16
doc: foot.ini: describe key binding match logic 2025-01-27 12:31:50 +01:00
Daniel Eklöf
8d6f0d0583
key-bindings: try all bindings in translated mode before matching untranslated, and then finally raw
When trying to match key bindings, we do three types of matching:

* Match the _translated_ symbol (e.g. Control+C)
* Match the _untranslated_ symbol (e.g. Control+Shift+c)
* Match raw keyboard codes

This was done for *each* key binding. This meant we sometimes matched
a keybinding in raw mode, even though there was a
translated/untranslated binding that would match it too. All depending
on the internal order of the key binding list.

This patch changes it, so that we first try all bindings in translated
mode, then all bindings in untranslated mode, and finally all bindings
in raw mode.

Closes #1929
2025-01-27 12:31:40 +01:00
Daniel Eklöf
7a5353d18a
forgejo: application -> application(s) 2025-01-27 06:38:14 +01:00
Daniel Eklöf
fda9638edd
forgejo: add optional field for shell/TUI 2025-01-27 06:37:40 +01:00
Daniel Eklöf
43206e6601
config: fix memory leak on e.g. "not a valid XKB key name" errors 2025-01-27 06:34:20 +01:00
Daniel Eklöf
846271e8d3
render: resize: configure with only one dimension being zero
The protocol states:

    If the width or height arguments are zero, it means the client
    should decide its own window dimension. This may happen when the
    compositor needs to configure the state of the surface but doesn't
    have any information about any previous or expected dimension.

The wording is a bit ambiguous; does it mean we should set *both*
width and height to values we choose, even if only one dimension is
zero in the configure event? Or does it mean that we should choose the
value for the dimension that is zero in the configure event?

Regardless, it's pretty clear that it does *not* mean we should *only*
choose width and height if *both* dimensions are zero in the configure
event. This is foot's behavior before this patch, meaning if only one
of them is zero, foot assumed the compositor wanted us to set the
width (or height) to zero...

Change this, so that we now choose value for the "missing" dimension,
but do use the compositor provided value for the other dimension.

Closes #1925

Relevant issues:

* https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/155
* https://github.com/YaLTeR/niri/issues/1050
2025-01-26 09:28:54 +01:00
Daniel Eklöf
97385b007f
grid: reflow: regression: remove (truncate) SPACER cells at the end of line
When printing a double-width glyph at the end of the line, it will get
pushed to the next line if there's only one cell left on the current
line.

That last cell on the current line is filled with a SPACER value.

When reflowing the text, the SPACER cell should be "removed", so that
the double-width glyph continues directly after the text on the
previous line.

9567694bab fixed an issue where
reflowing e.g. neofetch output incorrectly removed spaces between the
logo, and the system info. But also introduced a regression where
SPACER values no longer are removed.

This patch tries to fix it, by adding back empty cells, but NOT SPACER
cells.
2025-01-25 08:46:21 +01:00
Daniel Eklöf
f39b75f296
changelog: cwd > 1024 chars 2025-01-24 06:52:52 +01:00
Daniel Eklöf
787e886ff0
client: port bfabc5450b to footclient 2025-01-24 06:51:13 +01:00
camel-cdr
bfabc5450b
fix infinite loop/oom when cwd longer then 1024
The code reads cwd into a buffer, which is expanded while errno is ERANGE, with the intent of growing the buffer until the path fits.
While getcwd will set errno on error, it will not reset it once the path fits into the buffer.
So to not get an infinite loop once errno is ERANGE, we need to make sure to reset errno, such that the loop behaves as expected.
2025-01-24 06:46:58 +01:00
Daniel Eklöf
736328ab6b
config: check for FcNameUnparse() failure 2025-01-24 06:38:02 +01:00
Daniel Eklöf
ba7ecc4669
input: kitty: refactor, try to simplify and be less confusing
Use better named variables while juggling the shifted vs. unshifted
key codes.

Switch to variable names appropriate for the kitty keyboard protocol
once we have all the unshifted, shifted and base key codes done. It's
not until then we can decide which key code to use as the main key,
and whether or not to report the alternate key code.
2025-01-22 12:37:36 +01:00
Daniel Eklöf
f301f6eccc
input: kitty: add more test cases 2025-01-22 12:24:06 +01:00
Daniel Eklöf
6ca1a2c2dc
input: kitty: only set 'alternate' if the "unshifted" code is printable
Fixes a regression where alt+backspace was reported as ^[[8:127;3u
instead of ^[[127;3u.
2025-01-22 10:26:44 +01:00
Daniel Eklöf
f62a5ed1ff
input: codespell: indiciates -> indicates 2025-01-22 08:04:17 +01:00
Daniel Eklöf
5e65f3f07e
shm: codespell: re-using -> reusing 2025-01-22 08:04:17 +01:00
Daniel Eklöf
09f718878f
input: kitty: add initial unit test
Test a couple of key combos from the se and de(neo) layouts.

This unit test isn't intended to test _all_ key combinations, for all
kitty flag combinations, but to be more of a regression test -
whenever we discover a buggy, weird combo, add it here.
2025-01-22 08:04:17 +01:00
Daniel Eklöf
786037791c
input: kitty: improve handling of alternate+base keys even more
* Always do a base key lookup. Before this, we didn't do that if we
  matched the XKB sym to a lookup table entry (i.e. keypads, cursor keys
  etc.)
* Try to retrieve the unshifted symbol also when we matched the symbol
  to a lookup table entry. When successful, we now report an alternate
  key for keypad and cursor keys; before this patch, we only did that
  for keys that didn't have an entry in the lookup table (i.e. ASCII
  chars etc).

This improves compatibility with kitty (and the kitty keyboard
protocol) in more corner cases. One particular example is the neo
keyboard layout, where part of the regular keys act as keypad keys
when num-lock is active.
2025-01-20 10:34:45 +01:00
Daniel Eklöf
2ff38e86a7
input: kitty: fix alternate codepoint sometimes not being reported
When alternate key reporting is enabled (i.e. when we're supposed to
report the shifted key along with the unshifted key), we try to figure
out whether the key really is shifted or not (and thus which xkb
keysym to use for the unshifted and shifted keys in the escape).

This was done by getting the layout's *all* modifier combinations that
produce the shifted keysym, and if any of of them contained a modifier
that isn't supported by the kitty protocol, the shifted and unshifted
keys are derived from the same keysym. This is to ensure we handle
things like AltGr-combos correctly.

The issue is, since there may be more than one modifier combination
generating the shifted keysym, we may end up using the wrong keysym
just because _another_ combination set contains modifiers not
supported by the kitty protocol. What we're interrested in is whether
the *pressed* set of modifiers contains such modifiers.

Closes #1918
2025-01-20 09:08:47 +01:00
Daniel Eklöf
22e1b1610f
vt: combining chars: ensure 'key' is within range
When there's a key collision, we increment the key and check
again. When doing this, we need to ensure the key is withing range,
and wrap around to 0 if the key value is too large.
2025-01-18 10:22:24 +01:00
Daniel Eklöf
10c4e94e1b
Merge branch 'releases/1.20' 2025-01-18 09:43:57 +01:00
Daniel Eklöf
bb60618941
changelog: move utf8proc entry to correct release 2025-01-18 09:31:05 +01:00
Daniel Eklöf
e1d9b57f83
changelog: add back entry to 1.20.1, removed in de3becef96 2025-01-18 09:31:05 +01:00
Daniel Eklöf
771af699f0
meson: bump version to 1.20.2 2025-01-18 09:25:36 +01:00
Daniel Eklöf
15d9b08307
changelog: prepare for 1.20.2 2025-01-18 09:25:19 +01:00
Daniel Eklöf
077177e8a9
forgejo: bugs: short explanation of what an IME is 2025-01-18 09:24:05 +01:00
Daniel Eklöf
9361596d02
forgejo: bugs: config: uppercase description's first letter 2025-01-18 09:24:04 +01:00
Daniel Eklöf
14cd128992
forgejo: bugs: add required field 'config'
Require all bug submitters to include their foot configs.
2025-01-18 09:24:03 +01:00
Daniel Eklöf
b808eb5162
forgejo: bugs: add required field 'distro' 2025-01-18 09:24:02 +01:00
Daniel Eklöf
c5529808c4
term: cursor_refresh(): don't try to dirty the grid if we don't have one
If the compositor sends a keyboard enter event before our window has
been mapped, foot crashes; the enter event triggers a cursor
refresh (hollow -> non-hollow block cursor), which crashes since we
haven't yet allocated a grid.

Fix by no-op:ing the refresh if the window hasn't been configured yet.

Closes #1910
2025-01-18 09:24:00 +01:00
Daniel Eklöf
39061e0422
changelog: colors.flash-alpha=1.0 2025-01-18 09:23:46 +01:00
Alexander Orzechowski
de3becef96
Revert "config: don't allow colors.flash-alpha to be 1.0"
This reverts commit 56d2c3e990.
2025-01-18 09:23:41 +01:00
Alexander Orzechowski
ab5a168dbf
terminal: Refresh only overlay when flash expires
If we call render_refresh, that will wait for a callback to the main
surface. In the case of a flash, the main surface might not get callbacks
if the compositor implements fancy culling optimizations like wlroots
wlr_scene compositors such as sway version >=1.10.
2025-01-18 09:23:40 +01:00
Alexander Orzechowski
881eb28134
render: Expose render_overlay
This function updates the overlay that foot uses. It will be used to
update the overlay when the flash effect ends.
2025-01-18 09:23:39 +01:00
Daniel Eklöf
ad1e2d7d05
changelog: 'CSI 21 t' and 'OSC 176 ?' disabled 2025-01-18 09:23:35 +01:00
Daniel Eklöf
ba81480ebb
doc: ctlseqs: remove 'CSI 21 t' 2025-01-18 09:23:34 +01:00
Daniel Eklöf
354ba8dad8
osc: ignore 'OSC 176 ?' - report app ID
It's not widely used (don't know _any_ application that uses it), and
can be used to trick users to run unwanted commands.
2025-01-18 09:23:33 +01:00
Daniel Eklöf
a62194caee
csi: ignore 'CSI 21 t' - report window title
It's not widely used (don't know _any_ application that uses it), and
can be used to trick users to run unwanted commands.
2025-01-18 09:23:33 +01:00
Daniel Eklöf
87ef869767
ci: "meson [options]" is deprecated (do "meson setup [options]" instead) 2025-01-18 09:23:31 +01:00
Daniel Eklöf
80ef366bde
changelog: utf8proc.h not found 2025-01-18 09:23:31 +01:00
Daniel Eklöf
f7031a2161
meson: fix dependencies (utf8proc missing in lots of places) 2025-01-18 09:23:29 +01:00
Daniel Eklöf
2784ae8793
ci: sr.ht: try to bring up to date, and pull from codeberg 2025-01-18 09:23:29 +01:00