From d3c5dd3d9737bf2ff372a4d6808d29925f415ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Thu, 21 Feb 2019 13:25:34 +0300 Subject: [PATCH] =?UTF-8?q?sys-boot/plymouth-calculate-plugin:=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80?= =?UTF-8?q?=D0=B5=D1=81=D1=81=D0=B1=D0=B0=D1=80,=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20spinner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../files/calculate.plymouth | 2 - .../plymouth-calculate-plugin/files/plugin.c | 89 ++++++++++--------- ...plymouth-calculate-plugin-0.9.4-r3.ebuild} | 19 +--- 3 files changed, 49 insertions(+), 61 deletions(-) rename sys-boot/plymouth-calculate-plugin/{plymouth-calculate-plugin-0.9.4-r2.ebuild => plymouth-calculate-plugin-0.9.4-r3.ebuild} (79%) diff --git a/sys-boot/plymouth-calculate-plugin/files/calculate.plymouth b/sys-boot/plymouth-calculate-plugin/files/calculate.plymouth index e41815bd2..e9a940639 100644 --- a/sys-boot/plymouth-calculate-plugin/files/calculate.plymouth +++ b/sys-boot/plymouth-calculate-plugin/files/calculate.plymouth @@ -7,8 +7,6 @@ ModuleName=calculate ImageDir=/usr/share/plymouth/themes/calculate BackgroundStartColor=0x000000 BackgroundEndColor=0x000000 -BootProgressbarColor=0xcdc481 -ShutdownProgressbarColor=off BootImage=/usr/share/plymouth/themes/calculate/boot ShutdownImage=/usr/share/plymouth/themes/calculate/shutdown ShutdownText=Shutdown... diff --git a/sys-boot/plymouth-calculate-plugin/files/plugin.c b/sys-boot/plymouth-calculate-plugin/files/plugin.c index 33e1cee5d..9caf9fc5c 100644 --- a/sys-boot/plymouth-calculate-plugin/files/plugin.c +++ b/sys-boot/plymouth-calculate-plugin/files/plugin.c @@ -175,6 +175,7 @@ struct _ply_boot_splash_plugin uint32_t is_idle : 1; uint32_t is_boot_progressbar : 1; uint32_t is_shutdown_progressbar : 1; + uint32_t is_progressbar : 1; }; bool is_dir(const char* path) { @@ -434,6 +435,7 @@ view_start_animation (view_t *view) long width, height; long x,y; int number_of_frames; + int yoffset = 0; assert (view != NULL); @@ -464,6 +466,7 @@ view_start_animation (view_t *view) x = 0; y = screen_height / 2; ply_label_show (view->shutdown_label, view->display, x, y); + yoffset = ply_label_get_height(view->shutdown_label) * 2; } plugin->is_idle = false; @@ -473,17 +476,14 @@ view_start_animation (view_t *view) if (number_of_frames > 0) { width = ply_throbber_get_width (view->throbber); height = ply_throbber_get_height (view->throbber); + y = view->logo_area.y + view->logo_area.height + height / 2; + ply_throbber_start (view->throbber, plugin->loop, view->display, screen_width / 2.0 - width / 2.0, - view->logo_area.y + view->logo_area.height + height / 2); + (y + height < screen_height) ? y : (screen_height / 2 + yoffset)); } - if ((plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN && plugin->is_shutdown_progressbar) || - (plugin->mode == PLY_BOOT_SPLASH_MODE_BOOT_UP && plugin->is_boot_progressbar)) - ply_progress_bar_show (view->progress_bar, - view->display, - 0, screen_height - ply_progress_bar_get_height (view->progress_bar)); view_redraw (view); } @@ -618,36 +618,11 @@ create_plugin (ply_key_file_t *key_file) free (color); - color = ply_key_file_get_value (key_file, "calculate", "BootProgressbarColor"); - - if (color != NULL && strcasecmp(color, "off") == 0) { - plugin->is_boot_progressbar = false; - plugin->boot_progressbar_color = 0xffffff; - } else { - plugin->is_boot_progressbar = true; - if (color != NULL) - plugin->boot_progressbar_color = strtol (color, NULL, 0); - else - plugin->boot_progressbar_color = 0xffffff; - } - - free (color); - - color = ply_key_file_get_value (key_file, "calculate", "ShutdownProgressbarColor"); - - if (color != NULL && strcasecmp(color, "off") == 0) { - plugin->is_shutdown_progressbar = false; - plugin->shutdown_progressbar_color = 0xffffff; - - } else { - plugin->is_shutdown_progressbar = true; - if (color != NULL) - plugin->shutdown_progressbar_color = strtol (color, NULL, 0); - else - plugin->shutdown_progressbar_color = 0xffffff; - } - - free (color); + plugin->is_boot_progressbar = false; + plugin->is_shutdown_progressbar = false; + plugin->boot_progressbar_color = 0xffffff; + plugin->shutdown_progressbar_color = 0xffffff; + plugin->is_progressbar = false; return plugin; } @@ -701,14 +676,14 @@ draw_background (view_t *view, area.y = y; area.width = width; area.height = height; - + if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN) { - start_color = plugin->shutdown_background_start_color; - end_color = plugin->shutdown_background_end_color; - } else { - start_color = plugin->background_start_color; - end_color = plugin->background_end_color; - } + start_color = plugin->shutdown_background_start_color; + end_color = plugin->shutdown_background_end_color; + } else { + start_color = plugin->background_start_color; + end_color = plugin->background_end_color; + } if (start_color != end_color) ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area, start_color, end_color); @@ -1262,3 +1237,31 @@ ply_progress_bar_new (void) return progress_bar; } +static void +ply_progress_bar_update_area (ply_progress_bar_t *progress_bar, + long x, + long y) +{ + unsigned long display_width; + + progress_bar->area.x = x; + progress_bar->area.y = y; + progress_bar->area.height = BAR_HEIGHT; + + display_width = ply_pixel_display_get_width (progress_bar->display); + progress_bar->area.width = (long) (display_width * progress_bar->percent_done); +} + +void +ply_progress_bar_draw (ply_progress_bar_t *progress_bar) +{ + if (progress_bar->is_hidden) + return; + + ply_progress_bar_update_area (progress_bar, progress_bar->area.x, progress_bar->area.y); + ply_pixel_display_draw_area (progress_bar->display, + progress_bar->area.x, + progress_bar->area.y, + progress_bar->area.width, + progress_bar->area.height); +} diff --git a/sys-boot/plymouth-calculate-plugin/plymouth-calculate-plugin-0.9.4-r2.ebuild b/sys-boot/plymouth-calculate-plugin/plymouth-calculate-plugin-0.9.4-r3.ebuild similarity index 79% rename from sys-boot/plymouth-calculate-plugin/plymouth-calculate-plugin-0.9.4-r2.ebuild rename to sys-boot/plymouth-calculate-plugin/plymouth-calculate-plugin-0.9.4-r3.ebuild index 139b0d65e..64b4fc69f 100644 --- a/sys-boot/plymouth-calculate-plugin/plymouth-calculate-plugin-0.9.4-r2.ebuild +++ b/sys-boot/plymouth-calculate-plugin/plymouth-calculate-plugin-0.9.4-r3.ebuild @@ -89,22 +89,9 @@ src_install() { insinto /usr/share/plymouth/themes/calculate doins box.png bullet.png entry.png lock.png - doins ${FILESDIR}/calculate.plymouth - - #insinto /usr/share/plymouth - #newins "${DISTDIR}"/gentoo-logo.png bizcom.png - #if use split-usr ; then - # # Install compatibility symlinks as some rdeps hardcode the paths - # dosym ../usr/bin/plymouth /bin/plymouth - # dosym ../usr/sbin/plymouth-set-default-theme /sbin/plymouth-set-default-theme - # dosym ../usr/sbin/plymouthd /sbin/plymouthd - #fi + cd ${S}/themes/spinner + doins throbber-00*.png - #readme.gentoo_create_doc - - ## looks like make install create /var/run/plymouth - ## this is not needed for systemd, same should hold for openrc - ## so remove - #rm -rf "${D}"/var/run + doins ${FILESDIR}/calculate.plymouth }