Commit graph

2792 commits

Author SHA1 Message Date
Ray Strode
a045f01568 ply-label: Make NULL safe
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.
2023-12-22 08:29:13 -05:00
Ray Strode
bfaf591c03 Merge branch 'revamp-freetype-plugin' into 'main'
label-freetype: Revamp to work better

See merge request plymouth/plymouth!264
2023-12-19 19:32:45 +00:00
Ray Strode
fc986f0c1c label-freetype: Revamp to work better
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")
2023-12-19 14:21:25 -05:00
Ray Strode
606f8c232b ply-console-viewer: Don't crash if passed a NULL format
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.
2023-12-18 13:57:10 -05:00
Ray Strode
d7c2e3a4ac Merge branch 'synchronize-display-updates' into 'main'
ply-boot-splash: Flush display updates at fixed framerate

See merge request plymouth/plymouth!263
2023-12-17 15:05:23 +00:00
Ray Strode
5e33469e87 ply-boot-splash: Flush display updates at fixed framerate
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.
2023-12-17 07:57:47 -05:00
Ray Strode
cdc81fd4f7 Revert "ply-pixel-display: Pause the display and unpause it at a framerate"
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.
2023-12-17 07:57:02 -05:00
n3rdopolis
e8251d4f03 Merge branch 'fixconsoleviewerrefresh' into 'main'
splash plugins: Better handling the redraw of the console viewer when visible,...

See merge request plymouth/plymouth!257
2023-12-16 13:27:24 +00:00
nerdopolis
7f7c15fc26 splash plugins: Better handling the redraw of the console viewer when visible, and the splash state changes 2023-12-16 13:25:01 +00:00
nerdopolis
815d3c72e2 ply-pixel-display: Pause the display and unpause it at a framerate 2023-12-16 13:25:01 +00:00
nerdopolis
0083c97ffa ply-entry: Don't crash hiding an entry that is already hidden 2023-12-16 13:25:01 +00:00
nerdopolis
5f7b364d07 ply-console-viewer: introduce ply_console_viewer_clear_line () 2023-12-16 13:25:01 +00:00
nerdopolis
df86c73414 ply-console-viewer: Reorder the labels.
When there is less than 1 screenful of lines, the first line now appears at the top, more similar to a terminal emulator
2023-12-16 13:25:01 +00:00
nerdopolis
d0738917dd ply-terminal-emulator: Don't reject empty lines 2023-12-16 13:25:01 +00:00
Ray Strode
f5e0b9e06c Merge branch 'nullify-borrowed-bytes' into 'main'
ply-buffer: Nullify bytes outside scope block

See merge request plymouth/plymouth!262
2023-12-11 15:45:51 +00:00
Ray Strode
90a9174a81 ply-buffer: Nullify bytes outside scope block
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.
2023-12-11 10:42:46 -05:00
Ray Strode
3cff63128c Merge branch 'resilientunicode' into 'main'
ply-terminal-emulator: Handle incomplete Unicode characters with more resiliency

See merge request plymouth/plymouth!261
2023-12-11 03:14:31 +00:00
nerdopolis
27fd8d115c ply-terminal-emulator: Handle incomplete UTF-8 characters better
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.
2023-12-10 22:13:58 -05:00
nerdopolis
a354385ce8 ply-terminal-emulator: Rename PLY_TERMINAL_SPACES_PER_TAB to PLY_TERMINAL_EMULATOR_SPACES_PER_TAB 2023-12-10 22:13:58 -05:00
nerdopolis
1e5e49fa14 ply-rich-text: Remove now unneeded definiton 2023-12-10 22:13:58 -05:00
Ray Strode
9969852ad9 utils: Rework UTF-8 handling
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.
2023-12-10 22:13:58 -05:00
Ray Strode
944f2210cd ply-buffer: Make ply_buffer_clear fast if called multiple times in a row
ply_buffer_clear memsets over the entire allocation every time it is
run.

This commit makes it only clear the used part of the allocation.
2023-12-10 22:13:58 -05:00
Ray Strode
804a78860a buffer: Add APIs for editing bytes in buffer
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.
2023-12-10 22:13:58 -05:00
n3rdopolis
73093a8411 Merge branch 'fixvtleds' into 'main'
Set the VT keyboard state with KDSKBMODE so that the VT console doesn't change the LED state

See merge request plymouth/plymouth!259
2023-12-09 15:33:51 +00:00
nerdopolis
7215ab1269 ply-input-device: Handle the keyboard sequence to change VTs 2023-12-09 10:12:31 -05:00
nerdopolis
6f2c70c9e1 ply-utils: Introduce ply_change_to_vt_with_fd () and ply_change_to_vt () 2023-12-08 22:55:52 -05:00
nerdopolis
6b79792829 When using input devices, set the VT keyboard state with KDSKBMODE so that the VT console doesn't change the LED state 2023-12-08 21:11:18 -05:00
nerdopolis
58cc9f84e4 main: Restore terminal line discipline on hide splash
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.
2023-12-08 17:45:53 +00:00
Ray Strode
9c33ac5e92 Merge branch 'improve-console-viewer-api' into 'main'
ply-console-viewer: Improve API

