Commit graph

326 commits

Author SHA1 Message Date
Daniel Eklöf
6f2cffd8c0
vt: never call term_print() with a width <= 0 2020-07-16 08:04:12 +02:00
Max Hollmann
54e2b0b005 limit font size to non-negative values 2020-07-15 09:53:13 +02:00
Daniel Eklöf
2fa2c9fad4
term: print: don't pad with spacers if auto-margin is disabled 2020-07-15 08:04:51 +02:00
Daniel Eklöf
f962fb236e
term: copy current VT attributes to multi-column spacer cells
And refactor: break out spacer-writing code to a function, since we do
exactly the same thing in two places.
2020-07-14 20:24:52 +02:00
Daniel Eklöf
6d7aba3ea0
term: print: linewrap + insert *before* inserting SPACERS
Otherwise we end up overwriting the character in the last column
2020-07-14 17:03:20 +02:00
Daniel Eklöf
df2927e088
term: print: write special value CELL_MULT_COL_SPACER to extra cells
When printing a multi-column character, write CELL_MULT_COL_SPACER
instead of '0' to both padding cells (when character doesn't fit at
the end of the line), and to the cells following the actual character.
2020-07-14 16:49:11 +02:00
Daniel Eklöf
4cf7195695
selection: recognize empty padding cells in a forced linewrap
When printing a multi-column character at the end of the line, and it
doesn't fit, we currently insert a forced line-wrap. This means the
last character(s) on the previous line will be empty, followed by a
multi-column character in the first cell on the next line.

Without special code to handle this, the selection text extraction
code will insert a hard newline, since this is normally the correct
thing to do.

Add a TODO, to consider writing a special place holder value to these
padding cells.
2020-07-14 13:17:50 +02:00
Daniel Eklöf
7480c1c06b
term: remove assert, as we're already checking for this in the loop condition 2020-07-14 12:07:12 +02:00
Daniel Eklöf
b035469a7f
term: print: manually increment cursor column
We know we're within bounds, and thus we don't need the extra overhead
of term_cursor_right().
2020-07-14 12:05:24 +02:00
Daniel Eklöf
98ebb99be3
term: line-wrap: need to update grid->cur_row when we did *not* scroll 2020-07-14 12:01:00 +02:00
Daniel Eklöf
6ea9d1246f
term: print: also require width > 1 when checking if we need to force-wrap or not
While this might seem like it would slow down things, it should in
fact help the compiler optimize: the "normal" code path, that prints
regular ASCII characters, always call term_print() with width == 1.
2020-07-14 11:26:14 +02:00
Daniel Eklöf
b8c7dfba5c
term: line-wrap: manually set cursor row+col
line-wrap is in the hot path, and term_cursor_down/left adds
additional checks that we don't need.
2020-07-14 11:25:06 +02:00
Daniel Eklöf
9dc1d18241
term: print: force line-wrap if a multi-column character does not fit on current line 2020-07-14 10:58:57 +02:00
Daniel Eklöf
6faa9955ba
term: print: manually increment cursor column for multi-column chars
There's nothing wrong with using term_cursor_right(), but it is
unnecessary since we already check for the end-of-line.
2020-07-14 10:51:22 +02:00
Daniel Eklöf
ca7ec13f3b
term: insert: move assert() after checking whether insert mode is enabled or not 2020-07-14 10:50:38 +02:00
Daniel Eklöf
01c3a2635d
term: linefeed: explicitly clear LCF
LF should always clear LCF. Previously, it was done implicitly in
term_cursor_down(). I.e it was cleared as long as the cursor wasn't at
the bottom of the scrolling region
2020-07-14 10:49:44 +02:00
Daniel Eklöf
bbce760ab0
term: line-wrap: use term_cursor_{down,left} 2020-07-14 10:08:57 +02:00
Daniel Eklöf
b9719673a1
term: rename term_formfeed() -> term_carriage_return() 2020-07-14 09:29:10 +02:00
Daniel Eklöf
3958d84069
term: set_fonts: describe why we force resize 2020-07-13 15:01:09 +02:00
Daniel Eklöf
09bdf20aa0
render: keep lock while pushing dirty rows to worker queue
Instead of locking the queue for each dirty row we append, and
signaling a condition variable, just keep the lock while going through
the visible rows.

