Commit graph

2209 commits

Author SHA1 Message Date
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
Daniel Eklöf
71584aed38
seat: use separate 'enter' serials for keyboard and mouse 2020-07-09 11:20: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
699cbaf380
readme: add multi-seat support to the feature list 2020-07-09 09:18:18 +02:00
Daniel Eklöf
3397e735a5
changelog: add multi-seat support 2020-07-09 09:17:42 +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
a6da07b3dd
wayland: globals: destroy: seat: use keyboard/pointer listener interfaces 2020-07-09 08:52:39 +02:00
Daniel Eklöf
b6342bb36d
wayland: globals: destroy: handle seats being destroyed 2020-07-09 08:47:56 +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
98f3ccfe79
wayland: log: be clear that these are the XCRUSOR_* environment variables 2020-07-08 20:04:02 +02:00
Daniel Eklöf
d377221e24
xcursor: trigger theme reload in pointer-enter event
Previously, we triggered a theme reload on output changes. This is
completely wrong. We may get a new output with a scale different from
the output the pointer is actually on.

Now, we store the current scale along with the theme. We then trigger
a call to reload the xcursor theme *every* time the pointer enters a
surface. When it does, we use the current scale factor of the terminal
that owns that surface.

If the terminal covers multiple outputs, with different scale factors,
we'll use the largest scale factor. This may not be 100% correct. But
to fix that, we'd need to track which regions of a surface are mapped
on which outputs. Too complicated I say.
2020-07-08 19:52:17 +02:00
Daniel Eklöf
5539af2597
wayland: seat: log keyboard/pointer capability 2020-07-08 19:30:34 +02:00
Daniel Eklöf
11373a6561
multi-seat: re-enable OSC 52 support 2020-07-08 19:28:08 +02:00
Daniel Eklöf
4c7d29f7eb
multi-seat: re-enable selection support (excluding OSC 52) 2020-07-08 18:41:09 +02:00
Daniel Eklöf
04e566492c
multi-seat: re-enable scrollback search support 2020-07-08 18:20:34 +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
bd0a003a4c
meson/PKGBUILD: bump fcft requirement to 2.2.0 2020-07-07 11:57:07 +02:00