Commit graph

677 commits

Author SHA1 Message Date
nerdopolis
58a25cc403 script: Get the messages from the console and ply-kmsg-reader, and use ply-terminal-emulator and ply-console-viewer to the display messages 2024-03-08 13:23:02 +00:00
n3rdopolis
50aabad06a xkb_state_led_name_is_active does not appear to require devices to have EV_LED
This allows the on-screen caps lock indicator to work on HyperV keyboards, and HyperV has one keyboard
2024-02-01 00:10:47 -05:00
n3rdopolis
709f21e801 renderers: Do not assume all keyboards have LEDs
This is an attempt to fix #245
2024-01-31 08:38:38 -05:00
Ferdinand Bachmann
792fe7474a label-freetype: fix fallback not working when fc-match isn't available
The new font loading functions introduced in
544e62ac41 assume that popen() returns
NULL when fc-match is unavailable or fails. This is incorrect, since
popen() will always start a shell to run the passed command and return a
stream to that shell's stdin and stdout.

This results in an non-null but empty font name being passed to
FT_New_Face(), which fails.

This commit fixes this by also using the fallback font when the font
path read from the popen() stream is empty.

Fixes #239
Fixes regression caused by 544e62ac41
2024-01-16 02:13:40 +01:00
nerdopolis
0c4b27e06f splash plugins: Fix wrong group being used for console viewer settings in space-flares and fade-throbber 2024-01-10 07:20:02 -05:00
nerdopolis
5c10072a97 renderers: Only call ply_terminal_set_unbuffered_input when there is a terminal 2024-01-04 21:42:28 -05:00
Ray Strode
345d28b3cb label-freetype: Force resize calculation when moving control
When moving the label around we need to do a full recalculation
of the metrics, because the position is part of the computation.
2024-01-04 16:07:06 -05:00
Ray Strode
1c2c9e622d label-freetype: Fix rowstride bug with hidpi displays
The freetype plugin correctly doubles the DPI on hidpi displays,
but fails to account for the doubled pixels in display's pixel buffer.

This commit adds a factor of 2 to the size and positioncomputations,
to hopefully fix a row stride and a positioning bug.
2024-01-04 15:28:02 -05:00
Ray Strode
544e62ac41 label-freetype: Rework font loading
There's currently this function, set_font_with_fallback, that
almost always gets called with a NULL first argument in the
initramfs, forcing the _with_fallback part of the function to
run.

It's a little strange to have a function with a chunk of code that
hardly ever runs. Furthermore there's a bug where the error variable
is left uninitialized in this case leading to the freetype plugin
sporadically failing to load the fallback font.

