Commit graph

3995 commits

Author SHA1 Message Date
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
Daniel Eklöf
26dc92b492
Merge branch 'per-seat-ime-state'
Closes #411
Closes #324
2021-03-25 09:36:38 +01:00
Daniel Eklöf
ebb92a4db6
ime: set ‘have_warned = true’ to avoid warning over and over again 2021-03-25 09:36:28 +01:00
Daniel Eklöf
6ae8ed7e6b
changelog: don’t crash upon receiving text-input::enter without keyboard focus 2021-03-25 09:36:27 +01:00
Daniel Eklöf
adb5a344fe
ime: log warning on text-input::done() received without keyboard focus 2021-03-25 09:36:07 +01:00
Daniel Eklöf
ed3e70a9c7
ime: don’t enable IME if we don’t have keyboard focus
Closes #411
2021-03-25 09:36:07 +01:00
Daniel Eklöf
13b45db13e
ime: don’t pass ‘term’ to ime_update_cursor_rect()
In all instances where we call ime_update_cursor_rect(), the ‘term’
argument is the same as seat->kbd_focus.

So, let ime_update_cursor_rect() use that directly instead.

Also make ime_send_cursor_rect() static (i.e. local to ime.c).
2021-03-25 09:36:07 +01:00
Daniel Eklöf
1c355f7b7f
ime: codespell: actaually -> actually 2021-03-25 09:36:07 +01:00
Daniel Eklöf
e8ffb05bc7
ime: move preedit state from terminal struct to the seat struct
This ensures different seat’s don’t step on each others IME pre-edit
state.

It also removes most dependencies on having a valid term pointer for
many IME operations.

We’re still not all the way, since we support disabling IME with a
private mode, which is per terminal, not seat.

Thus, we still require the seat to have keyboard focus on one of our
windows.

Closes #324. But note that *rendering* of multiple seat’s IME pre-edit
strings is still broken.
2021-03-25 09:36:07 +01:00
Daniel Eklöf
eb3f9f14b0
Merge branch 'clear-linebreak-flag-when-printing'
Closes #410
2021-03-25 09:35:21 +01:00
Daniel Eklöf
c5d57d23ea
changelog: newlines incorrectly inserted into copied text 2021-03-23 14:18:04 +01:00
Daniel Eklöf
ee75e10e71
term: term_print(): clear line break flag
The line break flag is used by the text reflow and text
extraction (i.e. copy-paste) logic, to determine whether or not to
insert a newline between two lines.

There’s some amount of heuristics involved in this. For example, the
client application could emit a newline, move the cursor back up, and
print text. What does that mean for us?

Foot’s behavior up until now has been this:

The line break flag is set on the row, when the application emits an
explicit linefeed. The flag is cleared when the line is erased. But
otherwise not.

This meant that emitting a linefeed and then moving the cursor back up
and printing text, did not clear the line break flag. This in turn
meant that text copied always had newlines inserted, even though that
was not the client applications intention.

By clearing the line break flag whenever _anything_ is printed to a
row, the new behavior is, in practice, that the line break flag is
only set on a row if a linefeed was that *last* thing printed to that
row.

Closes #410
2021-03-23 11:02:51 +01:00
Daniel Eklöf
deaf17e01d
Merge branch 'zoom-line-height' 2021-03-21 16:29:51 +01:00
Daniel Eklöf
7609fbba47
term: increase/decrease custom line-height with font size changes
When the user has set a custom line-height, we now adjust it when
increasing/decreasing (“zooming”) the font size at run-time.

Previously, the line-height was fixed at the size specified in
foot.ini.
2021-03-21 16:29:35 +01:00
Daniel Eklöf
57a663a0c7
Merge branch 'match-all-required-modifiers-before-unshifting-symbol'
Closes #407
2021-03-21 16:22:44 +01:00
Daniel Eklöf
0c85905972
input: must have all required modifiers to un-shift a symbol
When detecting, and repairing, “broken” key bindings (where the key
binding itself explicitly lists a modifier that is consumed by the
final symbol - e.g “Shift+W”), don’t just look for an intersection
between the set of modifiers needed to produce the final symbol, and
the modifiers listed in the key combo. Instead, check if the key combo
has *all* the required modifiers.

