Commit graph

115 commits

Author SHA1 Message Date
Daniel Eklöf
2d7ca416f0
render: center grid in window
Instead of placing the upper left corner of the grid at 0,0 in the
window, center it.
2019-08-27 15:25:35 +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
d5bc46f333
render: reload cursor theme when scale (may) have changed 2019-08-21 17:53:52 +02:00
Daniel Eklöf
4168f91d40
csi: implement CSI ? 1007 h/l - alternateScroll
When enabled, mouse scrolls in the alternate screen are converted to
up/down key presses.
2019-08-19 21:16:47 +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
9ca01436ee
input: track meta modifier 2019-08-15 19:38:28 +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
481a1cd678
selection/input: triple click selects an entire row 2019-08-06 19:32: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
4d7993b36f
cell: pack more efficiently and store glyph as a wchar
The 'attributes' struct is now 8 bytes and naturally packed (used to
be 9 bytes, artificially packed).

'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes,
artificially packed).

Furthermore, the glyph is stored as a wchar instead of a char*. This
makes it easier (faster) to do glyph lookup when rendering.
2019-08-02 18:19:07 +02:00
Daniel Eklöf
ab92abbd21
term: implement reset 2019-08-01 20:51:11 +02:00
Daniel Eklöf
4801e39eae
conf: make number of scrollback lines configurable 2019-08-01 20:08:39 +02:00
Daniel Eklöf
e3dc184882
term: break out 'flash' to a separate 'term' function 2019-07-30 22:06:02 +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
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
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
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
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
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
f5a6304850
term: make sure to update 'current row' when restoring saved cursor 2019-07-23 17:57:07 +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
Daniel Eklöf
10be7c37ba
csi: prepare for alternative cursor styles 2019-07-22 19:44:21 +02:00
Daniel Eklöf
428b31f071
term: group 'blink' state together in a struct 2019-07-22 19:17:57 +02:00
Daniel Eklöf
196f9d67c2
term: group 'flash' state together in a struct 2019-07-22 19:15:56 +02:00
Daniel Eklöf
e21ab8cf33
blink: implement 'blink' 2019-07-21 20:11:20 +02:00
Daniel Eklöf
0dd8951cb3
flash: implement 'flash'
Use our own escape sequence for the 'flash' terminfo entry.

Implemented by arming a timer FD and setting a boolean that indicates
we're currently "flashing".

The renderer draws a semi-transparent yellowish layer over the entire
window when "flashing" is active.
2019-07-21 19:14:19 +02:00
Daniel Eklöf
2096753b52
dcs: we have no parent terminal to pass through to 2019-07-21 18:22:26 +02:00
Daniel Eklöf
64135ae365
csi: implement CSI 22t and CSI 23t
22;0|1|2t pushes the current window title/icon to the stack, while 23
pops it.

The second parameter, 0|1|2 has the following meaning:

0 - push/pop icon+title
1 - push/pop icon
2 - push/pop title
2019-07-21 17:48:06 +02:00
Daniel Eklöf
97350f6488
term: track current window title in terminal struct 2019-07-21 17:35:53 +02:00
Daniel Eklöf
4109d97263
conf: config now provides the colors (though still only hardcoded colors) 2019-07-21 11:06:28 +02:00
Daniel Eklöf
29d855d7c6
term: prepare for configurable colors; add color variables to terminal 2019-07-21 10:58:09 +02:00
Daniel Eklöf
32f397d9b0
input: store last seen wayland input serial
We need this for clipboard data
2019-07-19 11:11:48 +02:00
Daniel Eklöf
24e9477174
vt: handle up to two private characters 2019-07-19 09:56:59 +02:00
Daniel Eklöf
b953326768
dcs: sort of implement DCS passthrough
We now store the passthrough characters in a buffer, and call
dcs_passthrough() on unhook.

However, dcs_passthrough() doesn't do anything.
2019-07-19 09:55:07 +02:00
Daniel Eklöf
153628a217
osc: allocate data buffer dynamically 2019-07-19 08:59:35 +02:00
Daniel Eklöf
6e55be1557
render: cache generated glyphs for regular ASCII characters
To avoid having to re-generate glyphs, cache the glyphs.

For now, we only cache ASCII characters, as this allows us to lookup
the cache by simply indexing with the character (into a 256-entry
array).
2019-07-18 10:33:58 +02:00