Commit graph

5126 commits

Author SHA1 Message Date
Oğuz Ersen
dfbe9d8aa2 Add Apprentice theme 2021-12-17 19:09:38 +01:00
Daniel Eklöf
ee19c765bb
Merge branch 'kitty-kbd-dont-fallback-to-xkb-symbol' 2021-12-16 13:02:25 +01:00
Daniel Eklöf
4c5f53878e
input: kitty: don’t fallback to the XKB symbol
When handling “generic” keys (i.e. keys not in the Kitty keymap), we
use the pressed key’s Unicode codepoint as “key” in the kitty CSI.

If we failed to convert the XKB symbol to a Unicode codepoint, we used
to (before this patch), fallback to using the XKB symbol as is.

This can never be correct... and it caused us to emit a meaningless
CSI for XKB_KEY_ISO_Next_Group, which confused e.g. Kakoune.
2021-12-16 12:49:41 +01:00
Daniel Eklöf
55c5f0590e
Merge branch 'zooming-with-dpi-aware-no'
Closes #842
2021-12-14 18:11:36 +01:00
Daniel Eklöf
a098fad004
term: font_size_adjust: use DPI=96 when font is *not* scaled by DPI
Closes #842
2021-12-14 17:45:12 +01:00
Daniel Eklöf
3e5a9aa904
Merge branch 'wl-output-name-description' 2021-12-14 15:10:03 +01:00
Daniel Eklöf
01a417660d
wayland: add wl_output.name() and wl_output.description()
These are new in version 4 of the wl_output interface (first included
in wayland-1.20).

This allows us to get the name and description of the outputs, also on
compositors without the XDG output interface.
2021-12-13 19:17:48 +01:00
Daniel Eklöf
97174913e0
wayland: estimate scaled (logical) width/height, if not provided
This makes us slightly more resilient against a missing XDG output
interface.

We use the “real” (the physical) dimensions, combined with the scaling
factor, to estimate the logical dimensions.

This works out correctly with  non-fractional scaling, but not
otherwise.
2021-12-13 19:15:17 +01:00
Daniel Eklöf
fe851a6936
input: kitty: return the result of term_to_slave()
If term_to_slave() fails, then the key wasn’t ‘handled’...
2021-12-12 15:08:46 +01:00
Daniel Eklöf
aeeaf9c0ec
Merge branch 'kitty-static-keymap' 2021-12-11 21:06:58 +01:00
Daniel Eklöf
53fc9ca3b2
kitty: replace switch with a static keysym table 2021-12-11 21:04:58 +01:00
Daniel Eklöf
fd26fadc2c
Merge branch 'config-refactor-and-verify-binding-collisions-after-load' 2021-12-11 21:04:27 +01:00
Daniel Eklöf
6911a50df7
config: NOINLINE modifiers_to_str() 2021-12-11 20:59:08 +01:00
Daniel Eklöf
f077a2e77a
test: config: verify collisions with the mouse override modifiers are detected 2021-12-11 20:44:01 +01:00
Daniel Eklöf
40249ab3a2
test: config: port key/mouse binding tests to new API 2021-12-11 20:19:12 +01:00
Daniel Eklöf
2a02ba77a1
config: resolve collisions: argv_compare() returns -1,0,+1, not a bool 2021-12-11 20:19:12 +01:00
Daniel Eklöf
17250ec393
config: resolve collisions: return ‘false’ on failure 2021-12-11 20:19:12 +01:00
Daniel Eklöf
6fa09d24e5
config: use “(default)” as path in log message, if path is NULL 2021-12-11 20:19:12 +01:00
Daniel Eklöf
ff82a3900e
config: remove commented out struct definition 2021-12-11 20:19:11 +01:00
Daniel Eklöf
3512a7febf
config: remove unneeded function prototype 2021-12-11 20:19:11 +01:00
Daniel Eklöf
f6a591b80a
config: unify key- and mouse bindings
With this patch, key- and mouse-bindings structs (the non-layout
specific ones) are unified into a single struct.