Example: Shift+AltGr+w produces Page_Down. I.e. Page_Down is the
_shifted_ symbol, ‘w’ is the un-shifted symbol, and Shift+AltGr are
the modifiers required to shift ‘w’ to Page_Down.

If we have the key combo Shift+Page_Down, foot would, correctly,
determine that Page_Down is a shifted symbol. It would find the
Shift+AltGr modifier set, and since the intersection of “Shift+AltGr”
and “Shift” (from our key combo) is non-empty, foot
would (incorrectly) determine that we can, and should, replace
Page_Down with its un-shifted symbol ‘w’.

This is completely wrong, since Shift+w does _not_ produce Page_Down.

Closes #407
2021-03-21 16:22:08 +01:00
Daniel Eklöf
eccf2b674e
doc: benchmark: update "workstation" benchmarks with 1.7.0 results 2021-03-21 00:01:17 +01:00
Daniel Eklöf
5f1d56bccc
doc: benchmark: updated “laptop” benchmark with 1.7.0 results 2021-03-20 23:58:22 +01:00
Daniel Eklöf
3fbbf5f81f
changelog: add new ‘unreleased’ section 2021-03-20 14:14:58 +01:00
Daniel Eklöf
d104bc01b0
Merge branch 'releases/1.7' 2021-03-20 14:13:41 +01:00
Daniel Eklöf
be6f7ff934
changelog: 1.7.0 2021-03-20 14:02:12 +01:00
Daniel Eklöf
c1a64bfb14
meson/pkgbuild: bump version to 1.7.0 2021-03-20 14:01:29 +01:00
Daniel Eklöf
207d9045ca
Merge branch 'add-bash-completions'
Closes #10
2021-03-17 19:45:11 +01:00
Simon Schricker
b169623b64
Add: Bash completion for foot and footclient
* use toe for terminfo, thanks Craig.
* adds optional dependency on bash-completion for positional arguments

Co-authored-by: Craig Barnes <craigbarnes@protonmail.com>
2021-03-17 13:10:28 +01:00
Daniel Eklöf
749ae49c48
Merge branch 'optimized-print-function' 2021-03-16 21:59:06 +01:00
Daniel Eklöf
d271119032
csi: update ASCII printer function pointer when switching to/from alt screen
This is necessary since switching screen may change how many sixels we
have in the scrollback.
2021-03-16 13:07:09 +01:00
Daniel Eklöf
b601307fae
term: update_ascii_printer(): log when we (actually) switch printer 2021-03-16 12:57:25 +01:00
Daniel Eklöf
11f2c85acf
config: open_config(): remove unused argument ‘conf’ 2021-03-16 09:54:32 +01:00
Daniel Eklöf
60b3ccc641
term: runtime switch between a ‘fast’ and a ‘generic’ ASCII print function
term_print() is called whenever the client application “prints”
something to the grid. It is called for both ASCII and UTF-8
characters, and needs to handle sixels, insert mode and ASCII
vs. graphical charsets.

Since it’s on the hot path, this becomes unnecessarily slow.

This patch adds a “fast” version of term_print(), tailored for the
common case: ASCII characters in non-insert mode, without any sixels
and non-graphical charsets.

A new function, term_update_ascii_printer(), has been added, and must
be called whenever:

* The currently selected charset *index* changes
* The currently selected charset changes (from ASCII to graphical, or
  vice verse)
* Sixels are added to the grid
* Sixels are removed from the grid
* Insert mode is enabled/disabled
2021-03-16 08:45:18 +01:00
Daniel Eklöf
d8f0e701b5
Merge branch 'term-print-assume-col-can-be-incremented' 2021-03-16 08:44:25 +01:00
Daniel Eklöf
2451699c35
term: term_print(): assume we’re *not* at the right margin
That is, assume we can, and should, increment the cursor column.

This changes the emitted assembly from:

   518fb:       8b 8b f8 05 00 00       mov    0x5f8(%rbx),%ecx
   51901:       ff c9                   dec    %ecx
   51903:       39 d1                   cmp    %edx,%ecx
   51905:       7e 11                   jle    51918 <term_print.constprop.0+0x78>
   51907:       ff c2                   inc    %edx
   51909:       89 50 10                mov    %edx,0x10(%rax)
   5190c:       5b                      pop    %rbx
   5190d:       5d                      pop    %rbp
   5190e:       41 5c                   pop    %r12
   51910:       c3                      ret
   51911:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
   51918:       c6 40 18 01             movb   $0x1,0x18(%rax)
   5191c:       5b                      pop    %rbx
   5191d:       5d                      pop    %rbp
   5191e:       41 5c                   pop    %r12
   51920:       c3                      ret

