Commit graph

2701 commits

Author SHA1 Message Date
Hans de Goede
c87a2c07b7 themes: Add images for keyboard indicator support to spinner and spinfinity
Add capslock.png, keyboard.png and keymap-render.png files to the
spinner and spinfinity themes, this enables keyboard indicator
(keymap and capslock state) support for these themes.

capslock.png was made by me drawing the icon in xfig, then export as
svg, at some blank rows at the bottom and save as png. I've added the
capslock.fig file to the spinner theme dir.

keyboard.png comes from google's material-design-icons (original is
apache licensed): https://github.com/google/material-design-icons/
I've also added a copy of the 2 svg source files to the spinner theme dir.

keymap-render.png is generated by scripts/keymap-render.py.

Fixes: #85

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:43:34 +02:00
Hans de Goede
05f32bc2ff two-step: Add Keyboard layout indicator support
Use the new keymap-icon control to show a keyboard layout indicator,
when showing a dialog.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:43:34 +02:00
Hans de Goede
28cb15c61c capslock-icon: Draw the icon on show
Mark the display area where the icon is as damaged on show to force it
being drawn on show, in case capslock is on at show time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:43:34 +02:00
Hans de Goede
665c2852af libply-splash-graphics: Add new keymap-icon control
Add a new control which draws a keyboard-icon + a pre-rendered text
describing the current layout/keymap (as reported by the renderer).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:43:34 +02:00
Alberto Ruiz
b26a956a11 scripts: Add keymap-render.py script
Add a script for generating a png with the short-name (ignoring variants)
of all keymaps listed by "localectl list-keymaps" pre-generated.

This scripts also generates a ply-keymap-metadata.h file with info on
which pre-generated keymap name is where in the png.

This will be used in a follow-up commit to add support for a new
keyboard-keymap-icon control to libply-splash-graphics.

Note that this commit does not add the generated keymap-render.png file,
this file will be added to each themes image-dir separately as the color
of the pre-generated text may differ per theme.

Changes by Hans de Goede:
- Change generated metadata into a C header file
- Drop drawing of curved corners, we just want the text
- Add special handling for dvorak

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:43:34 +02:00
Hans de Goede
9306edbc17 renderer: Add ply_renderer_get_keymap function
Add a function to get the keymap from a renderer and implement
this for the drm and frame-buffer renderers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:43:34 +02:00
Hans de Goede
f91e78f446 terminal: add ply_terminal_get_keymap function
Add a helper function to get the keymap from the terminal.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:43:34 +02:00
Hans de Goede
c00955ce03 key-file: Add support for non ini style config files
In some cases me way want to parse key=value style config files from
outside of plymouth which lack ini style groups.

This commit adds a new ply_key_file_load_groupless_file function which
supports loading such files. When a file is loaded this way, NULL must
be passed as group_name for subsequent ply_key_file_get_* calls.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-01 00:10:50 +02:00
Hans de Goede
eb73c37c0d Merge branch 'avoid_build_warning' into 'master'
Use GTK 3.22's way to get screen size

See merge request plymouth/plymouth!51
2019-09-30 09:25:47 +00:00
ZhaoQiang
da9353120a x11-render-plugin: Use GTK 3.22's method to get screen size to avoid
deprecate warning in compile.
2019-09-30 09:19:37 +00:00
Hans de Goede
bb82dc5440 Merge branch 'cleanups' into 'master'
Cleanups

