Commit graph

4441 commits

Author SHA1 Message Date
Daniel Eklöf
ef349bfea2
server: make sure ‘overrides’ have been initialized in all error paths 2021-06-23 15:38:29 +02:00
Daniel Eklöf
15e7e80245
client: make sure ‘fd’ is initialized in all error paths 2021-06-23 15:32:03 +02:00
Daniel Eklöf
68494956b7
Merge branch 'footclient-override'
Closes #600
2021-06-23 15:19:11 +02:00
Daniel Eklöf
5fc8275eb2
client: add and use function push_override()
We now track override data (length + malloc:ed string) in a struct,
and push this struct to our overrides linked list.

There’s a new function, push_override() that takes a string,
calculates its length, strdup() it and pushes it to the linked
list. This function also length-checks the string, to ensure we don’t
overflow.

This way, we don’t have to loop the overrides list twice; once when
calculating the total length of all overrides, and once when sending
the overrides to the server.

Now, we can update the total length as we add overrides (i.e while
parsing the command line, instead of afterwards).

This means we only have to loop the list once, and that’s when sending
it. This also means there’s no longer any need to malloc an array
holding the lengths of each override.
2021-06-23 15:12:09 +02:00
Daniel Eklöf
bac3964039
changelog: add ref to #600 (-o,--override for footclient) 2021-06-23 15:12:09 +02:00
Daniel Eklöf
5b9a000b9b
completions: add -o,--override to footclient 2021-06-23 15:12:09 +02:00
Daniel Eklöf
8640a9c99a
doc: footclient.1: document -o,--override 2021-06-23 15:12:09 +02:00
Daniel Eklöf
fcc20456cd
doc: foot.1: remove trailing space, add ‘=’ between option name and its value 2021-06-23 15:12:09 +02:00
Daniel Eklöf
63a64bdca1
client: implement -o,--override 2021-06-23 15:12:08 +02:00
Daniel Eklöf
c6b5ac9299
main: usage: add ‘=’ between --override and its value
This is how all other long options are documented in the usage.
2021-06-23 15:12:08 +02:00
Daniel Eklöf
04d42662c7
server: avoid “member access within misaligned address” ASAN warning 2021-06-23 15:12:08 +02:00
Daniel Eklöf
136d60606a
client: send overrides for everything that is publicly visible in the conf
Send a generic “overrides” list to the server, containing options in
text, on the format “section.key=value”.

This reduces the size of the base client/server protocol packet, as
well as opens up for a generic -o,--override command line option (not
yet implemented).
2021-06-23 15:12:08 +02:00
Daniel Eklöf
fa5cde6ce1
server: use config_clone() + config_override_apply()
When the connecting client overrides config options, clone the
server’s configuration, and then convert the overridden options to
config overrides, and apply them using config_override_apply().

When destroying the client, free the cloned config using the regular
config_free().
2021-06-23 15:12:07 +02:00
Daniel Eklöf
a5dd71bc7b
Merge branch 'refresh-on-csd-ssd-change' 2021-06-23 15:10:56 +02:00
Daniel Eklöf
26089e8f4d
config: clone: fix font-list cloning
Need to copy over *all* members...
2021-06-23 13:00:50 +02:00
Daniel Eklöf
4e5f5026b8
Merge branch 'config-clone' 2021-06-23 12:54:55 +02:00
Daniel Eklöf
2a83202fdd
wayland: apply CSD/SSD changes in the surface configure event
The configure event asks the client to change its decoration
    mode. The configured state should not be applied immediately.
    Clients must send an ack_configure in response to this event.
    See xdg_surface.configure and xdg_surface.ack_configure for
    details.

In particular, ”the configured state should *not* be applied
immediately”.

Instead, treat CSD/SSD changes like all other window dimension related
changes: store the to-be mode in win->configure, and apply it in the
surface configure event.

This fixes an issue where foot incorrectly resized the window when the
server switched between CSD/SSD at run-time.
2021-06-23 12:37:56 +02:00
Daniel Eklöf
f7860aec76
config: add new function config_clone() 2021-06-23 10:39:14 +02:00
Daniel Eklöf
42ec264075
tokenize: strdup() each individual argv
Instead of referencing the un-tokenized “raw” command string, strdup()
each argv. This way, the input string can be ‘const’.
2021-06-20 14:19:22 +02:00
Daniel Eklöf
7632e16e36
config: remove duplicated error logs for invalid colors 2021-06-20 13:55:12 +02:00
Daniel Eklöf
8177dbcc86
Merge branch 'csd-button-fg-color' 2021-06-20 13:53:21 +02:00
Daniel Eklöf
7334b53d83
config: add csd.button-color option
This option controls the foreground color of the
minimize/maximize/close buttons. I.e. the color used to draw the
minimize/maximize/close glyphs.

It defaults to default background color.
2021-06-20 10:44:50 +02:00
Daniel Eklöf
1a755d0da2
uri: hostname_is_localhost(): don’t crash if hostname == NULL 2021-06-19 15:56:39 +02:00
Daniel Eklöf
078f790b72
term: fix regression after merging #599
Don’t increment ‘j’ twice in each loop iteration, and fix typo in loop
condition (check ‘j’, not ‘i’).
2021-06-18 15:56:34 +02:00
Daniel Eklöf
fa06cf31ff
Merge branch 'title-update'
Closes #591
2021-06-18 15:56:06 +02:00
Daniel Eklöf
07b455e882
render: don’t create/destroy the title update timer each time
Create it once when instantiating the terminal. Add a boolean to track
whether the timer is running or not.
2021-06-18 15:53:47 +02:00
Daniel Eklöf
535c82d628
render: use a timer instead of relying on the frame callback for title update throttling
Using the frame callback works most of the time, but e.g. Sway doesn’t
call it while the window is hidden, and thus prevents us from updating
the title in e.g. stacked views.