The logic that parses, and manages, the key- and mouse binding lists
are almost identical. The *only* difference between a key- and a mouse
binding is that key bindings have an XKB symbol, and mouse bindings a
button and click-count.

The new, unified, struct uses a union around these, and all functions
that need to know which members to use/operate on now takes a ‘type’
parameter.
2021-12-11 20:19:11 +01:00
Daniel Eklöf
4c50c44cf7
config: do mouse binding collision detection after loading the conf 2021-12-11 20:19:11 +01:00
Daniel Eklöf
bb4b4ae43d
config: value_to_key_combos(): reset modifiers in binding 2021-12-11 20:19:11 +01:00
Daniel Eklöf
e67639a682
main: ignore SIGPIPE
We want to handle SIGPIPEs without crashing... One way to trigger this
was to use e.g.

  pipe-visible=[cat /foo/bar] Control+Shift+q

That is, pipe output to something that did not consume it. This led
to a SIGPIPE when we tried to write the terminal contents to the pipe,
and crashed the whole foot instance.
2021-12-11 20:19:11 +01:00
Daniel Eklöf
197c1c5ced
config: do key binding collision detection after loading the conf
This allows the user to write, to swap two key bindings:

  [key-bindings]
  show-urls-launch=Control+Shift+r
  search-start=Control+Shift+u

instead of:

  [key-bindings]
  search-start=none
  show-urls-launch=Control+Shift+r
  search-start=Control+Shift+u

This should simplify the configuration for people who replace a lot of
the default key bindings.

This also simplifies the parsing somewhat, since we no longer has to
parse a key-binding into a temporary list, ensure it doesn’t have any
collisions, and then copy it into the actual key binding list.

_While_ parsing a key-binding, we still need a temporary array (at
least for the time being), but that temporary array is no longer
visible outside the parsing function that allocates it.
2021-12-11 20:19:11 +01:00
Daniel Eklöf
fc2bacbb78
config: remove struct key_combo, use config_key_binding instead 2021-12-11 20:19:10 +01:00
Daniel Eklöf
87c454c044
test: meson: add fontconfig to ‘test-config’ binary (fixes PGO builds) 2021-12-11 20:09:30 +01:00
Daniel Eklöf
8d7dceb88a
Merge branch 'config-unittest'
Part of #813
2021-12-11 18:54:42 +01:00
Daniel Eklöf
614de228a8
test: config: mouse-bindings 2021-12-11 18:52:06 +01:00
Daniel Eklöf
9c5019ae77
test: config: key-bindings
This adds tests for all [key-bindings] options, as well as an invalid
“action”.

The tests also verify key combo collisions are detected correctly.
2021-12-11 18:52:05 +01:00
Daniel Eklöf
8cf9f0f0dc
tests: meson: link with tllist 2021-12-11 18:52:05 +01:00
Daniel Eklöf
4a00d0d050
ci (gitlab+builds.sr.ht): execute foot{,client} --version
This runs our builtin unit tests (debug builds only), and verifies it
runs, at all. (and also logs the version in the build logs...)
2021-12-11 18:52:05 +01:00
Daniel Eklöf
7a9f929368
test: config: cover all basic (primitive) options in [main] 2021-12-11 18:52:05 +01:00
Daniel Eklöf
e1c3bdc6f2
test: initial external unit test suite for ‘config.c’
This patch adds a separate (external) test binary with unit tests for
config.c

This is achieved by having the test’s source file include
config.c (yes, the C file, not the header file).

