Commit graph

4040 commits

Author SHA1 Message Date
Daniel Eklöf
ed41bffc28
osc: add support for URxvt extension to include alpha in OSC-11
There are two variants, either using a ‘[percent]’ prefix for legacy
colors, or using ‘rgba:r/g/b/a’ instead of ‘rgb:r/g/b’.

Closes #436
2021-04-08 10:41:38 +02:00
Daniel Eklöf
0af7916fcc
Merge branch 'drain-pty-when-client-terminates' 2021-04-08 10:41:05 +02:00
Daniel Eklöf
47e532d4b0
ci: build on alpine/latest, not edge 2021-04-07 19:52:46 +02:00
Daniel Eklöf
fb4066f94e
terminal: drain PTY when client terminates
This is done by:

* Not limiting the number of times we try to read from the PTY when
  we’ve have POLLHUP
* Not requiring the entire the previous read to have filled our
  buffer.
* Not erroring out on EIO.
2021-04-07 19:09:31 +02:00
Daniel Eklöf
5f8a8951c7
sixel: unhook: tighten up the condition needed for us to free image data pre-maturely 2021-04-07 19:08:29 +02:00
Daniel Eklöf
f9a730f33b
sixel: sixel_fini(): free image data
Normally, this data is always free:d indirectly, when the sixel image
that took over ownership is destroyed. But let’s play it safe.
2021-04-07 19:07:43 +02:00
dnkl
b119a8a24a Merge pull request 'Don't copy default colors from config to each terminal instance' (#438) from refactor-colors into master
Reviewed-on: https://codeberg.org/dnkl/foot/pulls/438
2021-04-07 09:31:59 +02:00
Daniel Eklöf
936063271f
config/terminal: refactor: remove “default_*” color members from terminal struct
Access the original colors in the configuration instead.
2021-04-07 08:07:43 +02:00
Daniel Eklöf
44a166dde8
wayland: {xdg_,}output_*(): free old strings before assigning new ones
Defensive programming; output_geometry() etc are typically only called
once for an output instance. But let’s ensure we’re not leaking memory
if it’s called more than once.
2021-04-07 08:04:24 +02:00
Daniel Eklöf
e299b1d9f4
changelog: move OSC-4/104 fix from 1.7.1 to ‘unreleased’ 2021-04-05 22:07:58 +02:00
Daniel Eklöf
335bd36628
Merge branch 'osc-4-check-index-is-within-bounds'
Closes #434
2021-04-05 22:02:02 +02:00
Daniel Eklöf
4f0c0628a2
osc: verify OSC 4/104 color index is valid
Closes #434
2021-04-05 21:13:32 +02:00
Daniel Eklöf
4ec2c59861
Merge branch 'fix-error-message-for-key-binding-collisions'
Closes #432
2021-04-05 16:03:43 +02:00
Daniel Eklöf
65dead29e0
config: make {search,url}_binding_action_map[] function local
This ensures we don’t accidentally reference them from places we
shouldn’t.

Unfortunately, binding_action_map[] (for “normal” key bindings) cannot
easily be made function local since it is used when parsing both key-
and mouse bindings (i.e. it’s used in multiple functions).
2021-04-05 14:50:21 +02:00
Daniel Eklöf
fa6382aeb3
doc: foot.ini: fix default value for delete-next-word 2021-04-05 14:37:42 +02:00
Daniel Eklöf
285e3c4aa2
config: parse_key_binding_section(): use provided action-map
Don’t call has_key_binding_collisions() with ‘binding_action_map’
unconditionally; use the provided ‘action_map’ instead.

This fixes wrong error messages for key combo collisions in key
binding sections other than the regular “key-bindings”.
2021-04-05 14:36:22 +02:00
Daniel Eklöf
1b4b64dca7
Merge branch 'sixel-fix-double-free-in-set-palette-size'
Closes #427
2021-03-30 11:19:58 +02:00
Daniel Eklöf
00083125a1
sixel: fix double free caused by bad free() in sixel_colors_set()
sixel_color_set() is called when the number of (sixel) color registers
is changed.

It frees the current palette, and changes the “palette size” variable.

Originally, we only had a single palette. This is the one free:d by
sixel_color_set().

Later, we added support for private vs. shared palettes. With this
change, we now have one palette that is “never” free:d (the shared
one), and a private palette that is always free:d after a sixel has
been emitted.

‘sixel.palette’ is a pointer to the palette currently in use, and
should only be accessed **while emitting a sixel**.

This is the pointer sixel_color_set() free:d. So for example, if
‘sixel.palette’ pointed to the shared palette, we’d free the shared
palette. But, we didn’t reset ‘sixel.shared_palette’, causing a double
free later on.

