mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 22:58:17 +02:00
Move throbber to libplybootsplash
This commit is contained in:
parent
76d837e387
commit
54a651f30c
5 changed files with 49 additions and 49 deletions
|
|
@ -5,9 +5,10 @@ INCLUDES = -I$(top_srcdir) \
|
|||
lib_LTLIBRARIES = libplybootsplash.la
|
||||
|
||||
libplybootsplashdir = $(includedir)/plymouth-1/plybootsplash
|
||||
libplybootsplash_HEADERS = ply-answer.h ply-window.h ply-boot-splash-plugin.h
|
||||
libplybootsplash_HEADERS = ply-answer.h ply-throbber.h ply-window.h ply-boot-splash-plugin.h
|
||||
|
||||
libplybootsplash_la_CFLAGS = $(PLYMOUTH_CFLAGS)
|
||||
libplybootsplash_la_CFLAGS = $(PLYMOUTH_CFLAGS) \
|
||||
-DPLYMOUTH_BACKGROUND_COLOR=$(background_color)
|
||||
libplybootsplash_la_LIBADD = $(PLYMOUTH_LIBS) ../libply/libply.la
|
||||
libplybootsplash_la_LDFLAGS = -export-symbols-regex '^[^_].*' \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||
|
|
@ -15,6 +16,7 @@ libplybootsplash_la_LDFLAGS = -export-symbols-regex '^[^_].*' \
|
|||
libplybootsplash_la_SOURCES = \
|
||||
$(libplybootsplash_HEADERS) \
|
||||
ply-answer.c \
|
||||
ply-throbber.c \
|
||||
ply-window.c
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "throbber.h"
|
||||
#include "ply-throbber.h"
|
||||
#include "ply-event-loop.h"
|
||||
#include "ply-array.h"
|
||||
#include "ply-logger.h"
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
#define FRAMES_PER_SECOND 30
|
||||
#endif
|
||||
|
||||
struct _throbber
|
||||
struct _ply_throbber
|
||||
{
|
||||
ply_array_t *frames;
|
||||
ply_event_loop_t *loop;
|
||||
|
|
@ -71,16 +71,16 @@ struct _throbber
|
|||
double start_time, now;
|
||||
};
|
||||
|
||||
throbber_t *
|
||||
throbber_new (const char *image_dir,
|
||||
ply_throbber_t *
|
||||
ply_throbber_new (const char *image_dir,
|
||||
const char *frames_prefix)
|
||||
{
|
||||
throbber_t *throbber;
|
||||
ply_throbber_t *throbber;
|
||||
|
||||
assert (image_dir != NULL);
|
||||
assert (frames_prefix != NULL);
|
||||
|
||||
throbber = calloc (1, sizeof (throbber_t));
|
||||
throbber = calloc (1, sizeof (ply_throbber_t));
|
||||
|
||||
throbber->frames = ply_array_new ();
|
||||
throbber->frames_prefix = strdup (frames_prefix);
|
||||
|
|
@ -96,7 +96,7 @@ throbber_new (const char *image_dir,
|
|||
}
|
||||
|
||||
static void
|
||||
throbber_remove_frames (throbber_t *throbber)
|
||||
ply_throbber_remove_frames (ply_throbber_t *throbber)
|
||||
{
|
||||
int i;
|
||||
ply_image_t **frames;
|
||||
|
|
@ -108,12 +108,12 @@ throbber_remove_frames (throbber_t *throbber)
|
|||
}
|
||||
|
||||
void
|
||||
throbber_free (throbber_t *throbber)
|
||||
ply_throbber_free (ply_throbber_t *throbber)
|
||||
{
|
||||
if (throbber == NULL)
|
||||
return;
|
||||
|
||||
throbber_remove_frames (throbber);
|
||||
ply_throbber_remove_frames (throbber);
|
||||
ply_array_free (throbber->frames);
|
||||
|
||||
free (throbber->frames_prefix);
|
||||
|
|
@ -122,7 +122,7 @@ throbber_free (throbber_t *throbber)
|
|||
}
|
||||
|
||||
static void
|
||||
animate_at_time (throbber_t *throbber,
|
||||
animate_at_time (ply_throbber_t *throbber,
|
||||
double time)
|
||||
{
|
||||
int number_of_frames;
|
||||
|
|
@ -159,7 +159,7 @@ animate_at_time (throbber_t *throbber,
|
|||
}
|
||||
|
||||
static void
|
||||
on_timeout (throbber_t *throbber)
|
||||
on_timeout (ply_throbber_t *throbber)
|
||||
{
|
||||
double sleep_time;
|
||||
throbber->now = ply_get_timestamp ();
|
||||
|
|
@ -184,7 +184,7 @@ on_timeout (throbber_t *throbber)
|
|||
}
|
||||
|
||||
static bool
|
||||
throbber_add_frame (throbber_t *throbber,
|
||||
ply_throbber_add_frame (ply_throbber_t *throbber,
|
||||
const char *filename)
|
||||
{
|
||||
ply_image_t *image;
|
||||
|
|
@ -206,7 +206,7 @@ throbber_add_frame (throbber_t *throbber,
|
|||
}
|
||||
|
||||
static bool
|
||||
throbber_add_frames (throbber_t *throbber)
|
||||
ply_throbber_add_frames (ply_throbber_t *throbber)
|
||||
{
|
||||
struct dirent **entries;
|
||||
int number_of_entries;
|
||||
|
|
@ -234,7 +234,7 @@ throbber_add_frames (throbber_t *throbber)
|
|||
filename = NULL;
|
||||
asprintf (&filename, "%s/%s", throbber->image_dir, entries[i]->d_name);
|
||||
|
||||
if (!throbber_add_frame (throbber, filename))
|
||||
if (!ply_throbber_add_frame (throbber, filename))
|
||||
goto out;
|
||||
|
||||
free (filename);
|
||||
|
|
@ -248,7 +248,7 @@ throbber_add_frames (throbber_t *throbber)
|
|||
out:
|
||||
if (!load_finished)
|
||||
{
|
||||
throbber_remove_frames (throbber);
|
||||
ply_throbber_remove_frames (throbber);
|
||||
|
||||
while (entries[i] != NULL)
|
||||
{
|
||||
|
|
@ -262,19 +262,19 @@ out:
|
|||
}
|
||||
|
||||
bool
|
||||
throbber_load (throbber_t *throbber)
|
||||
ply_throbber_load (ply_throbber_t *throbber)
|
||||
{
|
||||
if (ply_array_get_size (throbber->frames) != 0)
|
||||
throbber_remove_frames (throbber->frames);
|
||||
ply_throbber_remove_frames (throbber->frames);
|
||||
|
||||
if (!throbber_add_frames (throbber))
|
||||
if (!ply_throbber_add_frames (throbber))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
throbber_start (throbber_t *throbber,
|
||||
ply_throbber_start (ply_throbber_t *throbber,
|
||||
ply_event_loop_t *loop,
|
||||
ply_window_t *window,
|
||||
long x,
|
||||
|
|
@ -301,7 +301,7 @@ throbber_start (throbber_t *throbber,
|
|||
}
|
||||
|
||||
void
|
||||
throbber_stop (throbber_t *throbber)
|
||||
ply_throbber_stop (ply_throbber_t *throbber)
|
||||
{
|
||||
if (throbber->frame_area.width > 0)
|
||||
ply_frame_buffer_fill_with_hex_color (throbber->frame_buffer, &throbber->frame_area,
|
||||
|
|
@ -319,13 +319,13 @@ throbber_stop (throbber_t *throbber)
|
|||
}
|
||||
|
||||
long
|
||||
throbber_get_width (throbber_t *throbber)
|
||||
ply_throbber_get_width (ply_throbber_t *throbber)
|
||||
{
|
||||
return throbber->width;
|
||||
}
|
||||
|
||||
long
|
||||
throbber_get_height (throbber_t *throbber)
|
||||
ply_throbber_get_height (ply_throbber_t *throbber)
|
||||
{
|
||||
return throbber->height;
|
||||
}
|
||||
|
|
@ -30,23 +30,23 @@
|
|||
#include "ply-frame-buffer.h"
|
||||
#include "ply-window.h"
|
||||
|
||||
typedef struct _throbber throbber_t;
|
||||
typedef struct _ply_throbber ply_throbber_t;
|
||||
|
||||
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
|
||||
throbber_t *throbber_new (const char *image_dir,
|
||||
const char *frames_prefix);
|
||||
void throbber_free (throbber_t *throbber);
|
||||
ply_throbber_t *ply_throbber_new (const char *image_dir,
|
||||
const char *frames_prefix);
|
||||
void ply_throbber_free (ply_throbber_t *throbber);
|
||||
|
||||
bool throbber_load (throbber_t *throbber);
|
||||
bool throbber_start (throbber_t *throbber,
|
||||
ply_event_loop_t *loop,
|
||||
ply_window_t *window,
|
||||
long x,
|
||||
long y);
|
||||
void throbber_stop (throbber_t *throbber);
|
||||
bool ply_throbber_load (ply_throbber_t *throbber);
|
||||
bool ply_throbber_start (ply_throbber_t *throbber,
|
||||
ply_event_loop_t *loop,
|
||||
ply_window_t *window,
|
||||
long x,
|
||||
long y);
|
||||
void ply_throbber_stop (ply_throbber_t *throbber);
|
||||
|
||||
long throbber_get_width (throbber_t *throbber);
|
||||
long throbber_get_height (throbber_t *throbber);
|
||||
long ply_throbber_get_width (ply_throbber_t *throbber);
|
||||
long ply_throbber_get_height (ply_throbber_t *throbber);
|
||||
#endif
|
||||
|
||||
#endif /* THROBBER_H */
|
||||
|
|
@ -17,9 +17,7 @@ spinfinity_la_LDFLAGS = -module -avoid-version -export-dynamic
|
|||
spinfinity_la_LIBADD = $(PLYMOUTH_LIBS) \
|
||||
../../libply/libply.la \
|
||||
../../libplybootsplash/libplybootsplash.la
|
||||
spinfinity_la_SOURCES = $(srcdir)/plugin.c \
|
||||
$(srcdir)/throbber.h \
|
||||
$(srcdir)/throbber.c
|
||||
spinfinity_la_SOURCES = $(srcdir)/plugin.c
|
||||
|
||||
throbber_frames = \
|
||||
throbber-00.png \
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
#include "ply-utils.h"
|
||||
#include "ply-window.h"
|
||||
|
||||
#include "throbber.h"
|
||||
#include "ply-throbber.h"
|
||||
|
||||
#include <linux/kd.h>
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ struct _ply_boot_splash_plugin
|
|||
ply_window_t *window;
|
||||
|
||||
entry_t *entry;
|
||||
throbber_t *throbber;
|
||||
ply_throbber_t *throbber;
|
||||
|
||||
ply_answer_t *pending_password_answer;
|
||||
};
|
||||
|
|
@ -99,7 +99,7 @@ create_plugin (void)
|
|||
plugin->entry_image = ply_image_new (PLYMOUTH_IMAGE_DIR "spinfinity/entry.png");
|
||||
plugin->box_image = ply_image_new (PLYMOUTH_IMAGE_DIR "spinfinity/box.png");
|
||||
|
||||
plugin->throbber = throbber_new (PLYMOUTH_IMAGE_DIR "spinfinity",
|
||||
plugin->throbber = ply_throbber_new (PLYMOUTH_IMAGE_DIR "spinfinity",
|
||||
"throbber-");
|
||||
|
||||
return plugin;
|
||||
|
|
@ -140,7 +140,7 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
|
|||
ply_image_free (plugin->entry_image);
|
||||
ply_image_free (plugin->box_image);
|
||||
ply_image_free (plugin->lock_image);
|
||||
throbber_free (plugin->throbber);
|
||||
ply_throbber_free (plugin->throbber);
|
||||
free (plugin);
|
||||
}
|
||||
|
||||
|
|
@ -189,9 +189,9 @@ start_animation (ply_boot_splash_plugin_t *plugin)
|
|||
|
||||
ply_frame_buffer_get_size (plugin->frame_buffer, &area);
|
||||
|
||||
width = throbber_get_width (plugin->throbber);
|
||||
height = throbber_get_height (plugin->throbber);
|
||||
throbber_start (plugin->throbber,
|
||||
width = ply_throbber_get_width (plugin->throbber);
|
||||
height = ply_throbber_get_height (plugin->throbber);
|
||||
ply_throbber_start (plugin->throbber,
|
||||
plugin->loop,
|
||||
plugin->window,
|
||||
area.width / 2.0 - width / 2.0,
|
||||
|
|
@ -206,7 +206,7 @@ stop_animation (ply_boot_splash_plugin_t *plugin)
|
|||
assert (plugin != NULL);
|
||||
assert (plugin->loop != NULL);
|
||||
|
||||
throbber_stop (plugin->throbber);
|
||||
ply_throbber_stop (plugin->throbber);
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
|
|
@ -325,7 +325,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
|
|||
return false;
|
||||
|
||||
ply_trace ("loading throbber");
|
||||
if (!throbber_load (plugin->throbber))
|
||||
if (!ply_throbber_load (plugin->throbber))
|
||||
return false;
|
||||
|
||||
plugin->window = window;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue