If we have an error during early input device initialization we
can blow assertion because we may try to cleave it from the event
loop it is not yet attached to.
This commit fixes that.
There's currently an out of bounds write when copying dmesg to to
the boot buffer.
This is because there's a newline and a terminating NUL and only
one of the two was being accounted for.
This commit fixes the problem by dropping strcat/strcpy and using
printf style functions instead.
Spotted by Ilya K.
The heuristic to check whether or not we're inside of a git checkout
or a tarball isn't working properly.
This commit changes it to use git rev-parse --is-inside-git-dir which
is pretty specifically designed for this use case.
Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/232
It seems like there's a memory leak with the keymap icon text if
there isn't a hit.
This commit fixes that, and renames some of the variables to make
it a little clearer what's going on
commit 42d07913a0 made the pango plugin
NULL safe but the same problem exists in the freetype plugin.
This commit makes things NULL safe a layer higher.
Recent changes to the freetype plugin made it quite buggy. There
was an infinite loop bug, and also a failure in metrics handling.
There's also a number of outstanding issues:
1. Kerning is not properly applied
2. hidpi displays don't render correctly
Rather than try to tackle all of these problems in a peicemeal way,
this commit substantially reworks the code.
It introduces a ply_freetype_unit_t type for more clearly managing
the fixed point math freetype requires. This type relies on less
than well defined compiler behavior, however, so it may cause issues
down the road.
It consolidates measuring and drawing code to one function, since in
both cases, the same computation needs to happen, and they had
slightly divergent implementations before.
It consolidates font loading code, so we don't end up with two
different font face loading routines, with different dpi values.
It also changes the names of some variables to be clearer in my
mind (like changing the loaded glyph to the name "glyph" instead
of the name "slot")
The splash plugins currently call
ply_console_viewer_print (... NULL);
if no prompt message is specified... This leads to crash.
Rather than fixing all the splash plugins, this commit just makes
a NULL format be a noop.
At the moment the splash plugins have a lot of leeway when
updates can go to the screen. They can pause and unpause
updates by themselves, and draw at any point.
This rope has a little too much slack, it's actually kind
of complicated for the splash plugins to manage drawing
when they have more than one moving part.
For instance, a spinner animation may be drawing autonomously
from the splash plugin itself. To avoid flicker, everything
needs to be synchronized.
This commit adds that synchronization a layer higher than
the plugins themselves, in ply-boot-splash. It accumulates
drawing updates continuously without doing any drawing, until
a given deadline, then flushes the updates out all at once.
This reverts commit 815d3c72e2.
This idea of pausing and unpausing updates at a given framerate is good,
but doing it at the ply-pixel-display level causes a proble with
monitor hotplug.
ply_buffer_borrow_bytes is a new macro to make it possible to
temporarily alter the allocation of the underlying bytes of
a `ply_buffer_t` outside of `ply_buffer_t` specific methods.
This macro works by forcing the caller to use a scope block
to clearly delineate where the allocation modification is
occurring. This macro was inspired by the python `with` feature.
Unfortunately, the macro leaves the bytes initialized outside
the scope block, so there is some temptation to continue messing
with the allocation when it's not allowed.
This commit improves the macro to address that problem by nullifying
the passed in variables at the conclusion of the borrowing scope
block.
This commit introduces a state machine to better handle when part
of a UTF-8 character comes in immediately, and the rest of it
comes in later.
It also tries to better handle cases where control characters
are interleaved in the middle of UTF-8 characters.
ply_utf8_character_get_size currently has this odd argument at
the end that is often just set to PLY_UTF8_MAX_CHARACTER_SIZE
and also the function returns magic values for cases where it
can't figure out the size because the byte isn't a leading
byte or is otherwise not valid UTF-8.
That means that API has a nuance to it that makes the code hard
to follow at a light read.
This commit attempts to improve the situation by dropping the
extra argument, and adds a way to get the type separate from the
size for clarity.
At the same time, this commit updates all the callers to use the
new API. There are two cases where the callers are trying to
remove the last character from a UTF-8 string, so this commit
adds a new function to consolidate that logic as well.
This commit adds a few functions for getting at and
using the size, bytes, and capacity of a buffer.
This will make it easier to modify utf8 string on the side and
and update the buffer size afterward.
At the moment if a program calls `plymouth hide-splash`
plymouth keeps the terminal in raw mode. That is wrong,
because programs call `plymouth hide-splash` specifically
so they can use the terminal.
This commit makes plymouth restore the terminal to cooked
mode so it's ready for the next program.
At the moment injecting data into a console viewer involves calling
ply_console_viewer_parse_lines.
This name isn't optimal, since the data getting injected might not
be a full line at all.
This commit renames it to ply_console_viewer_write, and also adds
a ply_console_viewer_print that adds a printf like function for
convenience.
Some commands really do need to know how wide the terminal is to operate correctly. Without
it long lines don't wrap right and other badness can happen.
This commit addresses the problem by changing the terminal to take both a `number_of_rows`
and `number_of_columns` argument at construct time instead of just a `maximum_line_count`.
In order to properly implement that change, this commit also adds new api to `ply_rich_text_t`
to specify which parts of a run of rich text is read-only and which parts of the run can be
modified.
Changes in this commit were made with assistance from Ray Strode