Commit graph

2080 commits

Author SHA1 Message Date
Ray Strode
0f0800b751 wip! label-pango: Parse escape sequences in input
This commit starts to sketch out how color escape sequences could
be turned to actual colors in the label.

It's untested.
2023-06-01 13:25:50 -04:00
Ray Strode
8807817ddf wip! Add ply-terminal-buffer object
We're going to need to do at least basic parsing of terminal text
so we can show the console to the user in color when they hit
escape and VTs are disabled.

This commit adds the start of a class to do this basic parsing.

The way it works is the terminal text is inject into the object
and all escape sequences are filtered out. When a color control
sequence is found, the current color is noted, along with which
characters it applies to. A list of the text spans and their
color attributes is then iteratable using a an api.
2023-06-01 13:25:50 -04:00
n3rdopolis
df538944cb script: Use new interfaces in ply-boot-splash for ply-kmsg-reader, and use ply-kmsg-viewer to display the boot messages 2023-05-31 22:45:11 -04:00
n3rdopolis
99d1e8cce3 space-flares: Use new interfaces in ply-boot-splash for ply-kmsg-reader, and use ply-kmsg-viewer to display the boot messages 2023-05-31 22:45:11 -04:00
n3rdopolis
a57c47de71 fade-throbber: Use new interfaces in ply-boot-splash for ply-kmsg-reader, and use ply-console-viewer to display messages 2023-05-31 22:45:11 -04:00
n3rdopolis
7d3061e145 two-step: Use new interfaces in ply-boot-splash for ply-kmsg-reader, and use ply-console-viewer to display messages 2023-05-31 22:45:11 -04:00
n3rdopolis
8605119899 libply-splash-graphics: Introduce new ply-console-viewer control 2023-05-31 22:45:11 -04:00
n3rdopolis
2df6d4a0f2 ply-label: Add ply_label_set_hex_color () based off of ply_pixel_buffer_fill_with_hex_color for configuration of label text colors 2023-05-31 22:45:11 -04:00
n3rdopolis
a5eb1dad63 main: Use new integrations in ply-boot-splash and start ply-kmsg-reader 2023-05-31 22:45:11 -04:00
nerdopolis
4e1d2b8839 Introduce ply-terminal-emulator to handle parsing lines from /dev/console 2023-05-31 22:45:06 -04:00
nerdopolis
4aeb99a43f ply-list: Introduce ply_list_node_set_data 2023-05-31 19:43:49 -04:00
n3rdopolis
8db13df395 Introduce ply-kmsg-reader to read kernel log messages from /dev/kmsg 2023-05-31 19:43:49 -04:00
n3rdopolis
35819ff63e ply-utils: Add ply_utf8_string_get_substring_range () to split UTF-8 strings at a number character, to a specified range 2023-05-31 19:43:49 -04:00
n3rdopolis
1668590503 label-freetype: Support monospaced fonts 2023-05-31 19:43:49 -04:00
nerdopolis
c038e7ff30 label-freetype: Allow the label size to be set when hidden 2023-05-31 19:43:49 -04:00
nerdopolis
545c7aec29 label-freetype: Fix uncrustify 2023-05-31 19:43:49 -04:00
nerdopolis
676f6c8d07 ply-input-device: Handle the "Enter" key on the numpad correctly. 2023-05-04 08:38:06 -04: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
Balló György
5b266eb2f1 Add new option to set boot log file 2023-04-29 15:36:16 +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
Timo Teräs
bfc91248b4 logger: snprintf needs #include <stdio.h> 2023-03-22 13:49:25 +02:00
n3rdopolis
5ffd55e40b ply-device-manager: Change XKB_* variables from vconsole.conf to match systemd's 2023-01-24 12:53:29 -05:00
n3rdopolis
42d414f9f7 ply-input-device: Ensure that the LED state is updated on the keyboard of which the lock key was pressed on
When a lock modifier is pressed, plymouth goes through some gymnastics
to ensure the LEDs on all attached keyboards are appropriately updated.

Unfortunately, an optimization in the code used to avoid redundant
updates of keyboards that already have the correct state is actually
preventing the initiating keyboard from getting its LEDs turned on.

This is because the initiating keyboard gets its state updated at
key press time before the LED handling code runs, thus making it
seem like that run is redundant.

