Commit graph

5454 commits

Author SHA1 Message Date
Daniel Eklöf
d8c4e21090
Merge branch 'releases/1.12' 2022-04-22 17:18:26 +02:00
Daniel Eklöf
ea1171a5a2
meson: bump version to 1.12.0 2022-04-22 17:14:41 +02:00
Daniel Eklöf
0cdd32043e
changelog: prepare for 1.12.0 2022-04-22 17:14:00 +02:00
Daniel Eklöf
c7248cf763
meson: add -Dtests=false|true option
When set to false, no test binaries are neither built, nor
executed (with “ninja test”).

Closes #919
2022-04-22 17:05:25 +02:00
Merlin Büge
e6f884a9e1
doc + meson.build: update information about foot.ini, small cleanup
- foot.ini.5: mention location of example config file
- foot.1: replace outdated (or incomplete) information about the
  location of the config file with references to foot.ini.5
- foot.1 and foot.ini.5: conform to scdoc specification, thus surround each
  header with (at least) one blank line. additionally consistently use exactly
  one line before/after each header (was sometimes two before)
- foot.1: some parts of the keybindings had their own section, move into
  KEYBOARD SHORTCUTS section
- foot.1: move EXIT STATUS section to the end where it is commonly found
- foot.1: copy information about config file handling from the beginning of
  foot.ini.5 into the CONFIGURATION section of foot.1
- INSTALL.md: foot.ini is no longer included in the documentation
- meson.build: do not bundle foot.ini with documentation anymore, see also
  https://codeberg.org/dnkl/foot/pulls/1015

Closes #1002
2022-04-22 17:00:04 +02:00
Daniel Eklöf
9907d7bbe9
search: don't modify search.start coord *before* finding next match
The match logic uses the last start coordinate to determine which end
points in the selection to update. This sometimes fails when the start
coordinate has been changed by e.g. a key binding - the new start
coordinate is incorrectly matched against the old-but-modified start
coordinate, causing foot to e.g. *not* upate the selection start
coordinate.

Example:

  $ echo 'test\n\test\ntest'

Then do a scrollback search for 'test. The first match is found
correctly (the last 'test'), but searching for the previous match
(ctrl+r) does not select the middle 'test'.

Fix by passing the search direction to search_find_next(), and have
_it_ calculate the coordinate to start search. There are three possibilities:

* forward
* backward
* "backward", but at the same position

The first two are used when searching for next/prev match with ctrl+s
and ctrl+r. The last one is used when the search criteria is
updated. In this case, we don't want to move to the previous match,
*unless* the current match no longer matches.
2022-04-21 18:54:27 +02:00
Daniel Eklöf
dd03e10c6c
url-mode: allow locked modifiers while handling label letter input
This fixes an issue where labels couldn’t be activated if e.g. NumLock
was enabled.
2022-04-20 21:50:49 +02:00
Daniel Eklöf
6ed9a31007
changelog: move “re-mapping input” from “changed” to “added” 2022-04-20 20:56:04 +02:00
Daniel Eklöf
e4d085a17b
input: codespell 2022-04-20 19:03:48 +02:00
Daniel Eklöf
0504a3e71a
input: copy libxkbcommon’s keysym_is_modifier()
When determining whether a keysym is a modifier (to skip hiding the
pointer when [mouse].hide-when-typing=yes), use the same matching
logic xkbcommon does.

