Commit graph

2227 commits

Author SHA1 Message Date
Daniel Eklöf
7d134e6b1c
changelog: 'not' -> 'now' 2020-07-14 12:48:16 +02:00
Daniel Eklöf
3fd61fa120
grid: reflow: always emit *all* cells of a multi-column character 2020-07-14 12:15:25 +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
466466c19e
grid: reflow: use width=1 for invalid characters 2020-07-14 12:03:10 +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
635698722e
changelog: prefix all C0 names with 'C0::' 2020-07-14 11:33:30 +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
803c87bb65
grid: reflow: force line-wrap if a multi-column character does not fit on current line 2020-07-14 11:03:33 +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
bc2fc778ae
csi: DECAWM: clear LCF 2020-07-14 10:54:53 +02:00
Daniel Eklöf
7fce1720d6
csi: IND+RI now clears LCF 2020-07-14 10:52:46 +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
cabcc615c1
vt: change HT (horizontal tab) to *not* clear LCF
According to the specification, HT **should** clear LCF. However,
nearly all emulators do not. In particular, XTerm doesn't. So we
follow suite.
2020-07-14 10:47:17 +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
7f7ab00e11
vt: implement C0::FF - processed in the same way as C0::LF 2020-07-14 09:18:52 +02:00
Daniel Eklöf
4849a16f37
vt: process C0::VT the same way we process C0::LF
Previously, C0::VT was implemented as a simple 'cursor down'. I.e. it
would behave as LF **until** it reached the bottom of the screen,
where instead of scrolling, it became a no-op.

See https://vt100.net/docs/vt102-ug/chapter5.html
2020-07-14 09:15:15 +02:00
Daniel Eklöf
7357bb54eb
vt: sort C0's in the switch statement, and use escaped character possible 2020-07-14 09:11:17 +02:00
Daniel Eklöf
21674ab382
input: keyboard: keymap: close(fd) on early-return when failing to mmap 2020-07-14 08:55:20 +02:00
Daniel Eklöf
0ed02e9676
input: keyboard: keymap: use xkb_keymap_new_from_buffer() 2020-07-14 08:52:42 +02:00
Daniel Eklöf
307eead987
input: keyboard: detect failure to mmap keymap 2020-07-14 08:52:11 +02:00
Daniel Eklöf
fa75e1646a
Merge branch 'merge-wl-surface-damage'
Closes #35
2020-07-14 08:35:47 +02:00
Daniel Eklöf
18827ebe0b
changelog: mention fix for 'too many wl_surface_damage_buffer()' calls 2020-07-13 15:10:03 +02:00
Daniel Eklöf
d169e96346
wayland: configure: do a regular resize instead of a force resize
The commit log says that was needed to get tiling in GNOME
working. However, I don't know *which* extension that was.

Force resizing in a configure event means we'll trash a perfectly
valid buffer on e.g. 'activated' state changes.

So, let's revert this for now, and if this breaks GNOME, let's try to
find another solution. If worse comes to worse, we can detect if we're
running under GNOME and do a force-resize then, but not on sane
compositors.
2020-07-13 15:01:27 +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
3f55cf3d14
render: render_margin: don't damage margins when rendering scroll damage
When applying scroll damage, we may have to re-render the
margins.

This is because when we SHM-scroll, we actually move the entire
surface, and thus we end up overwriting the top margin area with old
window content, and scroll in uninitialized memory in the bottom
margin.

But, we don't have to tell the compositor about this - the last frame
always contains correct margins; i.e. there's no change between the
last frame and current frame being rendered.

TODO: we _could_ micro-optimize and only damage the margins after a
surface resize. We do it slightly more often now, when dealing with
state changes in screen flash or scrollback searching. But I don't
think it's worth the effort.
2020-07-13 14:19:07 +02:00
Daniel Eklöf
96f480b14d
render: doh! flush the last surface damage *outside* of the rendering loop 2020-07-13 14:18:43 +02:00
Daniel Eklöf
74c3b4be1a
main: free 'cwd' at exit
This fixes an issue where e.g. failing to initialize the Wayland
backend would leave cwd un-free:d
2020-07-13 14:17:55 +02:00
Daniel Eklöf
ed620f1854
render: render_margin: add 'damage_{top,bottom,left,right}' arguments 2020-07-13 14:06:02 +02:00
Daniel Eklöf
0336f47f05
render: render_margin(): remove top/bottom arguments
All calls to render_margin() set top=true and bottom=true anyway.
2020-07-13 14:03:58 +02:00
Daniel Eklöf
9f21799cb2
render: merge wl surface damage for consecutive dirty rows 2020-07-13 13:44:52 +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
669d36afa8
Merge branch 'renderer-dont-special-case-cursor-cell' 2020-07-13 13:22:09 +02:00
Daniel Eklöf
58f0bf5ff3
doc: foot.5: 'runtime' -> 'at runtime' 2020-07-12 20:23:54 +02:00
Daniel Eklöf
fe6c228b13
render: don't render cursor when it has been explicitly hidden 2020-07-12 13:08:19 +02:00
Daniel Eklöf
2bdd0a7c80
render: remove most of the special handling of cursor rendering
Previously, we had to explicitly render the old cursor cell *before*
applying scrolling damage.

We then rendered all the dirty rows, *without* rendering the cursor -
even if the cursor cell was among the dirty rows.

Finally, when everything else was done, we explicitly rendered the
cursor cell.

This meant a lot of code, and unnecessary render_cell() calls, along
with unnecessary wl_surface_damage_buffer() calls.

This was a necessary in the early design of foot, but not anymore.

We can simply mark both the old cursor cell, and the current one, as
dirty and let the normal rendering framework render it. All we need to
do is pass the cursor column to render_row(), so that it can pass
has_cursor=true in the appropriate call to render_cell(). We pass -1
here for all rows, except the cursor's row, where we pass the actual
cursor column.

With this, there's no need to calculate whether the cursor is visible
or not; just mark it's cell as dirty, and if that row is visible, the
normal rendering will take care of it.

This also simplifies the state needed to be saved between two frames;
we only need a row pointer, and the cursor column index.

Part of https://codeberg.org/dnkl/foot/issues/35
2020-07-12 12:56:10 +02:00
Daniel Eklöf
0bdbf45418
changelog: hollow cursor is now based on keyboard focus, not visual focus 2020-07-11 18:43:50 +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
b5776487ab
input: include seat name in debug log output 2020-07-11 11:13:45 +02:00
Daniel Eklöf
12a1688ce3
render: use kbd-focus instead of visual focus for hollow block cursor
When determining whether we should render a hollow block cursor,
i.e. to signal that we're unfocused, base the decision on the
terminals current keyboard focus, not visual focus.
2020-07-11 09:06:36 +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
ed0cb06b48
Merge branch 'multi-seat'
Closes #32
2020-07-11 08:30:47 +02:00
Daniel Eklöf
1c13061f35
wayland: destroy cursor theme when removing pointer capability 2020-07-10 19:32:48 +02:00
Daniel Eklöf
5677df629e
wayland: seat: instantiate pointer surface in capabilities event
This way we only instantiate the surface for seats that actually have
a pointer.
2020-07-10 19:24:33 +02:00
Daniel Eklöf
bf62519d83
wayland: read XCURSOR_{THEME,SIZE} in reload_xcursor theme 2020-07-10 12:06:55 +02:00