This commit reworks things to drop set_font_with_fallback, and just
call FT_New_Face directly in the caller. Fallbacks are handled
at the point where the font path is determined
(previously called query_fc_match, now called find_default_font_path.
2024-01-03 15:45:01 -05:00
Ray Strode
38e96ef944 label-pango: Try to fix up remove_hexboxes_from_pango_layout
There are a few issues with the remove_hexboxes_from_pango_layout
function, where it's getting offsets wrong and things like that.

This commit changes the approach entirely. Rather than modifying
the text to remove characters without font converage, it just
changes out the glyphs for those characters to be white boxes.
2024-01-03 11:13:31 -05:00
Ray Strode
3d0705f50f renderers: Rework input handling a little
We don't need to flush the terminal input buffer on key events from
the renderers, because the terminal does that itself.

Also, we should disable the terminal input when a /dev/input
device is added instead of relying on it happening the next flush
period.

Finally, we should make sure the terminal gets reenabled on close,
just so we clean up after ourselves.
2023-12-30 09:55:33 -05:00
Ray Strode
69c821494a label-freetype: Initialize line dimensions to 0
Now that we can print the line dimensions, we should
initialize them to zero.
2023-12-29 09:16:59 -05:00
Ray Strode
2fd53a40f2 label: Put dimensions of text in log
This just helps with debugging.
2023-12-28 20:21:20 -05:00
Ray Strode
bacce720ee label-freetype: Measure control even if hidden
Sometimes we want to query the size of hidden labels too, so
it's important we still compute the size, even if hidden.
2023-12-28 19:07:49 +00:00
Ray Strode
97516094e4 label-freetype: Ensure font metrics are up to date when querying dimensions
If code calls ply_label_get_width without ply_label_show or some other
call that forces the dimensions to be computed first, then the returned
width will be wrong.

This commit makes the freetype plugin look more like the pango plugin
where the size will computed on demand when querying the width, if
necessary.
2023-12-28 13:39:19 -05:00
Ray Strode
8cd615f188 label-freetype: Log font loading error
Right now if there's an error loading a font we quietly just
proceed.

This commit adds a debug log message saying what the error is.
2023-12-28 17:31:48 +00:00
Ray Strode
d8fd8e222c label-freetype: Don't bother loading fallback font if it doesn't exist
If the fallback font doesn't exist, we shouldn't even try to load it,
there's no point.

Instead, put a nice error in the log.
2023-12-28 17:31:48 +00:00
Ray Strode
b06435001b label-pango: Pass explicit width when computing height
pango will give a height that's several orders of magnitude too
big sometimes when the width is -1.

This commit checks for -1, explicitly measures the width first, and
remeasures with that width passed in to compute the height.
2023-12-28 11:45:43 -05:00
Ray Strode
1b6c4b8684 label-pango: Fix inverted conditional
Right now we skip sizing the control when force == true because
of an inverted conditional.

This commit fixes that.
2023-12-28 10:53:02 -05:00
Ray Strode
1a3251c43f two-step: Be more tolerant when there's no console viewer
There are still a number of places in the code where a console
viewer is expected, when it's totally possible that there won't
be one.

This commit runs through them, and does a few other style
cleanups on the way.
2023-12-28 09:36:06 -05:00
Ray Strode
0c62d4a0cf space-flares: Be more tolerant when there's no console viewer
There are still a number of places in the code where a console
viewer is expected, when it's totally possible that there won't
be one.

This commit runs through them, and does a few other style
cleanups on the way.
2023-12-28 09:36:06 -05:00
Ray Strode
6359b6715e fade-throbber: Be more tolerant when there's no console viewer
There are still a number of places in the code where a console
viewer is expected, when it's totally possible that there won't
be one.

This commit runs through them, and does a few other style
cleanups on the way.
2023-12-28 09:31:08 -05:00
Ray Strode
0fb9f0c6f1 label-freetype: Fix loading debug message
The freetype plugin was calling printf instead of ply-trace when
a font failed to load. Also, it didnt list the failure reason.

This commit fixes things up a bit.
2023-12-27 19:54:29 +00:00
Ray Strode
b4e01e90c0 label-freetype: Handle font failing to load more gracefully
We currently crash if the font fails to load.

This commit attempts to handle the situation more gracefully.
2023-12-27 19:54:29 +00:00
Ray Strode
7003f17229 fade-throbber,space-flares,two-step: Don't crash if no console viewer
The splash plugins don't create a console viewer if
`plymouth.prefer-fbcon` is on the kernel command line, but expect it
to be not NULL regardless.

This commit corrects that misconception.
2023-12-27 14:50:09 -05: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
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
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
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
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
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
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
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
Ray Strode
0628f3b6e2 fade-throbber: Use new ply_get_random_number function 2023-12-04 05:48:06 -05:00
n3rdopolis
d3d0c9d650 space-flares: Get the messages from the console and ply-kmsg-reader, and use ply-terminal-emulator and ply-console-viewer to the display messages 2023-12-02 18:19:33 -05:00
n3rdopolis
d80237fad5 fade-throbber: Get the messages from the console and ply-kmsg-reader, and use ply-terminal-emulator and ply-console-viewer to the display messages 2023-12-02 18:19:33 -05:00
n3rdopolis
32b2bffd9d two-step: Get the messages from the console and ply-kmsg-reader, and use ply-terminal-emulator and ply-console-viewer to the display messages 2023-12-02 18:19:33 -05:00
Ray Strode
8fd5f9f249 label-freetype: Add basic support for rich text
Now that the ply-label interface supports rich text, we need to
implement it in the plugins.

This commit changes the freetype plugin to process
rich text in a rudimentary way that picks up colors, but not other
style attributes.

Based on initial work from nerdopolis
2023-12-02 18:19:33 -05:00
Ray Strode
e190f3b952 label-freetype: Handle utf-8 characters better
The plugin currently assumes all characters are 7 byte ascii.

This commit just adds a mbrtowc call around the text to
handle UTF-8 text somewhat better.
2023-12-02 18:15:38 -05:00
n3rdopolis
cc5e07c6d0 label-freetype: Support monospaced fonts 2023-12-02 18:14:42 -05:00
nerdopolis
8af62d1284 label-freetype: Allow the label size to be set and calculated even when hidden 2023-12-02 18:14:42 -05:00
nerdopolis
42f6b8513e label-pango: Add support for set_rich_text
Now that the ply-label interface supports rich text, we need to
implement it in the plugins.

This commit implements it for the pango plugin.
2023-12-02 18:14:42 -05:00
nerdopolis
06cd316a34 label-pango: Replace characters not supported by fonts with a replacement character
Using a replacement character prevents hexboxes from appearing, which can mess up alignment of monospace fonts
2023-12-02 18:14:42 -05:00
Ray Strode
42d07913a0 label-pango: Handle NULL text better 2023-11-30 13:44:41 -05:00
Victor Tran
6f9744cb32 Add system-reset splash mode 2023-11-24 20:11:36 +00:00
nerdopolis
fc25cfe93c two-step: Rename ScaleBackgroundWallpaper to ScaleBackgroundImage 2023-11-22 13:59:41 -05:00
nerdopolis
18af314509 two-step: Check for background.png before background-tile.png first, now that the background may not always be tiled 2023-11-22 13:59:36 -05:00