Release the lock once done.

Since we take the lock *before* posting the 'start' semaphore, all
workers will be waiting for the lock to be released.

Then, one at a time they'll get the lock and pick a row to
render. The queue will never get empty - when all rows have been
rendered, each worker will pick a 'frame done' "job" from the queue,
and break the rendering loop.
2020-07-13 13:27:23 +02:00
Daniel Eklöf
ab875c824a
term: update cursor on kbd focus changes, not visual focus changes 2020-07-11 11:14:32 +02:00
Daniel Eklöf
7d8974f930
term: remove term_has_kbd_focus(), use term->kbd_focus instead 2020-07-11 09:06:20 +02:00
Daniel Eklöf
8c72e9434e
term: cache kbd-focused state, just like we cache visual focus state
There's one difference however, when we receive a kbd unfocus call,
*all* seats must have us unfocused before we actually change the
state.
2020-07-11 09:04:46 +02:00
Daniel Eklöf
4e48d550ef
multi-seat: improve handling of multiple (mouse) pointers
* xcursor always set for all pointers
* xcursor sometimes not updated when it should be
* mouse grabbed state wasn't per seat, but global (i.e. "does at least
  one seat enable mouse grabbing")
* selection enabled state wasn't per seat
2020-07-09 09:52:11 +02:00
Daniel Eklöf
6bbd4a5110
focus in/out: terminal checks whether it is a state change or not 2020-07-09 09:16:54 +02:00
Daniel Eklöf
fc9fde88c3
input: only call term_kbd_focus_{in,out}() on actual state change
That is, only call term_kbd_focus_in() if we're the *first* seat
focusing that terminal, and only call term_kbd_focus_out() if we're
the *last* seat that focused it.
2020-07-09 08:46:25 +02:00
Daniel Eklöf
58415428cf
multi-seat: re-enable mouse button+motion reporting support 2020-07-08 18:16:43 +02:00
Daniel Eklöf
be2490022d
multi-seat: enable xcursor theme support again 2020-07-08 18:08:39 +02:00
Daniel Eklöf
c470825067
wip: multi-seat support
Compiles and runs, but mouse, clipboard and other things have been
disabled.
2020-07-08 16:45:26 +02:00
Daniel Eklöf
69e4213e4a
term: don't use deprecated fcft_size_adjust()
When resizing the font on-the-fly, we now do a complete
font-reload (this is basically what fcft_size_adjust() did anyway).

To get the correct size, we maintain the current size ourselves.

We get the initial size from the user-provided font pattern, by
converting the string to an FcPattern, and using FcPatternGet() to
retrieve both the FC_SIZE and FC_PIXEL_SIZE attributes. These
attributes are then removed from the pattern, and the pattern is
converted back to a string.

The terminal struct maintains a copy of the font sizes. These are
initially set to the sizes from the config.

When the user resizes the font, the terminal-local sizes are
adjusted. To ensure the primary and user-configured fallback fonts are
resizes equally much, convert any pixel sizes to point sizes at this
point.

When the font size is reset, we reload the font sizes from the
config (thus once again returning actual pixel-sizes, if that's what
the user has configured).
2020-07-07 10:44:55 +02:00
Daniel Eklöf
a259eda535
config: add 'blink' option to cursor section in footrc
This option controls whether the default cursor should blink or
not. The default is to *not* blink.
2020-06-30 17:45:34 +02:00
Daniel Eklöf
fad5838dba
Merge branch 'master' into sixel-performance 2020-06-29 22:03:26 +02:00
Daniel Eklöf
62be729c45
scroll: destroy scrolled out sixels before scroll is applied
The logic that breaks out of sixel loops does not work for rows that
has already wrapped around.