To:

   5191c:       41 8d 50 01             lea    0x1(%r8),%edx
   51920:       89 50 10                mov    %edx,0x10(%rax)
   51923:       3b 93 f8 05 00 00       cmp    0x5f8(%rbx),%edx
   51929:       0f 8d 21 01 00 00       jge    51a50 <term_print.constprop.0+0x190>
   5192f:       5b                      pop    %rbx
   51930:       5d                      pop    %rbp
   51931:       41 5c                   pop    %r12
   51933:       c3                      ret
   ...
   51a50:       c6 40 18 01             movb   $0x1,0x18(%rax)
   51a54:       44 89 40 10             mov    %r8d,0x10(%rax)
   51a58:       5b                      pop    %rbx
   51a59:       5d                      pop    %rbp
   51a5a:       41 5c                   pop    %r12
   51a5c:       c3                      ret

I.e. it cuts the normal path from 10 instructions down to 8. It
increases the "bad" path with one extra instruction.
2021-03-14 20:47:44 +01:00
Daniel Eklöf
c5c3447ca8
sixel: sixel_overwrite_at_cursor(): early exit when the image list is empty
This avoids a call to sixel_overwrite_by_row() (where we also exit
early if the image list is empty).

This saves a couple of instructions to set up the arguments for
sixel_overwrite_by_row().
2021-03-14 14:19:12 +01:00
Daniel Eklöf
2a723e1c4c
Merge branch 'sixel-fix-max-geometry' 2021-03-14 13:07:13 +01:00
Daniel Eklöf
e7a4378f18
Merge branch 'option-no-wait'
Closes #395
2021-03-14 13:05:41 +01:00
Daniel Eklöf
6eb68ffbd9
sixel: max geometry should be max geometry, not current window size
“current geometry” will report whatever value is the smallest; the max
geometry or the current window size.

But “max geometry” always returns the configured max geometry.

This aligns foot’s behavior with XTerm.
2021-03-14 10:58:13 +01:00
Daniel Eklöf
29709c6966
scripts: generate-alt-random: reduce number of emitted sixels
After emitting multiple color bands for each sixel row, the increased
amount of sixel data shifted the balance in the profiling data,
causing a performance regression in regular ASCII handling.
2021-03-14 10:40:29 +01:00
Daniel Eklöf
4fca142f71
Merge branch 'drain-pty-when-client-terminates' 2021-03-13 21:36:30 +01:00
Felipe Trzaskowski
452830bd08 add changelog entry, completions and man entry for -N, --no-wait 2021-03-13 08:07:08 -03:00
Felipe Trzaskowski
2dc13cc13b fix code style issues and memory leak 2021-03-13 08:01:38 -03:00
Felipe Trzaskowski
3ed9314266 add option to detach the client process from the terminal instance 2021-03-13 05:48:55 -03:00
Daniel Eklöf
329f2a488c
term: don’t close PTY when client application dies
Closing it as soon as we detect that the client has died, means we may
not have drained it completely.

The PTY is either closed _by_ the client application, or by us when we
shutdown the terminal. Thus, leaving it open (until we call
term_shutdown()) is fine.
2021-03-12 22:06:50 +01:00
Daniel Eklöf
464851fac1
client: repair usage output 2021-03-12 21:53:11 +01:00
Daniel Eklöf
84f840a197
client: remove excess ‘-’ from ‘--log-level’ in usage 2021-03-12 21:51:07 +01:00
Daniel Eklöf
ebc57d1a80
changelog: sixel decoding performance improvements 2021-03-12 21:43:35 +01:00
Daniel Eklöf
f19e1e4c36
Merge branch 'sixel-background-and-transparency'
Closes #391
2021-03-12 21:42:17 +01:00
Daniel Eklöf
5a9ae07167
changelog: implemented DCS parameter P2 2021-03-11 17:37:56 +01:00