This allows us to call e.g. parse_section_*() directly, without having
to go through config_load() (which requires having a readable file at
“path”).
2021-12-11 18:52:05 +01:00
Daniel Eklöf
c685406a13
changelog: kitty kbd: add link to codeberg issue 2021-12-08 19:06:51 +01:00
Daniel Eklöf
7ed671ef59
Merge branch 'releases/1.10' 2021-12-08 18:20:53 +01:00
Daniel Eklöf
baae46ea75
changelog: kitty: alternate keys: base layout key is implemented 2021-12-08 18:20:26 +01:00
Daniel Eklöf
3d7643b181
Merge branch 'releases/1.10' 2021-12-08 18:14:44 +01:00
Daniel Eklöf
a9026f16a7
meson: bump version to 1.10.3 2021-12-08 18:09:50 +01:00
Daniel Eklöf
924726ac76
changelog: prepare for 1.10.3 2021-12-08 18:08:45 +01:00
Daniel Eklöf
352077c78a
kitty: simplify: always calculate alternate/base keys
But only _emit_ them if report alternate has been enabled.
2021-12-08 18:06:10 +01:00
Daniel Eklöf
30a66996b2
kitty: when emitting associated text, don’t report mods/events unless necessary 2021-12-08 18:06:08 +01:00
Daniel Eklöf
db95a90e57
kitty: report-alternate: apply base-layout key to composed characters 2021-12-08 18:06:06 +01:00
Daniel Eklöf
7e9ca65f4d
kitty: implement “base layout key” in “report alternate key” 2021-12-08 18:06:04 +01:00
Daniel Eklöf
010c4001d2
kitty: initial support for “report alternate key”
In this mode, the “shifted” and “base layout” keys are added to the
CSIs, as sub-parameters to the “key” parameter.

Note that this PR only implements the “shifted” key, not the “base
layout key”.

This is done by converting the original XKB symbol to it’s
corresponding UTF-32 codepoint. If this codepoint is different from
the one we use as “key” in the CSI, we add it as a sub-parameter.

Related to #319
2021-12-08 18:06:02 +01:00
Daniel Eklöf
f3f3f60040
kitty: only emit plain text on key press- and repeat events
That is, release events always generate CSIs
2021-12-08 18:05:56 +01:00
Daniel Eklöf
40b69ab521
kitty: add ISO_Level{3,5}_Shift keys 2021-12-08 18:05:51 +01:00
Daniel Eklöf
305f3122b1
kitty: composed characters with “report associated text”
The generic input handler now converts the composed character to it’s
UTF-32 equivalent. This means we now provide a valid UTF-32 codepoint
for both composed characters, and non-composed (plain-text)
characters.

Use this in the kitty protocol to simplify the logic around composed
characters, by simply treating them as plain text.
2021-12-08 18:05:49 +01:00
Daniel Eklöf
7a5386d883
kitty: implement “report associated text”
In this mode, key events that generate text now add a third CSI
parameter, indicating the actual codepoint.

Remember that we always use the *unshifted* key in the CSI
escapes. With this mode, those CSI escapes now also included the text
codepoint. I.e. what would have been emitted, had we not generated a
CSI escape.

As far as I can tell, this mode has no effect unless “report all keys
as escape sequences” is enabled (reason being, without that, there
aren’t any text events that generate CSIs - they’re always emitted
as-is).

Note that Kitty itself seems to be somewhat buggy in this mode. At
least on Wayland, with my Swedish layout. For example ‘a’ and ‘A’ does
generate the expected CSIs, but ‘å’ and ‘Å’ appears to be treated as
non-text input.

Furthermore, Kitty optimizes away the modifier parameter, if no
modifiers are pressed (e.g. CSI 97;;97u), while we always emit the
modifier (CSI 97;1;97u).

Related to #319
2021-12-08 18:05:46 +01:00
Daniel Eklöf
9649842eca
grid: reload pointers into the uri range vector after inserting
Inserting elements into the URI range vector typically triggers a
vector resize. This is done using realloc(). Sometimes this causes the
vector to move, thus invalidating all existing pointers into the
vector.
2021-12-08 18:05:40 +01:00