Commit graph

442 commits

Author SHA1 Message Date
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
b82dc02505
selection: add a couple of word-breaking characters
When "auto-selecting" a word, we used to only break on space
characters. Now we break on a number of other characters as
well.
2019-07-30 21:57:48 +02:00
Daniel Eklöf
c03aeb1b4f
log: syslog: tag unused function arguments as unused 2019-07-30 21:50:08 +02:00
Daniel Eklöf
c9138c6d7d
log: log to syslog too 2019-07-30 21:48:14 +02:00
Daniel Eklöf
6c2fe303c1
main: font metrics should be debug logged 2019-07-30 21:47:59 +02:00
Daniel Eklöf
8acc3b891d
vt: remove almost all abort() calls
Replace with generic error log messages that simply says the
ESC/CSI/OSC sequence is unhandled. This can mean either invalid or
unimplemented, depending on the context.
2019-07-30 21:42:46 +02:00
Daniel Eklöf
84f868f88d
render: don't pass a struct buffer when all we need is a cairo_t 2019-07-30 20:43:37 +02:00
Daniel Eklöf
d8ab96b8d9
render: don't call wl_surface_set_buffer_scale()
Since we don't support scaling, don't call
wl_surface_set_buffer_scale(). This way, at least will get auto-scaled
by the compositor.
2019-07-30 20:33:17 +02:00
Daniel Eklöf
2c3f2269fc
render: remove #if 0 code 2019-07-30 20:31:59 +02:00
Daniel Eklöf
51c1fc344a
vt: remove duplicate initialization warnings (clang) 2019-07-30 20:30:05 +02:00
Daniel Eklöf
f630633a81
render: fix 'suggest braces around initialization...' warning (clang) 2019-07-30 20:28:21 +02:00
Daniel Eklöf
263d3bb2ba
input: fix 'comparison ... is always true' warning (clang) 2019-07-30 20:27:19 +02:00
Daniel Eklöf
20af289759
render: only explicitly re-render old cursor cell if it isn't dirty
If it is dirty, it will be rendered in the normal rendering
process.
2019-07-30 20:18:58 +02:00
Daniel Eklöf
3b36fb9d74
render: last_cursor.cell must not be const 2019-07-30 20:18:20 +02:00
Daniel Eklöf
efdb69f2d8
render: remove all traces of glyph-sequence
This was used to optimize the call(s) to cairo_show_glyphs(), which we
aren't using anymore.
2019-07-30 19:33:56 +02:00
Daniel Eklöf
f5e9b7b048
input: use keyboard enter serial only for selection serial 2019-07-30 19:29:04 +02:00
Daniel Eklöf
f39d848368
Merge branch 'multithreaded-renderer' 2019-07-30 18:08:27 +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
d1b88f67e4
Merge branch 'use-freetype-to-render-glyphs' 2019-07-29 20:12:33 +02:00
Daniel Eklöf
4302d3eb68
font: set FT load and render flags from FontConfig properties 2019-07-29 20:10:55 +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
9e57ba2108
font: add font_glyph_for_utf8()
This function fills in a struct glyph with glyph bitmap data for the
provided utf-8 character (essentially a FT_Bitmap wrapped in a cairo
surface).
2019-07-28 20:37:59 +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
27dca15caf
render: use FreeType face from font, instead of from cairo's scaled font 2019-07-28 12:11:44 +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
90d357befb
render: poc: use freetype to render glyphs
Initial POC that uses freetype to render the glyphs. The bitmap
produced by freetype contains the alpha value.

We use this bitmap in a mask surface and then draw the final glyph
with cairo by applying the source rgb using the OVER operator and the
freetype generated alpha mask as surface mask.

Note that we only support grayscale antialiasing (and no
antialiasing).

We are probably not setting the antialias options correctly either.
2019-07-26 18:54:14 +02:00
Daniel Eklöf
709c29c7c4
render: reset "last cursor" when resizing
The cell pointer is likely invalid since we realloc the
grids. Besides. we're redrawing the entire window anyway.
2019-07-26 18:51:47 +02:00
Daniel Eklöf
269e04fa1b
render: flush glyph sequence after erase previous cursor
If not, we may have scrolled when we later flush the glyph sequence,
causing the glyph to be rendered in wrong location.
2019-07-26 18:50:41 +02:00
Daniel Eklöf
3e06dca12d
input: generate escape sequences for "other" keys
This corresponds to xterm's modifyOtherKeys option, though the code
needs more testing and cleanup.
2019-07-26 18:49:09 +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
bb3e33948f
render: add render_row() 2019-07-24 20:31:21 +02:00
Daniel Eklöf
a712ca40e1
render: minor 2019-07-24 20:26:32 +02:00
Daniel Eklöf
d7dd14ea6a
footrc: add cursor color 2019-07-24 20:23:26 +02:00
Daniel Eklöf
f93384b9c9
render: move local static variables into the terminal struct 2019-07-24 20:21:41 +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
10a7b94804
render: bug: previous cursor wasn't always redrawn correctly
The main problem is knowing:

* The correct *cell* (to be able to render the *content* when erasing
  the old cursor)
* Whether the cursor has moved (to determine whether to stop the
  rendering loop or not)
* Where on the *screen* the cursor is/was (since the terminal may be
  partly scrolled back)

This patch stores three static variables:

* last_cursor is used to compare against current cursor to see if the
  cursor has moved or not
* last_cursor_on_screen is the actual screen coordinates the cursor
  was rendered at (typically the same as last_cursor, but may be
  offset by the view)
* last_cursor_cell is a pointer to the cell to render
2019-07-24 18:15:24 +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
Daniel Eklöf
a397c64efe
csi: ignore CSI ?1036h/l (metaSendsEscape) 2019-07-23 17:57:41 +02:00
Daniel Eklöf
f5a6304850
term: make sure to update 'current row' when restoring saved cursor 2019-07-23 17:57:07 +02:00
Daniel Eklöf
f7519b5725
grid: swap rows doesn't mark rows as dirty 2019-07-23 17:56:07 +02:00
Daniel Eklöf
812178673e
osc: ignore OSC 30 (konsole's "set tab title") 2019-07-23 17:55:25 +02:00
Daniel Eklöf
ba322c4eff
csi: implement \E[Z - back tab 2019-07-22 20:33:50 +02:00
Daniel Eklöf
751ac55f64
csi: *sigh* looks like e.g. neovim doesn't respect Se
I.e. it issues a \E[2 q regardless of what we've configured the
terminfo Se entry to.

So, make \E[2 q mean "the user configured cursor style" (which
defaults to 'block').
2019-07-22 20:23:29 +02:00
Daniel Eklöf
49034bb759
csi: let CSI 0 q mean "switch to user configured cursor style"
According to the specs, \E[0 q means a blinking block cursor. However,
since it also states that \E[1 q *also* is a blinking block cursor,
and that it is the default, *and* given that fact that parameter-less
CSIs typically means "reset", let's make it mean "reset to the user
configured cursor style".
2019-07-22 20:19:27 +02:00
Daniel Eklöf
3ccdef3498
conf: make cursor's default style configurable 2019-07-22 20:15:14 +02:00