This function, xkb_keysym_is_modifier() is unfortunately not part of
the public API, which is why we copy it instead.
2022-04-20 18:23:20 +02:00
Daniel Eklöf
8485cdaaaa
csi: implement CSI > 4n (reset modifyOtherKeys) 2022-04-19 17:25:06 +02:00
Daniel Eklöf
876044df8d
wayland: remove selection_override_modmask member
This member is no longer valid - we need to use one from the current
key-binding set.
2022-04-19 17:24:25 +02:00
Daniel Eklöf
e3683b58fc
search: add comment to ‘advance_pos()’ macro 2022-04-18 15:12:56 +02:00
Daniel Eklöf
b3d18e3c8d
search: codespell: backards -> backwards 2022-04-18 15:06:20 +02:00
Daniel Eklöf
006c75d2d3
search: rename ‘newline’ -> ‘advance_pos’ macro, reverse return value 2022-04-18 14:57:31 +02:00
Daniel Eklöf
2898ec70b6
search: input: log consumed modifiers 2022-04-18 14:57:13 +02:00
Daniel Eklöf
7b1994fce6
search: match iterator: wrap iterator’s row number, when needed 2022-04-18 14:47:17 +02:00
Daniel Eklöf
a9ed719f90
search: find_next(): assert start/end coords are valid 2022-04-18 14:47:07 +02:00
Daniel Eklöf
a46d7d95c6
search: find_next(): stop at the exact cell position specified by ‘end’
And not just when reaching end’s row.
2022-04-18 14:43:01 +02:00
Daniel Eklöf
b58ab2fd48
search: find_next(): prefix {start,end}_{row_col} with ‘match’ 2022-04-18 12:38:09 +02:00
Daniel Eklöf
9117ebebef
search: find_next(): pass an ‘end’ coord, instead of a row count 2022-04-18 12:31:07 +02:00
Daniel Eklöf
4cdae0c05b
search: refactor: find_next(): pass start as a ‘coord’ struct 2022-04-18 12:17:49 +02:00
Daniel Eklöf
68db8ff1f5
search: search_update_selection() no longer expects end coordinate to be exclusive 2022-04-18 00:01:24 +02:00
Daniel Eklöf
529da8e238
search: match iterator: handle overlapping matches 2022-04-17 19:40:51 +02:00
Daniel Eklöf
2085621bf4
render: overlay: reset ‘start_col’ after handling the first row 2022-04-17 19:26:54 +02:00
Daniel Eklöf
3905212651
search: match iterator: always return the primary match
Normally, the primary match is automatically included by the iterator,
but if the secondary and primary matches overlap, it is possible we
don’t return the _actual_ primary match. This lead to highlighting
issues, where part of the primary match wasn’t highlighted correctly.
2022-04-17 19:22:28 +02:00
Daniel Eklöf
c5519e2aa6
search: fix next/prev not updating selection correctly when matches overlap
When the new match overlapped with the old match, the selection wasn’t
updated correctly.
2022-04-17 19:16:47 +02:00
Daniel Eklöf
24ee3dcc10
wayland: refactor: remove ‘struct config’ pointer from wayland struct
The global config doesn’t necessarily reflect the correct
configuration to use - we should *always* use the current terminal
instance’s conf pointer.

* Move selection override modifier mask to the key_binding_set struct
* Always warn if XDG activation is unavailable, not just if
  bell.urgent is set (we no longer have access to this information)
* Pass ‘bool presentation_timings’ as a parameter to wayl_init()
* Remove ‘presentation_timings’ member from the ‘terminal’ struct

Closes #932
2022-04-17 16:34:04 +02:00
Daniel Eklöf
7a5e5a80b9
key-binding: NOINLINE a couple of functions, for a minor code size reduction 2022-04-17 16:11:39 +02:00
Daniel Eklöf
8046e5560a
changelog: key binding overrides having no effect with footclient 2022-04-17 16:01:30 +02:00
Daniel Eklöf
90a2ca966f
key-binding: new API, for handling sets of key bindings
Up until now, our Wayland seats have been tracking key bindings. This
makes sense, since the seat’s keymap determines how the key bindings
are resolved.

However, tying bindings to the seat/keymap alone isn’t enough, since
we also depend on the current configuration (i.e. user settings) when
resolving a key binding.

This means configurations that doesn’t match the wayland object’s
configuration, currently don’t resolve key bindings correctly. This
applies to footclients where the user has overridden key bindings on
the command line (e.g. --override key-bindings.foo=bar).

