Commit graph

170 commits

Author SHA1 Message Date
Daniel Eklöf
b2ca984ccb
main: round strikeout and underline position fallback handling 2019-09-21 00:47:17 +02:00
Daniel Eklöf
a1cd3769a3
main: round strikeout position, and ceil strikeout thickness
This fixes an issue where sometimes the strikeout thickness where
truncated to 0 (e.g. Cascadia Code).

Note that we already do this for the underline calculations.
2019-09-21 00:46:15 +02:00
Daniel Eklöf
4d558d8bed
main: names for poll FD indices 2019-09-20 22:27:27 +02:00
Daniel Eklöf
b3a419f427
main: better names of timers for delayed rendering timeouts 2019-09-20 22:21:06 +02:00
Daniel Eklöf
1a9ec997b3
main: track output refresh rate 2019-09-20 22:15:18 +02:00
Daniel Eklöf
652ff5da92
main: improve delayed rendering
We now use two timers for delayed rendering; one _lower_ limit timeout
that is reset each time we receive input from the slave. We never
render *before* this timeout. Since it's reset, this means rendering
may be pushed further into the future.

To prevent this from happening indefinitely, the second timer defines
the _upper_ limit. This timer is only reset after rendering.

Thus, slave input may now increase the rendering delay, but only up to
a certain limit.

The lower limit is as before, 1ms. The upper limit is set to 16ms (the
time between frame updates on a 60HZ output).
2019-09-20 18:12:58 +02:00
Daniel Eklöf
9f7ea6292e
main: use a timer FD to delay render refresh after client data
This ensures we never wait *longer* than 1ms (previously, we could end
up doing multiple polls, each with a timeout value of 1ms - thereby
potentially delaying the refresh indefinitely).
2019-08-30 17:57:46 +02:00
Daniel Eklöf
fb018eb64e
main: render_resize() scales the width and height
Thus, when we call render_resize() with *old* with/height values, we
must scale them back to their original values.

This fixes an issue where, for example, moving a window between
outputs with different scales caused the window to keep growing.
2019-08-30 17:56:23 +02:00
Daniel Eklöf
47da5b4086
main: request server-side decorations 2019-08-30 17:55:45 +02:00
Daniel Eklöf
1e4b11b0fa
search: don't destroy/recreate search (sub)surface
Create the sub-surface once, at startup. Then, instead of destroying
it when committing/cancelling a search, unmap it (by attaching a NULL
buffer to it).
2019-08-29 20:22:07 +02:00
Daniel Eklöf
af8682210e
main: destroy sub-compositor at exit 2019-08-29 20:17:53 +02:00
Daniel Eklöf
44a353a7f7
search: move wayland surface variables into the term struct 2019-08-29 20:15:33 +02:00
Daniel Eklöf
66912cbfb5
search: use a sub-surface to render the search buffer 2019-08-29 19:34:41 +02:00
Daniel Eklöf
c2b4f4daa6
main: log cell width/height at info level, not debug
This complements the INFO logs from the renderer when the terminal is
resized.
2019-08-28 21:01:36 +02:00
Daniel Eklöf
43fc297fbd
main: free search buffer 2019-08-27 19:43:50 +02:00
Daniel Eklöf
7026f60717
add config + command line option for setting initial window width/height 2019-08-23 17:26:41 +02:00
Daniel Eklöf
4e2067446a
main: use slave's exit value as our exit value 2019-08-23 17:23:47 +02:00
Daniel Eklöf
d8fb80ea32
term: rename colors256 -> table 2019-08-21 18:50:24 +02:00
Daniel Eklöf
631e0c0870
term: use colors256 array for *all* colors
That is, remove the 'regular' and 'bright' color arrays. This is
possible since the 256-color array is defined such that the first 16
colors map to the regular and bright colors.
2019-08-21 18:47:48 +02:00
Daniel Eklöf
d7aaeaedee
csi: move 256-color table into the terminal struct 2019-08-21 17:56:21 +02:00
Daniel Eklöf
3efc30c6a1
main: fix debug logs 2019-08-21 17:55:40 +02:00
Daniel Eklöf
842d114cdb
main: don't set scale before we know what it actually should be 2019-08-21 17:55:11 +02:00
Daniel Eklöf
0a80269be7
main: we *do* track outputs 2019-08-21 17:54:58 +02:00
Daniel Eklöf
d5bc46f333
render: reload cursor theme when scale (may) have changed 2019-08-21 17:53:52 +02:00
Daniel Eklöf
f45e5c6aef
Remove all references to cairo; we now use pixman only 2019-08-16 22:11:22 +02:00
Daniel Eklöf
81107753bf
render: replace all usage of cairo with pixman 2019-08-16 22:06:06 +02:00
Daniel Eklöf
9fe6e8cc48
Add background alpha support 2019-08-15 18:15:43 +02:00
Daniel Eklöf
c2451e2a80
output: track output we're mapped on, and use maximum scale
Our surface may be on multiple outputs at the same time. In this case,
we use the largest scale factor, and let the compositor down scale on
the "other" output(s).
2019-08-12 21:49:17 +02:00
Daniel Eklöf
05e91fa9df
output: resize on scale changes 2019-08-12 21:33:24 +02:00
Daniel Eklöf
74f723e0cf
output: initial support for output scaling
* Not updated run-time; only scale at start up used
* Multiple monitors (outputs) not supported, as we can't track which
  output we're on (yet).