Thus, we need to destroy sixels that are about to be scrolled
out *before* we actually scroll.

Since this is the *only* time we destroy sixels (instead of
overwriting it), rename the sixel functions. And, since they now do a
very specific thing, they can be greatly simplified (and thus faster).
2020-06-29 22:01:02 +02:00
Daniel Eklöf
8f5e6e85e0
sixel: destroy all sixels when font size is decreased
If changing the font size causes the cell size to decrease, either
horizontally or vertically (or both), then delete all sixels since the
grid space they allocated no longer is enough to hold the images.
2020-06-29 21:53:29 +02:00
Daniel Eklöf
2ea32398c3
term: use 'left_ptr' instead of 'hand2' as cursor when client is mouse grabbing 2020-06-29 21:51:53 +02:00
Daniel Eklöf
4006fc86e4
sixel: overwrite: pass 'width' to sixel_overwrite_at_cursor()
This is necessary to handle multi-column characters correctly.
2020-06-28 11:01:19 +02:00
Daniel Eklöf
186a07c364
sixel: split -> overwrite 2020-06-27 15:29:47 +02:00
Daniel Eklöf
ae727e372a
term: erasing characters now splits sixels instead of deleting them 2020-06-27 15:22:31 +02:00
Daniel Eklöf
0953ffd2d3
sixel: delete/split: early(ier) exit when there aren't in sixel images
Avoid unnecessary wrap checks if the sixel image list is empty.
2020-06-27 14:43:29 +02:00
Daniel Eklöf
bc82d4ee28
sixel: wip: split up image being overwritten, rather than erasing it
Instead of completely erasing a sixel image when it is being
"overwritten" (text is printed somewhere within the image, or another
sixel image is emitted within the first image), split it up into up to
four pieces: 'above', 'below', 'to-the-left' and 'to-the-right'.

This is currently very un-optimized, but seems to produce correct
results.
2020-06-23 21:07:12 +02:00
Daniel Eklöf
bae11000cc
term: reset: set title to the user configured title, not "foot" 2020-06-22 14:33:16 +02:00
Daniel Eklöf
e466063020
term: ptmx: don't abort on EAGAIN when trying to read from ptxm 2020-06-19 11:33:03 +02:00
Daniel Eklöf
cc5dedc259
sixel: do not reset palette after each image
A client can re-use the palette between images. Resetting the palette
breaks this.

Now we initialize the palette on demand, and resets it when the
palette size is changed (by the client).
2020-06-10 18:38:46 +02:00
Daniel Eklöf
9df7e8fa07
term: print_insert: early return 2020-06-09 17:31:28 +02:00
Daniel Eklöf
29630ac92e
term: set an initial TIOCSWINSZ right after opening the pty
Since foot is pretty aggressive about spawning the client early, it
was possible for a fast client to read a 0x0 terminal size. Not all
clients coped well.

Closes #20.
2020-06-02 19:59:28 +02:00
Daniel Eklöf
789617d5ad
term: don't double fork new terminal windows
Instead, register their PIDs with the new reaper module and let it
handle them.
2020-05-21 20:17:29 +02:00
Daniel Eklöf
08588cd0fc
selection: handle viewport wrap around correctly
When the viewport wraps around, the selection points may be
"incorrect".
2020-05-19 18:49:42 +02:00
Daniel Eklöf
550667a9ea
term: scrolling: calling function must clamp scroll amount 2020-05-19 18:47:38 +02:00
Daniel Eklöf
33346ba02d
term: erase_cell_range: set row->dirty before calling memset() 2020-05-17 16:29:09 +02:00
Daniel Eklöf
52e6a751b3
term: scrolling: mark selection top if-statement as 'unlikely' 2020-05-17 15:48:58 +02:00