See merge request plymouth/plymouth!70
2019-09-30 09:17:47 +00:00
Hans de Goede
bf6ef0a481 space-flares: Fix compiler warning
Recent gcc versions give the following compiler warning with space-flares:
./plugin.c: In function ‘star_bg_update’:
./plugin.c:762:21: warning: taking the absolute value of unsigned type ‘uint32_t’ {aka ‘unsigned int’} has no effect [-Wabsolute-value]
  762 |                 if (abs (((image_data[x + y * width] >> 16) & 0xff) - ((pixel_colour >> 16) & 0xff)) > 8) {
      |                     ^~~

This commit fixes this, assuming that gcc actually optimises the abs()
away, this will also make the code behave as intended again.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
c7965ea19a ply-utils: Drop unused ply_string_has_prefix helper
ply_string_has_prefix is no longer used anywhere, drop it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
91185e41e6 main: Use ply_kernel_command_line_get_key_value where appropriate
Switch to ply_kernel_command_line_get_key_value where appropriate.

While at it also fix a mem-leak when falling back override_splash_path from
PLYMOUTH_RUNTIME_THEME_PATH to PLYMOUTH_THEME_PATH.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
11f2017ab7 ply-utils: Add ply_kernel_command_line_get_key_value helper
ply_kernel_command_line_get_string_after_prefix returns the rest of
the commandline after the passed in prefix. When parsing key=value parts
of the commandline, we really only want the value part and stop at the
whitespace separating it from other kernel commandline arguments.

This commit adds a new helper which returns a strdup-ed string containing
just the value; instead of the entire rest of the kernel commandline.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
6bacbbb8ad two-step: Merge show_password_prompt and show_prompt into 1 function
These 2 functions were doing almost the same. Move the setting of the
entry text or bullet count into view_show_prompt were it belongs and
merge these 2 functions into 1 function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
8f04867b74 twp-step: Remove superflous is_hidden / is_stopped checks from on_draw
Remove superflous is_hidden / is_stopped checks from our on_draw
handler. In all 3 cases the is_hidden / is_stopped check guards
a draw_area call, but the draw_area calls themselves contain the
same check, so it checking this in on_draw is not necessary.

Also note that we are already not doing such a check for e.g. the
progress_bar so lets be consistent and remove the check everywhere.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
48de9e64ee two-step: Cleanup stop_animation function
Cleanup the stop_animation function:
- Remove the trigger argument as all callers pass NULL
- Remove the logging of "hiding progress animation" we already log a
  generic "stopping animation" message and we do not log such a message
  for the other animated controls, so remove this one for consistency
- Add a NULL pointer check for view->end_animation, as this can actually
  be NULL when view_load_end_animation fails

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
5dd6e91d2b two-step: Group progress_animaton init together with creation
Move ply_progress_animation_set_transition call up, grouping it with the
ply_progress_animation_new call.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-30 11:15:31 +02:00
Hans de Goede
3db248249e Merge branch 'spinfinity-two-step' into 'master'
Move the spinfinity theme to the two-step splash plugin

See merge request plymouth/plymouth!68
2019-09-30 09:04:24 +00:00
Hans de Goede
08490fed8a themes: Move spinifity from the throbgress splash to the two-step splash
At one point in time the two-step splash plugin was forked from the
throbgress splash. Since then the two-step plugin has grown to be more
flexible / configurable.

The two-step plugin is now flexible enough that with the right config
it can mimick the throbgress plugin. Moving the spinifity theme to
use the two-step plugin allows us to remove the throbgress plugin,
removing the code duplication between the 2 plugins.

An added advantage of this is that the two-step plugin has more functionality,
such as capslock indicator support for the password dialog.

Note the throbber-??.png images were modified to add 24 transparant rows at
the top, to get the extra hardcoded throbber-height / 2 space which the
throbgress plugin added between the throbber and the header-image, this
was done automatically using the following command:
convert old.png -background transparent -gravity northwest -splice 0x24 new.png

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-27 09:36:51 +02:00
Hans de Goede
9a78d61057 two-step: Add new UseAnimation setting
Until now we have been disabling the animations when the theme specifies
that a progress-bar should be drawn for the current mode.

This commit adds a new UseAnimation setting which defaults to
!UseProgressBar to preserve the old behavior if UseAnimation is not
set by the theme.

This makes two-step more flexible. Specifically it will allow implementing
the spinfinity theme using two-step; and spinifinity is the only user of
the throbgress plugin, so this will allow removal of that plugin.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-27 09:36:51 +02:00
Hans de Goede
fb8cead071 two-step: Make progress-bar location and size configurable
This commit makes the progress-bar location configurable seperately from
the animation location and it makes the progress-bar size configurable
instead of hardcoding it.

This makes two-step more flexible. Specifically it will allow implementing
the spinfinity theme using two-step; and spinifinity is the only user of
the throbgress plugin, so this will allow removal of that plugin.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-27 09:36:51 +02:00
Hans de Goede
c2d3f7feb4 two-step: Fix progress-bar not hiding when it should
Before this commit we were not hiding the progress-bar when starting the
end-animation nor when stop_animation gets called. This adds the 2 missing
hide calls, making the handling of the progress-bar identical to that of
the progress-animation.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-27 09:36:51 +02:00
Hans de Goede
a9d5283ffa two-step: Fix progress-bar not updating on normal boot
We were only calling ply_progress_bar_set_percent_done from the
system_update callback and not from the on_boot_progress callback.

This commit fixes this by adding the missing calls for this to
update_progress_animation and it makes system_update use
update_progress_animation instead of duplicating the code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-27 09:36:51 +02:00
Hans de Goede
48227ed8af two-step: Fold ply_progress_animation_hide call into view_start_end_animation
We should always disable (hide) the progress-animation when
starting the end-animation. Instead of having all callers of
view_start_end_animation do this themselves, do it at the beginning
of view_start_end_animation.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-27 09:36:51 +02:00
Hans de Goede
9202b6939a Merge branch 'capslock-indicator' into 'master'
Capslock indicator

See merge request plymouth/plymouth!67
2019-09-27 07:36:12 +00:00
Hans de Goede
dcc5a947d1 two-step: Add a capslock indicator
Add support for showing a capslock indicator when capslock is pressed
while entering a password.

This is automatically enabled if a capslock.png file is present in
the theme's image dir.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-26 16:39:46 +02:00
Hans de Goede
ea1ef31926 two-step: Use new ply_key_file_get_* helpers to read theme file
Use the new ply_key_file_get_double() and ply_key_file_get_long() helpers
to get the various theme settings, resulting in a nice cleanup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-26 16:39:46 +02:00
Hans de Goede
60d03e7a13 libply: Add ply_key_file_get_long() function
Add a ply_key_file_get_long() function which plugins can use to read
a long value.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-25 22:09:03 +02:00
Hans de Goede
8bcb989d8d libply: Add ply_key_file_get_double() function
Add a ply_key_file_get_double() function which plugins can use to read
a double value, instead of them having to repeat this pattern over and over:

  double_str = ply_key_file_get_value (key_file, "group", "key");
  if (double_str != NULL)
      foo = ply_strtod (double_str);
  else
      foo = 1.0;
  free (double_str);

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-25 21:33:52 +02:00
Hans de Goede
1e2aad5cef libply: Add ply_key_file_get_raw_value() helper
Add a private ply_key_file_get_raw_value() helper to avoid code-duplication
between ply_key_file_get_value() and ply_key_file_get_bool().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-25 21:33:52 +02:00
Hans de Goede
543c733622 libply-splash-graphics: Add new capslock-icon control
Add a new control which draws a capslock-icon when capslock is active
(as reported by the renderer).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-25 12:29:19 +02:00
Hans de Goede
b0911e9b21 ply-renderer: Add ply_renderer_get_capslock_state function
Add a function to get the capslock state from a renderer and implement
this for the drm and frame-buffer renderers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-24 08:16:05 +02:00
Hans de Goede
7f49ef3fe6 terminal: add ply_terminal_get_capslock_state function
Add a helper function to get the capslock-state from the terminal.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-24 08:16:05 +02:00
Hans de Goede
0f460d6b23 Merge branch 'label-rotation-fix' into 'master'
label: Properly deal with pixel-buffers with non-upright device_rotation

See merge request plymouth/plymouth!66
2019-09-24 06:14:57 +00:00
Hans de Goede
7ef8b7edbf label: Properly deal with pixel-buffers with non-upright device_rotation
Fix the label plugin rendering garbled (wrong pitch) top to bottom text,
instead of proper left to right text when the pixel-buffer has a
device-rotation of rotate-clockwise or rotate-counter-clockwise.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1753418
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-19 21:48:40 +02:00
Hans de Goede
5f32c70a16 Merge branch 'amdgpu-fix' into 'master'
ply-device-manager: De-activate and close renderer on device hot unplug

See merge request plymouth/plymouth!59
2019-09-19 14:13:56 +00:00
Hans de Goede
c2ac8fcefd ply-device-manager: De-activate and close renderer on device hot unplug
When a device gets hot unplugged, we should de-activate and close the
renderer before freeing it.

Speficially this fixes a problem where plymouth's display "freezes" when
used with AMD GPUs which can be handled by both the radeon or the amdgpu
kms driver and the user has added kernel commandline options to prefer
the amdgpu driver. In this case the following happens:

1) radeon driver gets loaded, creates /dev/dri/card0 generating a udev
   "add /dev/dri/card0" event.