2019-08-12 21:33:24 +02:00
Daniel Eklöf
1060c8e892
main: add -h,--help and -v,--version command line options 2019-08-11 16:03:29 +02:00
Daniel Eklöf
ae84f0ee00
main: make all polled FDs non-blocking
And handle read() returning EAGAIN.

This fixes an issue with the keyboard repeat timer, which sometimes
would return EAGAIN.

Most likely because POLLIN was set on it, but then before we get to
handle it, the timer was canceled (by a key up event).
2019-08-05 20:30:06 +02:00
Daniel Eklöf
a82f12dd2b
input: use a timer fd to handle keyboard key repeat
Instead of running a repeater thread that writes the key to repeat
over a pipe, use a simple timer fd.

No more locking or condition signalling. No need to track
start/stop/exist states.

We simply set up the initial timeout value to be the 'delay', and the
interval to be the repeat 'rate'.
2019-08-05 19:33:01 +02:00
Daniel Eklöf
bd734d5bed
threads: set thread titles 2019-08-01 20:09:16 +02:00
Daniel Eklöf
4801e39eae
conf: make number of scrollback lines configurable 2019-08-01 20:08:39 +02:00
Daniel Eklöf
858a0d9906
font: initial support for double-width *and* color emoji glyphs
Fonts are now loaded with FT_LOAD_COLOR and we recognize and support
the FT_PIXEL_MODE_BGRA pixel mode.

This is mapped to a CAIRO_FORMAT_ARGB32 surface, that is blitted
as-is (instead of used as a mask like we do for gray and mono glyphs).

Furthermore, since many emojis are double-width, we add initial
support for double-width glyphs.

These are assumed to always be utf8. When PRINT:ing an utf8 character,
we check its width, and add empty "spacer" cells after the cell with
the multi-column glyph.

When rendering, we render the columns in each row backwards. This
ensures the spacer cells get cleared *before* we render the glyph (so
that we don't end up erasing part of the glyph).

Finally, emoji fonts are usually bitmap fonts with *large*
glyphs. These aren't automatically scaled down. I.e. even if we
request a glyph of 13 pixels, we might end up getting a 100px glyph.

To handle this, fontconfig must be configured to scale bitmap
fonts. When it is, we can look at the 'scalable' and 'pixelsizefixup'
properties, and use these to scale the rendered glyph.
2019-07-31 18:03:35 +02:00
Daniel Eklöf
caaf84dfd3
main: don't shadow final return value inside poll loop 2019-07-30 22:01:16 +02:00
Daniel Eklöf
6c2fe303c1
main: font metrics should be debug logged 2019-07-30 21:47:59 +02:00
Daniel Eklöf
7d702756ad
main: pty buffers appear to be ~20KB on modern linux kernels 2019-07-30 18:07:44 +02:00
Daniel Eklöf
73b4d5d05a
font: add support for fallback fonts
A top-level font now has a list of fallback fonts. When a glyph cannot
be found, we try each fallback font in turn, until we either find one
that has the glyph, or until we've exhausted the list.

To make this actually work in practise (read: to make performance
acceptable), the cache is re-worked and is now populated on demand.

It also supports non-ASCII characters, by using the 4-byte unicode
character as index instead.

Since having an array that can be indexed by a 4-byte value isn't
really viable, we now have a simple hash table instead of an array.
2019-07-30 18:04:28 +02:00
Daniel Eklöf
85ef9df586
render: add a 'clean' bit to each cell; only render cells that aren't clean
This patch takes a bit from the foreground color value in a
cell (todo: split up foreground/background into bitfields with a
separate field for 'foreground/background' has been set), and only
re-renders cells that aren't marked as clean.

Note: we use a 'clean' bit rather than a 'dirty' bit to make it easy
to erase cells - we can (keep doing) do that by simply memsetting a
cell range to 0.
2019-07-30 18:03:03 +02:00
Daniel Eklöf
c531795b83
wip: initial multithreaded renderer 2019-07-29 20:13:26 +02:00
Daniel Eklöf
fe882bddba
font: populate glyph cache (ASCII characters only) when instantiating font 2019-07-28 21:03:38 +02:00
Daniel Eklöf
175dc9cf94
cairo-ft: remove all usages of cairo-ft 2019-07-28 12:45:01 +02:00
Daniel Eklöf
c399c329b6
main: calculate *all* font metrics from the FreeType face 2019-07-28 12:39:56 +02:00
Daniel Eklöf
cb02c9cf41
font: load FreeType face, and set it's pixel sizes 2019-07-28 12:09:22 +02:00
Daniel Eklöf
e88cf4c8c8
mouse: use discrete axis event if available
This improves the scroll experience with certain devices
2019-07-26 18:48:59 +02:00
Daniel Eklöf
4838763d18
render: move frame_callback to term.render 2019-07-24 20:11:49 +02:00
Daniel Eklöf
ebf0a11fa0
render: add render_refresh() 2019-07-24 20:11:41 +02:00
Daniel Eklöf
bf4847d3e0
conf: allow the user to configure a fixed cursor color
The default is to reverse the foreground/background colors in the cell
with the cursor.

But, if the user configures a specific set of cursor colors, those
will always be used, regardless of other cell attributes (dim, reverse
etc).

The cursor color is specified as two color values, 'text' and
'cursor'.

The block cursor uses the 'cursor' color as background, and the 'text'
color for the glyph.

All other cursor styles uses the 'cursor' color for the cursor, but
uses the cell's foreground color for the glyph (meaning,
dim/reverse/etc applies).
2019-07-23 18:54:58 +02:00