This commit introduces a new state variable `leds_state_invalid`
on the input device to mark this situation and updates the optimization
check to also check the new variable.

Some contributions by Ray Strode.
2023-01-02 12:20:44 -05:00
Ray Strode
c5a234b5e3 meson: Use export_dynmic: true instead of -rdynamic
It seems like specifying -rdynamic in meson cflags doesn't work
on some systems, but meson has a built in way of doing the same
thing:

export_dynamic: true

This commit switches over to the probably more right way of
achieving a working dlopen(NULL).
2022-12-01 20:14:17 -05:00
Ray Strode
4a53499b95 meson: Build plymouthd with -rdynamic
plymouthd needs to be built with -rdynamic so that the builtin
"details" plugin is loadable.

This commit adds the flag.

Related to #200
2022-12-01 14:30:19 -05:00
Ray Strode
31f6650d64 device-manager: Fix crash if XKB keymap could not be created
This commit fixes a crash introduced in the last commit when an
xkb keymap can't be created.

Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/199
2022-12-01 14:21:26 -05:00
Ray Strode
56a5e00b17 device-manager: Actually fall back to reading from tty if no xkb layout specified
Commit 7fcfcdf2d63025151a160f7948ee7406f0f16843 tried to fall back to
reading from a tty if no xkb layout was specified, but neglected to
actually check if no xkb layout was specified and force fall back to
reading from a tty in that case.

This commit changes device manager to actually disable reading from
/dev/input if the user doesn't specify a layout to use in vconsole.conf.

Closes https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/199
2022-12-01 13:40:30 -05:00
Ray Strode
f6852a7a82 device-manager: Fall back to reading from tty if no xkb layout specified
At the moment if a user doesn't specify a xkb layout in vconsole.conf we
just fall back to assuming a us qwerty layout.

This isn't really optimal, since it might not match the keyboard.
Furthermore, the tty does have a usable layout, so it makes more sense
to fall back to it.

This commit changes device manager to disable reading from /dev/input
if the user doesn't specify a layout to use in vconsole.conf.

Close https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/199
2022-11-30 09:53:54 -05: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
Ray Strode
5a9b24f18e trigger: Provide way for instance handlers to preempt run.
This commit adds a way for instance handlers to say "My handler
completed things, don't run any other handlers".

It does that by adding a boolean return value to the handler type
and making the callers return true for done.

Note, this commit doesn't update the callers to use the new api,
so it's sort of leaving things in a broken state.

The next commit will update the callers.
2022-11-29 13:33:44 -05:00
Ray Strode
48881ba2ef src: Hide console text when splash is requested
plymouthd may not be able to show the splash screen as soon as the
boot process wants it shown (if e.g. the driver isn't fully loaded
yet)

In that case, we sit tight and wait. Unfortunately, we aren't
logging boot messages while waiting.

This commit sets KD_GRAPHICS mode early to hide text from hitting
the console, but still tells systemd to print messages.  This way
we get boot logging but don't display the text while we wait on
the splash.
2022-11-29 09:47:17 -05:00
n3rdopolis
03d4e91bcd renderers: No longer assume that input is closed if the terminal device is NULL. 2022-11-29 14:25:02 +00:00
n3rdopolis
72195dabb3 frame-buffer: Add support for new /dev/input feature 2022-11-29 09:22:06 -05:00
Diego Augusto
3dacf642dd drm: Add support for new /dev/input feature
Now that the core plymouth code supports /dev/input, the renderer
plugins need to support it as well.

As a first step, this commit adds such support to the drm renderer
plugin.

Some contributions by n3rdopolis and Ray Strode.
2022-11-29 09:22:06 -05:00
Diego Augusto
dbec44871d src: Add support for /dev/input devices
Plymouth currently gets keyboard input from the terminal. This isn't
ideal, since it means plymouth requires VTs to be enabled in the kernel.

Furthermore, most display servers use /dev/input and libxkbcommon for
keyboard handling these days.

This commit adds similar support to the plymouth core code. Subsequent
commits will add support to the render plugins.

Some contributions by n3rdopolis and Ray Strode.
2022-11-29 09:22:06 -05:00
Diego Augusto
a2f03d4b98 scripts: Update keymap-render script to handle xkb keymaps too
At the moment the keyboard-render script only generates short
names for console layouts.

We're going to add /dev/input support to plymouth using
libxkbcommon, so we're going to need a list of of those keymaps
too.