Closes #427
2021-03-30 11:08:03 +02:00
Daniel Eklöf
515a139c28
Merge branch 'revert-remove-consumed-modifiers-from-set-sent-to-client'
Closes #425
2021-03-30 10:54:58 +02:00
Daniel Eklöf
058eba33ec
revert: input: do not include consumed modifiers in the set sent to the client
There were two issues with it:

* Not all applications decode the sequence into a set of modifiers +
  key, but use a fixed sequence -> combo mapping, that we broke.

* There were unforeseen issues with e.g. F1-12, where the modifier
  were removed from combos like Ctrl+F12, or Alt+F12. The reason is
  simple; XKB tells us that Ctrl, or Alt, is a consumed modifier. Now,
  _why_ it thinks that is a different story.

This reverts 6cd72bdee6

Closes #425
2021-03-29 20:11:32 +02:00
Daniel Eklöf
37245fe4e6
term: free vt.osc8.uri when destroying a terminal
Free vt.osc8.uri in term_destroy(), in the off chance, that the client
application emitted an un-terminated OSC-8 URI.
2021-03-28 21:01:22 +02:00
Daniel Eklöf
a88a86f797
install: add ‘ninja test’ to all build types
While we don’t (yet) have any unit tests for foot, users can build
foot with e.g. fcft and/or tllist as sub-projects. *They* have tests,
and when doing PGO builds, those test binaries *must* be executed, or
we get link failures in the final build.
2021-03-28 17:24:35 +02:00
Daniel Eklöf
5709630362
changelog: add new ‘unreleased’ section 2021-03-28 14:29:55 +02:00
Daniel Eklöf
5757b6dc1c
Merge branch 'releases/1.7' 2021-03-28 14:28:53 +02:00
Daniel Eklöf
ca89f977b5
meson/pkgbuild: bump version to 1.7.1 2021-03-28 14:25:29 +02:00
Daniel Eklöf
3c92777dd2
changelog: prepare for 1.7.1 2021-03-28 14:25:09 +02:00
Daniel Eklöf
0d0ebebb64
Merge branch 'master' into releases/1.7 2021-03-28 14:24:38 +02:00
Daniel Eklöf
6ae14614a5
Merge branch 'search-treat-empty-cells-as-spaces' 2021-03-28 14:22:34 +02:00
Daniel Eklöf
527d47488c
Merge branch 'sixel-trimming' 2021-03-28 13:46:10 +02:00
Daniel Eklöf
efbbcf289f
changelog: empty sixels resulted in non-empty images 2021-03-28 13:22:10 +02:00
Daniel Eklöf
19289bad5e
sixel: free backing buffer if final image size is zero 2021-03-28 13:22:10 +02:00
Daniel Eklöf
3566be591a
sixel: initialize max_non_empty_row_no to -1, not 0
0 is a perfectly valid row number, and if max_non_empty_row_no==0,
that means we have *1* sixel row, and after trimming the image, the
image will have a height of 6 pixels.

If the sixel sequence is empty (or at least doesn’t emit any non-empty
pixels), then trimming the image should result in an image height of
0.

When max_non_empty_row_no is initialized to -1, it will still have
that value in unhook(), which makes the final image height 0.
2021-03-28 13:22:09 +02:00
Daniel Eklöf
0a24d0e40f
changelog: spaces matches empty cells in scrollback search mode 2021-03-28 13:21:33 +02:00
Daniel Eklöf
2b7c5db188
search: when matching cell content, treat empty cells as spaces 2021-03-28 13:21:18 +02:00
Daniel Eklöf
a8c5168516
Merge branch 'pgo-clang-11'
Closes #418
2021-03-28 13:20:11 +02:00
Daniel Eklöf
b5ceed7b2b
meson: replace log+debug+xmalloc static libraries with a single ‘common’ library
There are cyclic dependencies between the log, debug and xmalloc
libraries. While having them as separate static libraries work, as
long as consumers of them link against all of them, having them in a
single library feels slightly better.
2021-03-27 13:20:54 +01:00
Daniel Eklöf
65012609b8
readme: dpi & fonts: focus on *current* behavior
The text was describing the original behavior, where output scaling
was completely ignored, and tacked on a “btw, starting with
foot-1.6...”.

Now, simply describe the current behavior, and be more clear about
_how_ dpi-aware can be changed.
2021-03-27 12:28:39 +01:00
Daniel Eklöf
9786197d03
changelog: updated PGO build instructions 2021-03-26 22:16:55 +01:00
Daniel Eklöf
3fd9256c02
install: clang-11.x compatible PGO instructions
LLVM/Clang 11.x throws errors for _files_ without any profiling data:

  error: ../../async.c: Function control flow change detected (hash mismatch) async_write Hash = 72057641800614222 [-Werror,-Wbackend-plugin]

