Commit graph

1770 commits

Author SHA1 Message Date
Daniel Eklöf
795b0e7ea1
shm: print performance warning when FALLOC_FL_PUNCH_HOLE isn't supported 2020-03-22 21:05:05 +01:00
Daniel Eklöf
7404ace40c
shm: verify the system supports FALLOC_FL_PUNCH_HOLE 2020-03-22 21:05:00 +01:00
Daniel Eklöf
3b9be09b06
shm: scroll: no need to instantiate a new buffer when ftruncate() fails 2020-03-22 20:34:58 +01:00
Daniel Eklöf
ed987b2de7
render: use shm_scroll() when we believe it will be faster
shm_scroll() is fast when memmove() is slow. That is, when scrolling
a *small* amount of lines, shm_scroll() is fast.

Conversely, when scrolling a *large* number of lines, memmove() is
fast.

For now, assume the two methods perform _roughly_ the same given a
certain number of bytes they have to touch.

This means we should use shm_scroll() when number of scroll lines is
less than half the screen. Otherwise we use memmove.

Since we need to repair the bottom scroll region after a shm_scroll,
those lines are added to the count when determining which method to
use.

TODO:

* Check if it's worth to do shm scrolling when we have a top scroll
  region.
* Do more performance testing with a) various amount of scrolling
  lines, and b) larger bottom scroll regions.
2020-03-22 20:22:17 +01:00
Daniel Eklöf
1224807f50
shm: new function, shm_scroll()
This function "scrolls" the buffer by the specified number of (pixel)
rows.

The idea is move the image offset by re-sizing the underlying memfd
object. I.e. to scroll forward, increase the size of the memfd file,
and move the pixman image offset forward (and the Wayland SHM buffer
as well).

Only increasing the file size would, obviously, cause the memfd file
to grow indefinitely. To deal with this, we "punch" a whole from the
beginning of the file to the new offset. This frees the associated
memory.

Thus, while we have a memfd file whose size is (as seen by
e.g. fstat()) is ever growing, the actual file size is always the
original buffer size.

Some notes:

* FALLOC_FL_PUNCH_HOLE can be quite slow when the number of used pages
  to drop is large.

* all normal fallocate() usages have been replaced with ftruncate(),
  as this is *much* faster. fallocate() guarantees subsequent writes
  wont fail. I.e. it actually reserves (disk) space. While it doesn't
  allocate on-disk blocks for on-disk files, it *does* zero-initialize
  the in-memory blocks. And this is slow. ftruncate() doesn't do this.

TODO: implement reverse scrolling (i.e. a negative row count).
2020-03-22 20:06:44 +01:00
Daniel Eklöf
48091966cb
render: resize: update saved 'normal' cursor if we're in alt screen
When resizing in alt mode, we never updated the saved 'normal'
cursor. This meant that when we exited alt mode, the cursor would be
positioned where it was in the old pre-resize/reflow grid.

Now, we update the saved cursor in the same way we update visible
cursor. The result is that when we exit the alt screen, the cursor
is restored to the same coordinates it would have been updated to had
the resize been done in the 'normal' screen.
2020-03-22 11:14:56 +01:00
Daniel Eklöf
f7572d4ab1
server: purge *all* buffers when a terminal shuts down
Previously we only purged the main grid buffers. Now we also purge the
search buffers and the CSD buffers.
2020-03-18 16:53:12 +01:00
Daniel Eklöf
6a35abb6ca
shm: new functions: shm_cookie_*()
These functions return a SHM cookie given a terminal instance.
2020-03-18 16:52:33 +01:00
Daniel Eklöf
7b610e018b
shm: log size of purged buffer 2020-03-18 16:41:38 +01:00
Daniel Eklöf
0419156494
search: replace hard-coded key bindings with "user configurable" ones
They aren't really user configurable. At least not yet.

However, with this, we now handle raw key codes just like the normal
key bindings. Meaning, e.g. ctrl+g, ctrl+a, ctrl+e etc now works while
searching with e.g. a russian layout.
2020-03-18 15:30:14 +01:00
Daniel Eklöf
a69b818a62
input: bindings: don't match raw key code alone - mods must also match 2020-03-18 14:52:39 +01:00
Daniel Eklöf
c87cec8c1e
conf: bindings: case insensitive matching against 'none' 2020-03-18 14:52:04 +01:00
Daniel Eklöf
6d30e7d15d
input: bind key bindings to raw key codes too
Before, when looking for a matching user key binding, we only
matched *symbols*.