Thus, to correctly resolve key bindings, each set of key bindings must
be tied *both* to a seat/keymap, *and* a configuration.

This patch introduces a key-binding manager, with an API to
add/remove/lookup, and load/unload keymaps from sets of key bindings.

In the API, sets are tied to a seat and terminal instance, since this
makes the most sense (we need to instantiate, or incref a set whenever
a new terminal instance is created). Internally, the set is tied to a
seat and the terminal’s configuration.

Sets are *added* when a new seat is added, and when a new terminal
instance is created. Since there can only be one instance of each
seat, sets are always removed when a seat is removed.

Terminals on the other hand can re-use the same configuration (and
typically do). Thus, sets ref-count the configuration. In other words,
when instantiating a new terminal, we may not have to instantiate a
new set of key bindings, but can often be incref:ed instead.

Whenever the keymap changes on a seat, all key bindings sets
associated with that seat reloads (re-resolves) their key bindings.

Closes #931
2022-04-17 15:39:51 +02:00
Daniel Eklöf
e95bc9283e
meson: install foot.ini to /etc/xdg/foot/foot.ini
Closes #1001
2022-04-17 11:27:53 +02:00
Daniel Eklöf
501a9fbb5e
url-mode: add a key binding that enables “persistent” URL mode
This is an alternative to ‘show-urls-launch’, where we stay in URL
mode after activating an URL.

Closes #964
2022-04-17 11:24:27 +02:00
Daniel Eklöf
0062f4e133
changelog: scrollback search mode highlights all matches 2022-04-17 11:05:14 +02:00
Daniel Eklöf
9e3c71c277
render: overlay: apply weston quirk 2022-04-17 11:04:27 +02:00
Daniel Eklöf
074bbf767e
search: refactor: search_update_selection() takes a ‘struct range’ 2022-04-16 20:23:15 +02:00
Daniel Eklöf
bd089c845f
search: break out “find next match” logic to a new function 2022-04-16 20:13:22 +02:00
Daniel Eklöf
90c91d6148
search/render: initial support for highlighting all visible matches
Before this patch, only the currently “selected” match was
highlighted (by having the “selected” attribute, and by *not* dimming
it, like the rest of the grid during a scrollback search).

With this patch, we now highlight matches within the viewport. While
searching, only the “primary” match is searched-for, and tracked.

Then, when rendering a frame, we find all “secondary” matches as
well. “holes” are added to the search-mode overlay by the means of an
search-match iterator.

The iterator’s text matching logic is *very* similar to what we do
when the search criteria has been updated, and we re-search the
scrollback. It should be possible to refactor this, and share code.
2022-04-16 19:26:20 +02:00
Daniel Eklöf
78fcdc5787
render: implement ‘flash’ and search mode’s ‘dimming’ with a sub-surface
Search mode and ‘flash’ (OSC-555) both achieves similar visual
effects: flash tints the entire window yellow, and search mode dims
it (except the search match).

But, they do so in completely different ways. Search mode is detected
in render_cell(), and the colors are then dimmed there.

Flash is implemented by blending a yellow, semi-transparent color on
top of the rendered grid.

This patch replaces those two implementations with a single one. We
add a new sub-surface, called the ‘overlay’. In normal mode, it’s
unmapped.

When either search mode, or flash, is enabled, we enable it, and
fill it with a semi-transparent color. Yellow for ‘flash’, and
“black” (i.e. no color) for search mode.

The compositor then blends it with the grid. Hopefully on the GPU,
meaning it’ll be faster than if we blend in software.

There are more performance benefits however. By using a separate
surface, we can do much better damage tracking.

The normal grid rendering code no longer have to care about neither
search mode, nor flash. Thus, we get rid of a couple of ‘if’
statements in render_cell(), which is nice. But more importantly, we
can drop full grid repaints in a couple of circumstances:

* Entering/exiting search mode
* Every frame while flash is active

Now, when rendering the search mode overlay, we do want to do some
damage tracking, also of the overlay.

This, since search mode doesn’t dim the *entire* window. The search
match is *not* dimmed. This is implemented by punching a hole in the
overlay sub-surface. That is, we make part of it *fully*
transparent. The basic idea is to set a clip region that excludes the
search match, and then dim the rest of the overlay.

It’s slightly more complicated than that however, if we want to reuse
the last frame’s overlay buffer (i.e we don’t want to re-render
the *entire* overlay every frame).

In short, we need to:

* Clear (punch hole) in areas that are part of this frame’s search
  match, but not the last frame’s (since those parts are _already_
  cleared).
* Dim the areas that were part of the last frame’s search match, but
  aren’t anymore (the rest of the overlay should already be dimmed).

To do this, we save the last frame’s “holes” (as a pixman
region). Then, when rendering the next frame, we first calculate the
new frame’s “holes” region.

The region to clear is “this frame’s holes minus last frame’s holes”
The region to dim is “last frame’s holes minus this frames holes”.

Finally, we compute the bounding box of all modified cells by taking
the union of the two diff regions mentioned above. This allows us to
limit the buffer damage sent to the compositor.
2022-04-16 18:31:02 +02:00
Daniel Eklöf
abbdd3bae8
shm: add shm_did_not_use_buffer()
This allows a caller to return a buffer (obtained with
shm_get_buffer()) to the pool,

The buffer must not have been used. I.e. it must not have been
attached and committed to a wayland surface.
2022-04-16 17:47:56 +02:00
Daniel Eklöf
129deaffa8
wayland: optionally disable pointer input on subsurfaces
We have a number of sub-surfaces for which we are *not* interrested in
pointer (or touch) input.

Up until now, we’ve manually dealt with these, by recognizing these
surfaces in all pointer events, and ignoring them.

But, lo and behold, there are better ways of doing this. By clearing
the subsurface’s input region, the compositor will do this for us -
when a pointer is outside a surface’s input region, the event is
passed to the next surface underneath it.

This is exactly what we want! Do this for all subsurfaces, *except*
the CSDs.
2022-04-16 17:41:14 +02:00
Daniel Eklöf
fc2ebf772c
changelog: [csd].hide-when-maximized 2022-04-16 11:45:52 +02:00
Daniel Eklöf
fbcebd4f1c
config: add [csd].hide-when-maximized=yes|no
When enabled, the CSD titlebar will be hidden when the window is
maximized.

Closes #1019
2022-04-16 11:45:50 +02:00
Daniel Eklöf
979f48a62f
render: take (visible) CSD border size into account when setting initial size 2022-04-16 11:42:26 +02:00
Daniel Eklöf
f9103d4381
wayland: add helper functions wayl_win_csd_{titlebar,borders}_visible() 2022-04-16 11:42:25 +02:00
Daniel Eklöf
7a0e7c6c01
wayland: take (visible) border width into account on configure events
When the compositor is asking us to resize ourselves, take
our (visible) CSD borders into account. This is similar to how we
already take the titlebar size into account.

This fixes an issue where the window size “jumps” when the user starts
an interactive resize, when csd.border-width > 0.

This as been observed in GNOME.
2022-04-16 11:17:19 +02:00
Daniel Eklöf
0e477e2c5e
render: take visible border width into account when setting window geometry
This fixes e.g. window snapping in GNOME.
2022-04-16 10:57:45 +02:00
Merlin Büge
5539eac590
fix some small typos 2022-04-13 09:41:10 +02:00
Daniel Eklöf
a1796ba5cd
pgo: sync up stub version of slave_spawn() 2022-04-12 15:23:41 +02:00
Daniel Eklöf
99db7aa7cf
config: config_free(): pass conf struct by pointer, not by-value 2022-04-12 15:21:43 +02:00