This caused multiple issues with the current PGO instructions:

* The `pgo` binary failed to link with `meson configure -Db_pgo=use`
  when doing a full PGO build (since it isn't used in this case);
* `footclient` fails to link for the same reason.
* `foot` fails to link for the same reason in **partial** PGO builds.

The solution is to make sure all binaries that are built in the final
phase (`-Db_pgo=use`) have been executed in the _generate_ phase.

Doing this also means we can drop `-Wno-missing-profile` and friends.

Also add `--sixel` to the `generate-alt-random-writes` command line in
the description for a full PGO build.

Closes #418
2021-03-26 22:16:55 +01:00
Daniel Eklöf
243578d308
install: add ‘llvm’ as an optional build dependency
It is needed for PGO builds with Clang.
2021-03-26 22:16:54 +01:00
Daniel Eklöf
628382bc90
PKGBUILD: do PGO with either gcc or clang, but nothing else
Before this, we assumed gcc was being used. The build would fail if
clang (or something else) was used.

Now, we check whether we’re compiling with gcc or clang, and disable
PGO if it’s neither of them.

Furthermore, we’re now adding the necessary flags needed to do PGO
with clang.

Note that ‘llvm-profdata’, from the ‘llvm’ package is needed for
PGO:ing with clang. PGO is disabled if it isn’t available. It would be
nice to have ‘llvm’ as an optional make dependency, but PKGBUILDs
doesn’t appear to support such a thing.

Finally, the -Wno-missing-profile flag, and its friends, have been
removed; instead we execute “footclient --version” (and “foot
--version”, in partial PGO builds) to ensure all generated binaries
have been executed before we do the final build (with
-Db_pgo=use). This fixes build failures with clang >= 11.x.
2021-03-26 22:16:54 +01:00
Daniel Eklöf
ae6a656f49
meson: only build the pgo helper binary when -Db_pgo=generate
This is the only time it’s needed.

In non-PGO builds, it is completely unnecessary, and we’re only
wasting CPU cycles building it.

In full PGO builds, with -Db_pgo=use, we get link warnings and/or
failures, depending on compiler, since the pgo binary hasn’t been
executed.
2021-03-26 20:34:18 +01:00
Daniel Eklöf
c6fb10863d
meson: build source files common to both foot and footclient as libraries
Source files used by both foot and footclient are now compiled as
static libraries, which foot and footclient links against.
2021-03-26 20:31:09 +01:00
Daniel Eklöf
9b20764f35
features: --version now logs +/-pgo
That is, whether the binary was compiled with PGO or not.
2021-03-26 20:30:13 +01:00
Daniel Eklöf
649820eeba
Merge branch 'buffer-size-multiple-of-scale-factor'
Closes #409
2021-03-25 09:47:09 +01:00
Daniel Eklöf
a8de14c0bf
changelog: sub-surface sizes not a multiple of the scaling factor 2021-03-25 09:42:15 +01:00
Daniel Eklöf
1a0f13640e
render: make sure surface buffer sizes are a multiple of the scaling factor
The buffer attached to a surface with wl_surface_attach() must have a
width and height that both are a multiple of the scale configured for
that buffer:

   The new size of the surface is calculated based on the buffer
   size transformed by the inverse buffer_transform and the
   inverse buffer_scale. This means that at commit time the supplied
   buffer size must be an integer multiple of the buffer_scale. If
   that's not the case, an invalid_size error is sent.

Due to a libwayland bug[^1], this is currently *not* being reported as an
error. However, recent versions of Sway have started enforcing this,
and is e.g. dropping (not rendering) sub-surfaces that does not adhere
to this.

[^1]: https://gitlab.freedesktop.org/wayland/wayland/-/issues/194

Closes #409
2021-03-25 09:39:50 +01:00
Daniel Eklöf
5b8b3baa65
render: render_osd(): no need to pass width/height as parameters
All uses of render_osd() passes buf->width/buf->height as
width/height. Thus, we can simply remove the width/height parameters
and have render_osd() use buf->width and buf->height directly.
2021-03-25 09:39:50 +01:00
Daniel Eklöf
601f2ecef5
Merge branch 'sixel-deadlock' 2021-03-25 09:38:59 +01:00
Daniel Eklöf
8111ff4be8
render: draw sixels before taking the render worker lock
This fixes a possible deadlock; render_sixels_images() may call
render_cell(), which may need to take the worker lock (when rendering
either a blinking cell, or a box drawing glyph that isn’t yet in the
glyph cache).
2021-03-25 09:38:51 +01:00