This patch uses a timer FD instead. We store a timestamp from when the
title was last updated. When the application wants to update the
title, we first check if we already have a timer running, and if so,
does nothing.

If no timer is running, check the timestamp. If enough time has
passed, update the title immediately.

If not, instantiate a timer and wait for it to trigger.

Set the minimum time between two updates to ~8ms (twice per frame, for
a 60Hz output, and ~once per frame on a 120Hz output).

Closes #591
2021-06-18 15:36:58 +02:00
Daniel Eklöf
b77dbc341b
Merge branch 'reduce-tllist-usage' 2021-06-18 15:36:12 +02:00
Daniel Eklöf
09eb0d1bbb
config: work around clang-11.0 issue
Clang-11.0 doesn’t seem to understand that our ‘static const’ key
modifiers are compile-time constant. Clang-11.1 doesn’t appear to have
this issue.
2021-06-18 15:35:59 +02:00
Daniel Eklöf
495c730487
config: don’t use tllist where it isn’t necessary
tllists are great when dealing with dynamically changing lists. They
are also very easy to use when building lists/arrays where the final
size is unknown.

However, this ease of use comes at a price: code size. tll-macros
expand to a lot of code.

Since things in the config are static, once the config has been
loaded, using tllists for configuration data structures doesn’t make
much sense.

This patch replaces nearly all tllists used by the configuration, with
dynamically allocated arrays.
2021-06-18 15:35:57 +02:00
Daniel Eklöf
31e10c1613
Merge branch 'footclient-dont-copy-conf-unless-necessary' 2021-06-18 15:34:11 +02:00
Daniel Eklöf
26b0e3d441
Merge branch 'underline-positioning'
Closes #490
2021-06-18 15:32:51 +02:00
Daniel Eklöf
7d2770f154
server: don’t clone the config unless we’re going to modify it 2021-06-17 18:11:16 +02:00
Daniel Eklöf
cf81fff062
config: add underline-offset option
This option allows the user to configure a custom underline
offset. That is, use the user provided offset instead of the font
provided one.

Closes #490
2021-06-17 17:54:21 +02:00
Daniel Eklöf
11829931a7
search: don’t crash when we don’t have any XKB compose state 2021-06-16 17:44:14 +02:00
Daniel Eklöf
ee2b0cb21f
Merge branch 'optimize-erase-cell-range' 2021-06-15 16:28:03 +02:00
Daniel Eklöf
45a04393c4
term: erase_cell_range: early break out from URI loop
URI ranges are sorted. This means we don’t have to check any more
ranges once we’ve seen one that starts *after* the erase range.

Closes #594
2021-06-15 16:26:43 +02:00
Daniel Eklöf
5caa87adaf
term: no need to set attrs.clean=0 right after copying the VT attrs struct
When printing a character to a cell, we copy the current VT state’s
attributes to the cell. And then clear the ‘clean’ bit.

But the ‘clean’ bit is part of the VT state, and is *always*
zero. Thus there’s no need to explicitly clear it right after copying
the VT state.
2021-06-15 12:38:35 +02:00
Daniel Eklöf
d1d145e7c1
Revert "gitignore: compile_commands.json + .ccls-cache"
This reverts commit 1dabc10494.
2021-06-15 11:29:07 +02:00
Daniel Eklöf
968f6c0738
Merge branch 'doc-cc1-to-c1' 2021-06-14 19:29:58 +02:00
nick black
80e780627f
[foot-ctlseqs] 8-bit control characters are C1 2021-06-14 06:21:20 -04:00
Daniel Eklöf
1dabc10494
gitignore: compile_commands.json + .ccls-cache 2021-06-13 20:05:51 +02:00
Daniel Eklöf
c3274fd97e
Merge branch 'xtversion'
Closes #359
2021-06-13 17:20:47 +02:00
Daniel Eklöf
772e376992
doc: ctlseq: add XTVERSION 2021-06-13 17:19:49 +02:00
Daniel Eklöf
3adc3367e6
csi: implement XTVERSION (CSI > 0q)
This is a fairly new XTerm extension. The reply is on the format:

  DCS > | text ST

XTerm replies with ‘text’ = “XTerm(366)”.

Foot replies with ‘text’ = “foot(1.6.4)”

Closes #359
2021-06-13 17:19:41 +02:00
Daniel Eklöf
efd023ad32
generate-version: add a define for “extra” version information
This will be set to “rrr-gNNNNNNN” when building from git, and the
empty string otherwise.
2021-06-13 17:19:35 +02:00
Craig Barnes
c32c206a37 doc: foot-ctlseqs: mention that SS2/SS3 only affect the next character 2021-06-12 12:45:03 +01:00
Craig Barnes
d85bd7084d doc: foot-ctlseqs: rename SS0/SS1 to SO/SI
There's no mention of SS0 or SS1 functions in ECMA-48 or ECMA-35.

0x0E/0x0F are SO/SI (Shift In/Out) in "7-bit environments" or LS0/LS1
(Locking Shift 0/1) in "8-bit environments". The former is the one
that applies to foot, since it generally follows "7-bit" conventions
due to its use of UTF-8.

See also: ECMA-35 §7.2 and §9.2.
2021-06-12 12:22:07 +01:00
Craig Barnes
02259f60a6 Replace tab indents with spaces in config.h 2021-06-12 10:33:33 +01:00
Daniel Eklöf
6a0a6b0b01
Merge branch 'config-cli-override'
Closes #554
2021-06-12 10:12:19 +02:00