Commit graph

663 commits

Author SHA1 Message Date
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
nerdopolis
ce869227f2 two-step: Support a ScaleBackgroundWallpaper to scale the background instead of tiling it 2023-11-21 22:20:12 -05:00
Hans de Goede
01702de71a drm: Guess device-scale when using simpledrm
When displaying on a simpledrm kms device the physical dimensions
of the screen are unknown. Use the heuristics from ply_get_device_scale ()
to guess the device scale to avoid rendering things too small
on 4K screens.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-08-30 17:27:20 +02:00
Hans de Goede
f5eb3e57c2 drm: Add check if the driver used is simpledrm
Add a check to see if the driver used is simpledrm,
this is a preparation patch for adding support to set
device_scale based on heuristics when using simpledrm.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-08-30 17:27:20 +02:00
Hans de Goede
37b6cb958a drm: Initialize rotation local variable
Initialize rotation local variable to fix the following
false positive compiler warning:

src/plugins/renderers/drm/plugin.c: In function ‘get_primary_plane_rotation’:
src/plugins/renderers/drm/plugin.c:485:31: warning: ‘rotation’ may be used uninitialized [-Wmaybe-uninitialized]
  485 |                 *rotation_ret = rotation;
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~
src/plugins/renderers/drm/plugin.c:419:18: note: ‘rotation’ was declared here
  419 |         uint64_t rotation;
      |                  ^~~~~~~~

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-08-30 17:27:20 +02:00
Hans de Goede
22e25caaba two-step: Fix spelling of "different"
Fix "differtent" type, replacing it with "different".

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-08-16 22:06:18 +00:00
Hans de Goede
e83abc08e4 drm: Use first output for panel info if there is no builtin display
The two-step renderer uses ply_renderer_get_panel_properties() to get
the device-scale used for the builtin panel, assuming this is most likely
light-up by the firmware on boot and that this is thus also displaying
the bgrt boot splash shown by the firmware at boot.

It needs to know the device-scale for this output so that if hi-dpi
(device-scale=2) rendering is used on the output it can also set
device-scale=2 on the ply_pixel_buffer() used for the bgrt background
so that the pixel-buffer code knows the splash is pre-scaled and
doesn't double it in size making it twice as big as original.

ATM this doubling in size of the splash is exactly what happens
when using a desktop with a hidpi monitor because the drm plugin
does not provide any "panel" properties in this case.

To avoid this fall-back to using the properties of the first
enumerated (connected) output for get_panel_properties().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-08-16 22:06:18 +00:00
nerdopolis
2bca0f5d0a label-freetype: Fix Uncrustify 2023-06-16 23:18:07 -04:00
Tomás Pinho
3e6d59cbd9 script: adds a new native GetCapslockState function to lib-plymouth
Allows Plymouth Script-based themes to query the Capslock state
directly to act on it by showing an icon or message.
Takes in Ray's suggestions and base the implemention around the keyboard
type instead, delegating to the renderer/terminal renderer types instead.
2023-06-05 18:21:10 +01:00
Timo Teräs
261f305b50 x11: periodically handle gtk events
GTK main loop needs to be called periodically to handle
any idle and timer based events which do not trigger via fd.

fixes #190
2023-05-01 17:02:29 +00:00
Timo Teräs
1896ea7439 script: handle display hotplug
- Fix script plugin to handle monitor hotplug events

- Expose Plymouth.SetDisplayHotplugFunction to set script callback
  after display hotplug

fixes #186
2023-03-22 13:16:22 +00:00
Timo Teräs
167507880d script: fix deletion of sprites after full refresh
The node pointer is reused in the if (data->full_refresh) block
causing the following sprite list walking to fail. Fix this by
moving the sprite list first node getting next to the while loop
where it belongs.
2023-03-22 13:50:03 +02:00
Timo Teräs
51ee78ae1d script: fix script_lib_sprite_draw_area() if sprite_list is empty
The Sprite list may be empty under various conditions, cope with
this.
2023-03-22 13:49:41 +02:00
Timo Teräs
e0799eb77b script: fix reference leak in script_evaluate_set()
script_obj_hash_add_element() takes a new reference, so release
the reference returned by script_evaluate().
2023-03-22 13:49:33 +02:00
Ray Strode
b6c8bf3be7 input-device: Only allow one renderer to consume input at a time
Right now if there are two graphics cards, there ends up with two
renderers active at the same time. Both process keyboard inputs
and both end up sending those events to plymouthd, resulting in
duplicate input.

This commit changes the input handlers so the first one wins, and
the rest don't get input.

Closes https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/197
2022-11-29 13:34:05 -05:00