2) radeon driver's "load" method checks if it should bind, comes to the
   conclusion it should not, causing the probe of the device to be
   aborted and /dev/dri/card0 to be unregistered generating a udev
   "remove /dev/dri/card0"  event
3) amdgpu driver loads, creates /dev/dri/card0 generating another udev
   "add /dev/dri/card0" event.
4) plymouth loads while udev is still catching up with kernel events,
   plymouth sees the first "add" event opens /dev/dri/card0 (which is
   already managed by amdgpu at this time) finds outputs, shows splash
5) plymouth gets the "remove" events tears down the renderer, but
   since deactivate and close were not called before this commit,
   plymouth keeps the master rights attached to the old-fd which is
   leaked at this point
6) plymouth gets the second "add" event brings everything back up, but
   it cannot get master rights, since there can only be 1 master and the
   leaked fd is the master. This leads to lots of:
   "Couldn't set scan out buffer" errors and plymouth appears frozen
   because of this, this is esp. bad with the disk encryption unlock screen
7) When gdm starts, it deactivates plymouth, but does not yet tell it to quit
   to avoid flickering. The deactivate makes plymouth drop its master rights,
   but this happens on the new broken fd which never got the master rights.
   This also makes it impossible for gdm to get master rights, also breaking
   gdm, with the following error in the logs:
   "(EE) wl_drm@4: error 0: authenicate failed"