This commit adds that.

Some contributions by n3rdopolis and Ray Strode.
2022-11-29 09:22:06 -05:00
Ray Strode
c354f026e5 device-manager: Only wait for device timeout for framebuffer devices
At the moment we ignore any udev events that come in before the
device timeout that are not drm devices.

That is because we don't want to use framebuffer devices as anything
but a last resort fallback option.

In the near future we're going to be handling input events from udev
as well. Those will obviously need to be handled right away, just like
drm devices.

This commit makes the check only defer framebuffer devices and not
anything that isn't a drm device.
2022-11-29 09:22:06 -05:00
Ray Strode
111b968759 ply-device-manager: Add != 0 to strcmp calls
strcmp is kind of a confusing function in that it returns
non-zero when the strings are not equal. That is
especially counterintuitive when this non-zero value is
treated as a TRUE boolean.

This commit just adds some != 0's to a couple of strcmp
calls for clarity.
2022-11-29 09:22:06 -05:00
Ray Strode
ab0559893e buffer: Support length == 0 for ply_buffer_append_bytes
Right now callers of ply_buffer_append_bytes have to be
very careful to make sure the data they're appending is
non-zero in length. This is kind of inconvenient, since
it's not unusual for data to come in that's zero bytes
long.

For simplicity, this commit just makes
ply_buffer_append_bytes support that use case.
2022-11-29 09:22:06 -05:00
Ray Strode
288d0aca02 terminal: Add API for flushing input buffer
In the future we're going to start reading keyboard input from
/dev/input instead of the tty. When that happens, input will
still be sent by the kernel to the tty.

This input would eventually back up and overflow.

To address that problem before it exists, this commit adds a new
API, ply_terminal_flush_input, that will drain the input buffer
on demand.

We can later use that API to keep the tty from backing up.
2022-11-29 09:22:06 -05:00
Ray Strode
dacf2dd9f3 trigger: Add the ability to trigger data with an associated instance
Right now triggers can only fire off handlers that have one piece
of data associated with them, but sometimes it's useful to have
an object associated with the data too.

This commit adds new api for adding "instance handlers" that have
an additional parameter and a new method `ply_trigger_set_instance`
that allows an object to be associated with the trigger and get
used for the additional parameter of the instance handlers.
2022-11-29 09:22:06 -05:00
Diego Augusto
123d07afd3 list: Add helper macro for iterating lists
At the moment, iterating over a ply_list_t requires an an
ugly looking for loop.

This commit adds a little sugar in the form of a
ply_list_foreach macro in the name of convenience.
2022-11-29 09:22:06 -05:00
Ray Strode
0902c25eb6 Revert "Add input device support"
Apparently the:

[x] Squash commits

box was checked when merge request plymouth/plymouth!177 was merged.
Oops.

We want good commit messages for such a big change, though, so people
doing code spelunking later have a fighting chance of following what's
going on.

This reverts commit dacfb36b57.

Subsequents commits will bring it back, peicemeal.
2022-11-29 09:14:37 -05:00
Ray Strode
e58891856c device-manager: Make sure local console terminal is open
We need to make sure the local console terminal is open so that
when we check later if it's a vt or not we get a valid answer.

This commit adds the open call.

Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/196
2022-11-28 19:33:29 -05:00
Ray Strode
8cb20287b0 device-manager: Ensure local_console_terminal isn't NULL
We thought we could get away with a NULL local_console_terminal
when the terminal isn't a VT, but it turns out we need it for
various reasons anyway.

This commit just makes sure we keep it in place.
2022-11-28 19:19:13 -05:00
n3rdopolis
8b1669acb2 device-manager: Support kernels with CONFIG_VT=n
At the moment, plymouth requires VT support be enabled in the kernel
to show graphical splashes.

This is because:

1. it relies on the tty to show details
2. when VT support is disabled the kernel will use ttyS0 as the default
console which makes plymouth disable graphical splashes since it assumes
the machine is a server with a serial console.

This commit addresses the first problem by disabling the
escape-to-toggle-details feature and addresses the second problem by
introducing a new kernel parameter plymouth.graphical that is like
the "splash" option and "plymouth.ignore-serial-consoles" option
combined.
2022-11-26 21:04:19 -05:00
Diego Augusto
dacfb36b57 Add input device support 2022-11-27 01:38:00 +00:00