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.
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
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).
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').
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".
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.