Note in theory calling ply_renderer_close() on teardown (from
ply_device_manager_free()) should be fine too, but for some reason
this causes the framebuffer to be all messed up (looks like wrong pitch /
tiling) when this is done after gdm has taken over the framebuffer.

Where as just exiting without calling drmModeRmFB, letting the kernel
clean up behind us, does not trigger this. This feels like it is a kernel
bug bug and I will file a bug for this. But for now we should not call
ply_renderer_close() on teardown to avoid this issue (which would be a
regression).

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1490490
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-19 16:10:04 +02:00
Dimitri John Ledkov
aa89dcdf5e script: Add image tile support.
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
2019-09-11 09:11:24 -04:00
Ray Strode
9eb7b17bdb Merge branch 'sync_l10n_gnome_translations' into 'master'
Translations: Sync l10n.gnome.org's translation.

See merge request plymouth/plymouth!63
2019-09-11 13:05:20 +00:00
ZhaoQiang
ff729d1afc Translations: Sync l10n.gnome.org's translation. 2019-09-10 02:24:46 +00:00
Ray Strode
c97d52e2ad Merge branch 'adjust_Turkish_translation' into 'master'
Translation: Adjust the Turkish translation(tr.po), it's better to keep all po files in the /po directory together.

See merge request plymouth/plymouth!62
2019-09-09 20:15:35 +00:00
ZhaoQiang
aa02e3b543 Translation: Adjust the Turkish translation(tr.po), it's better to keep all po
files in the /po directory together.
2019-09-09 13:48:23 +08:00
Hans de Goede
3abfab212f Merge branch 'device-timeout-default' into 'master'
plymouthd.defaults: Bump default DeviceTimeout to 8 seconds

See merge request plymouth/plymouth!58
2019-09-08 13:45:08 +00:00
Hans de Goede
75204a2517 plymouthd.defaults: Bump default DeviceTimeout to 8 seconds
The amdgpu driver needs up to 5 seconds to initialize / boot some
AMD GPUs, which makes our 5 second timeout much too close to the actual
needed time, leading to systems where sometimes the boot is fine and the
next boot we fallback to a text based splash because we won the race from
the GPU probe code.

This commit bumps the default DeviceTimeout to 8 seconds giving us a
decent marging here without making it overly long.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1737221
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-08 15:44:35 +02:00
Ray Strode
b637ff9b05 Merge branch 'libreajans-master-patch-41995' into 'master'
Update tr.po

See merge request plymouth/plymouth!61
2019-09-07 21:31:59 +00:00
libre ajans
d1d007c8d6 Update tr.po 2019-09-07 21:31:59 +00:00
Hans de Goede
eacd38d89c Merge branch 'twostep-another-bgrt-fix' into 'master'
two-step: bgrt: Add workaround for desktops which do not use the golden ratio

See merge request plymouth/plymouth!56
2019-09-06 15:38:17 +00:00
Hans de Goede
4b3be15486 two-step: bgrt: Add workaround for desktops which do not use the golden ratio
On desktops (no panel) we normally do not use the BGRT provided
xoffset and yoffset because the resolution they are intended for
may be differtent then the resolution of the current display.

On some desktops (no panel) the image gets centered not only
horizontally, but also vertically. In this case our default of using
the golden ratio for the vertical position causes the BGRT image
to jump.

To avoid this this commits adds an extra check to see if the provided
xoffset and yoffset perfectly center the image and in that case uses them.

An example of a system needing this workaround is the Minix Neo Z83-4.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-09-06 17:34:05 +02:00