This means that the physical keys that generate a specific key binding
is layout dependent. What's worse, it may not even be possible to
generate the key binding at all.

Russian is one such layout, where all the "normal" (us) symbols are
replaced.

By using raw key codes, we can get around this - the key code has a
direct mapping to the physical key.

However, matching raw key codes **only** doesn't always make sense
either. For now, match **both** symbols _and_ key codes. Symbols take
precedence.

TODO: we might have to make this configurable _per binding_.

Note: 'search' mode still uses mostly hardcoded shortcuts that still
have this problem (i.e. ctrl+g doesn't work with a russian layout).
2020-03-18 14:29:34 +01:00
Daniel Eklöf
fb5ab022de
input: key-binding: log error when we fail to translate to XKB symbol 2020-03-18 10:48:42 +01:00
Daniel Eklöf
ff3d4f89e9
doc: foot.5: spawn-terminal: mention OSC 7 2020-03-17 21:53:26 +01:00
Daniel Eklöf
11b8b7242e
doc: foot.1: document ctrl+shift+n 2020-03-17 21:52:44 +01:00
Daniel Eklöf
cbbfd8796e
README: document ctrl+shift+n 2020-03-17 21:52:26 +01:00
Daniel Eklöf
ba4a328e42
changelog: mention change of default key binding for spaw-terminal 2020-03-17 21:12:37 +01:00
Daniel Eklöf
87d641695a
conf: change default key binding for spawn-terminal to ctrl+shift+n 2020-03-17 19:51:25 +01:00
Daniel Eklöf
6e63fdb053
conf: make delayed rendering timeouts configurable
This adds an undocumented 'tweak' section to footrc, with two new
options:

* delayed-render-lower
* delayed-render-upper

Both takes an integer value, representing the lower/upper timeout
values (in nano seconds) for delayed rendering.
2020-03-17 16:46:54 +01:00
Daniel Eklöf
29c781b832
term: ptmx: don't set 'pending' flag when app sync updates are in use 2020-03-17 16:32:57 +01:00
Daniel Eklöf
a2774878ef
render: don't try to resize if we're shutting down
This fixes an issue where we sometimes (depends on compositor?) tried
to signal a TIOCSWINSZ and failed. This caused us to log a misleading
error message.
2020-03-17 13:27:26 +01:00
Daniel Eklöf
7eba345acf
doc: foot.1: mention default value for '--log-colorize' 2020-03-17 12:54:33 +01:00
Daniel Eklöf
681201dda1
doc: foot.1: fix typo - this isn't yambar 2020-03-17 12:52:00 +01:00
Daniel Eklöf
7f9b7772f2
doc: foot.5: mention default value for 'pad' 2020-03-17 12:48:54 +01:00
Daniel Eklöf
8c9490e56c
doc: foot.5: mention default value for 'geometry' 2020-03-17 12:48:05 +01:00
Daniel Eklöf
93207bc482
render: render non-block cursors after rendering the glyph + decorations
This fixes an issue where an 'underline' cursor wasn't visible on
underlined text - the cursor was rendered first, and then shadowed by
the text underline.
2020-03-17 11:47:47 +01:00
Daniel Eklöf
233a909160
term: ptmx: don't enqueue extra frame render when app sync updates have been changed
Track whether app-sync updates were enabled or disabled while handling
the current chunk of PTMX data.

This fixes and issue where we called render_refresh() unnecessarily
under (at least) the following conditions:

* Application sent "BSU <data> ESU" in the *same* chunk. In this case
  we never saw that app sync was enabled and triggered delayed
  rendering as usual.

* Application sent ESU. While we had noticed app sync updates being
  enabled in earlier PTMX reads, when it was disabled *in the current*
  PTMX read, we treated it as if it had not been enabled at all.

  This caused us to trigger delayed rendering.

  Now we call render_refresh() directly from ESU, and detect the "flip
  off" case in PTMX read and avoid triggering a delayed rendering.

The end result of all this is that each key press (for e.g. scrolling
in a pager application) went from two frames being rendered, to a
single frame.
2020-03-16 17:47:27 +01:00
Daniel Eklöf
1006608093
alt-screen: use a custom 'saved' cursor when switching to alt screen
This fixes an issue where we failed to restore the cursor correctly
when exiting from the alternate screen, if the client had sent escapes
to save the cursor position while inside the alternate screen.

This was because we used the *same* storage for saving the cursor
position through escapes, as for saving it when entering the alternate
screen.

Fix by using a custom variable dedicated to normal <--> alt screen
switching.
2020-03-16 12:00:25 +01:00
Daniel Eklöf
6eeea06cc0
wayland: add FDs to FDM as soon as the FDs are ready 2020-03-15 13:37:56 +01:00
Daniel Eklöf
71fde3bfac
wayland: store display FD in wayland struct
This way we:

* Don't have to call wl_display_get_fd() all the time
* No longer call fdm_del_no_close() even though the FD hasn't been
  added to the FDM.
2020-03-15 13:36:35 +01:00
Daniel Eklöf
4860c3eb37
completions: zsh: don't strip spaces from font name completions 2020-03-15 12:31:42 +01:00
Daniel Eklöf
ef5bacc618
main: log version at startup 2020-03-15 11:41:24 +01:00
Daniel Eklöf
065de3484c
changelog: add index 2020-03-15 11:39:11 +01:00
Daniel Eklöf
73aee27e47
Merge branch 'releases/1.2' 2020-03-15 11:36:25 +01:00
Daniel Eklöf
cc9337721b
meson/PKGBUILD: bump version to 1.2.3 2020-03-15 11:28:01 +01:00
Daniel Eklöf
db60e2cfb2
changelog: spaces 2020-03-14 23:28:21 +01:00
Daniel Eklöf
656a7690f9
Merge branch 'releases/1.2' 2020-03-14 23:21:56 +01:00
Daniel Eklöf
c28c0c3db4
changelog: mention fix for #5 2020-03-14 22:34:08 +01:00
Daniel Eklöf
36ef0463b7
term: use logical DPI+scale factor when scaling fonts
This fixes an issue where the fonts were rendered too small when the
output had fractional scaling.

For integral scaling, using the logical (scaled) DPI multiplied with
the scaling factor results in the same final DPI value as if we had
used the physical DPI.

But for fractional scaling, this works around the fact that the
compositor downscales the surface after we've rendered it.

Closes #5
2020-03-14 22:34:03 +01:00
Daniel Eklöf
be0d620669
quirks: weston_csd_{on,off}: don't do anything in fullscreen mode 2020-03-14 22:32:40 +01:00
Daniel Eklöf
af2e33b78e
changelog: updated to mention fix for #3
I really need to learn to update the changelog **with** the fix...
2020-03-14 22:32:24 +01:00
Daniel Eklöf
c8ea1d137e
terminal: appky scale factor when force-resizing on font reload
If we don't, we'll end up e.g. increasing the window size when moving
the window between outputs with different scaling.

Closes #3
2020-03-14 22:32:01 +01:00
Daniel Eklöf
3bee031867
client: log path we actually tried to connect to (and failed) 2020-03-14 22:31:55 +01:00
Daniel Eklöf
fdb684eceb
client: update --server-socket usage to mention XDG_SESSION_ID 2020-03-14 22:31:51 +01:00
Daniel Eklöf
35de429592
changelog: update 2020-03-14 22:31:42 +01:00
Daniel Eklöf
8ab402b252
server/client: add XDG_SESSION_ID to the default socket path
This allows multiple foot servers to run in multiple sessions.
2020-03-14 22:30:22 +01:00
Daniel Eklöf
9e3a68d6e7
.desktop: 'terminal' is not a common icon name
Not all icon themes have a 'terminal' icon. 'utilities-terminal' on
the other hand is a standardized icon name.
2020-03-14 22:30:06 +01:00
Daniel Eklöf
d28494c01d
changelog: remove 'unreleased' section 2020-03-14 22:28:16 +01:00
Daniel Eklöf
ce68041ed6
changelog: upper case initial letter 2020-03-14 12:03:45 +01:00