See merge request plymouth/plymouth!260
2023-12-07 20:07:12 +00:00
Ray Strode
27a612878c ply-console-viewer: Improve API
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.
2023-12-07 14:59:11 -05:00
n3rdopolis
e8f7ab99e3 Merge branch 'terminalwidth' into 'main'
ply-terminal-emulator: Take a maximum_column_count argument that is used in ply_rich_text.

See merge request plymouth/plymouth!256
2023-12-06 22:52:30 +00:00
nerdopolis
5af79f4ee6 ply-utils: rename ply_utf8_string_iterator_init to ply_utf8_string_iterator_initialize 2023-12-06 22:47:44 +00:00
nerdopolis
12435d8b86 ply-rich-text: Rename functions from ending in _init to _initialize 2023-12-06 22:47:44 +00:00
nerdopolis
fc0b133317 ply-terminal-emulator: Fix terminal emulator accuracy issues, don't pad with the active formatting 2023-12-06 22:47:44 +00:00
nerdopolis
149a1ce3e7 ply-terminal-emulator: Require a fixed upfront column count
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
2023-12-06 22:47:44 +00:00
nerdopolis
18c582f0dd ply-terminal-emulator: Don't spam the debug logs with the two most-common commands 2023-12-06 22:47:44 +00:00
nerdopolis
13616729e6 ply-terminal-emulator: cleanup dead code 2023-12-06 22:47:44 +00:00
Ray Strode
a58e582c7c Merge branch 'add-redraw-debug' into 'main'
drm: Add new plymouth.set-mode-on-redraws debug option

See merge request plymouth/plymouth!258
2023-12-05 21:28:00 +00:00
Ray Strode
282f66f675 drm: Add new plymouth.set-mode-on-redraws debug option
This option forces a modeset every frame
2023-12-05 16:27:37 -05:00
Ray Strode
677c69a653 Merge branch 'fixmodifierrepeat' into 'main'
ply-input-device: Handle better when a keyboard sends key-repeat events for held modifier keys

Closes #225

See merge request plymouth/plymouth!255
2023-12-04 23:39:47 +00:00
nerdopolis
4ee7056ff8 ply-input-device: Handle modifiers better
At the moment, holding down the shift key sends
key repeat events that lead to the output not
getting properly shifted.

This commit avoids updating modifier state when
the modifer key is held down.
2023-12-04 18:37:06 -05:00
Ray Strode
6b5bd35a0e Merge branch 'input-device-debug' into 'main'
ply-input-device: Handle SYN events

See merge request plymouth/plymouth!253
2023-12-04 23:11:52 +00:00
Ray Strode
c2decd9fcf ply-input-device: Add new plymouth.debug-input-devices kernel option
Right now we don't have a lot of debugging information when processing
keyboard events.  I mean we don't want passwords to show up in logs
after all.

Still, it would be useful to have a way to turn the valve on to the
firehose.

This commit adds a plymouth.debug-input-devices kernel option.
2023-12-04 23:11:05 +00:00
Ray Strode
2693bf9ec0 ply-input-device: Handle SYN events
If the kernel falls behind a stream of input events, we currently
drop them on the floor.

It seems unlikely that this could ever happen theorhetically since we only
process keyboard events (versus, say, a high frequency stream of pointer
events, or a complex stylus device with inter-related events coming in,
in batches). Nonetheless, there is a report that suggests key events
may be getting dropped.

This commit adds support for handling the backlogged event case, and
hopefully address the bug report.
2023-12-04 23:11:05 +00:00
Ray Strode
ceb5576650 Merge branch 'config-h-fix' into 'main'
Include config.h automatically

See merge request plymouth/plymouth!254
2023-12-04 19:06:19 +00:00
Ray Strode
54fb7e1d56 Include config.h automatically
There are a few files missing #include <config.h>.

That is bad since it means those files don't get debug tracing.

This commit eliminates the pitfall by making sure the file is
included implicitly
2023-12-04 14:04:01 -05:00
Ray Strode
1b43dd504f Merge branch 'make-random-numbers-random' into 'main'
ply-utils: Add function for getting random number

See merge request plymouth/plymouth!251
2023-12-04 13:02:00 +00:00
Ray Strode
c86563b0c0 two-step: Use new ply_get_random_number function 2023-12-04 07:49:31 -05:00
Ray Strode
54b390e35c space-flares: Use new ply_get_random_number function 2023-12-04 07:49:31 -05:00
Ray Strode
75d371edef script: Use new ply_get_random_number function 2023-12-04 07:49:31 -05:00