Browse Source

Imported Upstream version 0.8.3

tags/upstream/0.8.3^0
Laurent Bigonville 7 years ago
parent
commit
a7ccf3c0c5
30 changed files with 833 additions and 260 deletions
  1. +5
    -5
      aclocal.m4
  2. +4
    -4
      build-tools/ltmain.sh
  3. +12
    -12
      configure
  4. +1
    -1
      configure.ac
  5. +6
    -0
      src/libply-splash-core/ply-boot-splash.c
  6. +123
    -13
      src/libply-splash-core/ply-pixel-buffer.c
  7. +26
    -8
      src/libply-splash-core/ply-pixel-buffer.h
  8. +60
    -5
      src/libply-splash-core/ply-terminal.c
  9. +18
    -18
      src/libply-splash-graphics/ply-animation.c
  10. +40
    -17
      src/libply-splash-graphics/ply-entry.c
  11. +5
    -0
      src/libply-splash-graphics/ply-entry.h
  12. +11
    -1
      src/libply-splash-graphics/ply-image.c
  13. +1
    -0
      src/libply-splash-graphics/ply-image.h
  14. +29
    -60
      src/libply-splash-graphics/ply-progress-animation.c
  15. +26
    -20
      src/libply-splash-graphics/ply-throbber.c
  16. +57
    -5
      src/libply/ply-event-loop.c
  17. +55
    -0
      src/libply/ply-key-file.c
  18. +7
    -0
      src/libply/ply-key-file.h
  19. +46
    -24
      src/main.c
  20. +1
    -1
      src/plugins/renderers/drm/plugin.c
  21. +5
    -2
      src/plugins/splash/details/plugin.c
  22. +3
    -3
      src/plugins/splash/fade-throbber/plugin.c
  23. +61
    -0
      src/plugins/splash/script/plugin.c
  24. +5
    -4
      src/plugins/splash/script/script-lib-image.c
  25. +13
    -15
      src/plugins/splash/script/script-lib-sprite.c
  26. +6
    -6
      src/plugins/splash/space-flares/plugin.c
  27. +3
    -3
      src/plugins/splash/throbgress/plugin.c
  28. +198
    -32
      src/plugins/splash/two-step/plugin.c
  29. +2
    -0
      src/ply-splash-core.pc.in
  30. +4
    -1
      themes/script/script.plymouth.in

+ 5
- 5
aclocal.m4 View File

@@ -7862,15 +7862,15 @@ m4_define([lt_dict_filter],

# Generated from ltversion.in.

# serial 3012 ltversion.m4
# serial 3017 ltversion.m4
# This file is part of GNU Libtool

m4_define([LT_PACKAGE_VERSION], [2.2.6])
m4_define([LT_PACKAGE_REVISION], [1.3012])
m4_define([LT_PACKAGE_VERSION], [2.2.6b])
m4_define([LT_PACKAGE_REVISION], [1.3017])

AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.2.6'
macro_revision='1.3012'
[macro_version='2.2.6b'
macro_revision='1.3017'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])


+ 4
- 4
build-tools/ltmain.sh View File

@@ -1,6 +1,6 @@
# Generated from ltmain.m4sh.

# ltmain.sh (GNU libtool) 2.2.6
# ltmain.sh (GNU libtool) 2.2.6b
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996

# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.2.6
# $progname: (GNU libtool) 2.2.6b
# automake: $automake_version
# autoconf: $autoconf_version
#
@@ -73,9 +73,9 @@

PROGRAM=ltmain.sh
PACKAGE=libtool
VERSION=2.2.6
VERSION=2.2.6b
TIMESTAMP=""
package_revision=1.3012
package_revision=1.3017

# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then


+ 12
- 12
configure View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for plymouth 0.8.2.
# Generated by GNU Autoconf 2.63 for plymouth 0.8.3.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth>.
#
@@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='plymouth'
PACKAGE_TARNAME='plymouth'
PACKAGE_VERSION='0.8.2'
PACKAGE_STRING='plymouth 0.8.2'
PACKAGE_VERSION='0.8.3'
PACKAGE_STRING='plymouth 0.8.3'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth'

ac_unique_file="src/main.c"
@@ -1537,7 +1537,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures plymouth 0.8.2 to adapt to many kinds of systems.
\`configure' configures plymouth 0.8.3 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -1607,7 +1607,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of plymouth 0.8.2:";;
short | recursive ) echo "Configuration of plymouth 0.8.3:";;
esac
cat <<\_ACEOF

@@ -1747,7 +1747,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
plymouth configure 0.8.2
plymouth configure 0.8.3
generated by GNU Autoconf 2.63

Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1761,7 +1761,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by plymouth $as_me 0.8.2, which was
It was created by plymouth $as_me 0.8.3, which was
generated by GNU Autoconf 2.63. Invocation command line was

$ $0 $@
@@ -5567,7 +5567,7 @@ fi

# Define the identity of the package.
PACKAGE='plymouth'
VERSION='0.8.2'
VERSION='0.8.3'


cat >>confdefs.h <<_ACEOF
@@ -5894,8 +5894,8 @@ esac



macro_version='2.2.6'
macro_revision='1.3012'
macro_version='2.2.6b'
macro_revision='1.3017'



@@ -14296,7 +14296,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by plymouth $as_me 0.8.2, which was
This file was extended by plymouth $as_me 0.8.3, which was
generated by GNU Autoconf 2.63. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
@@ -14359,7 +14359,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
plymouth config.status 0.8.2
plymouth config.status 0.8.3
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"



+ 1
- 1
configure.ac View File

@@ -1,4 +1,4 @@
AC_INIT([plymouth],[0.8.2],[https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth])
AC_INIT([plymouth],[0.8.3],[https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth])
AC_CONFIG_SRCDIR(src/main.c)
AC_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(build-tools)


+ 6
- 0
src/libply-splash-core/ply-boot-splash.c View File

@@ -665,6 +665,12 @@ ply_boot_splash_become_idle (ply_boot_splash_t *splash,
{
assert (splash->idle_trigger == NULL);

if (splash->progress != NULL)
{
ply_progress_set_percentage (splash->progress, 1.0);
ply_boot_splash_update_progress (splash);
}

ply_trace ("telling splash to become idle");
if (splash->plugin_interface->become_idle == NULL)
{


+ 123
- 13
src/libply-splash-core/ply-pixel-buffer.c View File

@@ -287,6 +287,20 @@ ply_pixel_buffer_get_size (ply_pixel_buffer_t *buffer,
*size = buffer->area;
}

unsigned long
ply_pixel_buffer_get_width (ply_pixel_buffer_t *buffer)
{
assert (buffer != NULL);
return buffer->area.width;
}

unsigned long
ply_pixel_buffer_get_height (ply_pixel_buffer_t *buffer)
{
assert (buffer != NULL);
return buffer->area.height;
}

ply_region_t *
ply_pixel_buffer_get_updated_areas (ply_pixel_buffer_t *buffer)
{
@@ -506,14 +520,14 @@ void
ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
ply_rectangle_t *clip_area,
unsigned long x,
unsigned long y,
uint32_t *data,
double opacity)
{
unsigned long row, column;
uint8_t opacity_as_byte;
ply_rectangle_t cropped_area;
unsigned long x;
unsigned long y;

assert (buffer != NULL);

@@ -528,8 +542,8 @@ ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (ply_pixel_buffer_t
if (cropped_area.width == 0 || cropped_area.height == 0)
return;

x += cropped_area.x - fill_area->x;
y += cropped_area.y - fill_area->y;
x = cropped_area.x - fill_area->x;
y = cropped_area.y - fill_area->y;
opacity_as_byte = (uint8_t) (opacity * 255.0);

for (row = y; row < y + cropped_area.height; row++)
@@ -557,27 +571,23 @@ ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (ply_pixel_buffer_t
void
ply_pixel_buffer_fill_with_argb32_data_at_opacity (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
unsigned long x,
unsigned long y,
uint32_t *data,
double opacity)
{
ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (buffer,
fill_area,
NULL, x, y,
NULL,
data, opacity);
}

void
ply_pixel_buffer_fill_with_argb32_data (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
unsigned long x,
unsigned long y,
uint32_t *data)
{
ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (buffer,
fill_area,
NULL, x, y,
NULL,
data, 1.0);
}

@@ -585,16 +595,116 @@ void
ply_pixel_buffer_fill_with_argb32_data_with_clip (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
ply_rectangle_t *clip_area,
unsigned long x,
unsigned long y,
uint32_t *data)
{
ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (buffer,
fill_area,
clip_area, x, y,
clip_area,
data, 1.0);
}

void
ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset,
ply_rectangle_t *clip_area,
float opacity)
{
unsigned long row, column;
uint8_t opacity_as_byte;
ply_rectangle_t cropped_area;
unsigned long x;
unsigned long y;

assert (canvas != NULL);
assert (source != NULL);

cropped_area.x = x_offset;
cropped_area.y = y_offset;
cropped_area.width = source->area.width;
cropped_area.height = source->area.height;

ply_pixel_buffer_crop_area_to_clip_area (canvas, &cropped_area, &cropped_area);

if (clip_area)
ply_rectangle_intersect (&cropped_area, clip_area, &cropped_area);

if (cropped_area.width == 0 || cropped_area.height == 0)
return;

x = cropped_area.x - x_offset;
y = cropped_area.y - y_offset;
opacity_as_byte = (uint8_t) (opacity * 255.0);

for (row = y; row < y + cropped_area.height; row++)
{
for (column = x; column < x + cropped_area.width; column++)
{
uint32_t pixel_value;

pixel_value = source->bytes[row * source->area.width + column];

pixel_value = make_pixel_value_translucent (pixel_value, opacity_as_byte);
if ((pixel_value >> 24) == 0x00)
continue;

ply_pixel_buffer_blend_value_at_pixel (canvas,
cropped_area.x + (column - x),
cropped_area.y + (row - y),
pixel_value);

}
}

ply_region_add_rectangle (canvas->updated_areas, &cropped_area);
}

void
ply_pixel_buffer_fill_with_buffer_at_opacity (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset,
float opacity)
{
ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (canvas,
source,
x_offset,
y_offset,
NULL,
opacity);
}

void
ply_pixel_buffer_fill_with_buffer_with_clip (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset,
ply_rectangle_t *clip_area)
{
ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (canvas,
source,
x_offset,
y_offset,
clip_area,
1.0);
}

void
ply_pixel_buffer_fill_with_buffer (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset)
{
ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (canvas,
source,
x_offset,
y_offset,
NULL,
1.0);
}

uint32_t *
ply_pixel_buffer_get_argb32_data (ply_pixel_buffer_t *buffer)
{


+ 26
- 8
src/libply-splash-core/ply-pixel-buffer.h View File

@@ -43,6 +43,10 @@ ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width,
void ply_pixel_buffer_free (ply_pixel_buffer_t *buffer);
void ply_pixel_buffer_get_size (ply_pixel_buffer_t *buffer,
ply_rectangle_t *size);

unsigned long ply_pixel_buffer_get_width (ply_pixel_buffer_t *buffer);
unsigned long ply_pixel_buffer_get_height (ply_pixel_buffer_t *buffer);

ply_region_t *ply_pixel_buffer_get_updated_areas (ply_pixel_buffer_t *buffer);

void ply_pixel_buffer_fill_with_color (ply_pixel_buffer_t *buffer,
@@ -67,30 +71,44 @@ void ply_pixel_buffer_fill_with_gradient (ply_pixel_buffer_t *buffer,

void ply_pixel_buffer_fill_with_argb32_data (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
unsigned long x,
unsigned long y,
uint32_t *data);
void ply_pixel_buffer_fill_with_argb32_data_at_opacity (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
unsigned long x,
unsigned long y,
uint32_t *data,
double opacity);

void ply_pixel_buffer_fill_with_argb32_data_with_clip (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
ply_rectangle_t *clip_area,
unsigned long x,
unsigned long y,
uint32_t *data);
void ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
ply_rectangle_t *clip_area,
unsigned long x,
unsigned long y,
uint32_t *data,
double opacity);

void ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset,
ply_rectangle_t *clip_area,
float opacity);
void ply_pixel_buffer_fill_with_buffer_at_opacity (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset,
float opacity);
void ply_pixel_buffer_fill_with_buffer_with_clip (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset,
ply_rectangle_t *clip_area);
void ply_pixel_buffer_fill_with_buffer (ply_pixel_buffer_t *canvas,
ply_pixel_buffer_t *source,
int x_offset,
int y_offset);


void ply_pixel_buffer_push_clip_area (ply_pixel_buffer_t *buffer,
ply_rectangle_t *clip_area);
void ply_pixel_buffer_pop_clip_area (ply_pixel_buffer_t *buffer);


+ 60
- 5
src/libply-splash-core/ply-terminal.c View File

@@ -61,6 +61,7 @@ struct _ply_terminal
ply_event_loop_t *loop;

struct termios original_term_attributes;
struct termios original_locked_term_attributes;

char *name;
int fd;
@@ -79,6 +80,7 @@ struct _ply_terminal
int number_of_columns;

uint32_t original_term_attributes_saved : 1;
uint32_t original_locked_term_attributes_saved : 1;
uint32_t supports_text_color : 1;
uint32_t is_open : 1;
uint32_t is_active : 1;
@@ -168,6 +170,7 @@ bool
ply_terminal_set_unbuffered_input (ply_terminal_t *terminal)
{
struct termios term_attributes;
struct termios locked_term_attributes;

tcgetattr (terminal->fd, &term_attributes);

@@ -185,6 +188,18 @@ ply_terminal_set_unbuffered_input (ply_terminal_t *terminal)
if (tcsetattr (terminal->fd, TCSANOW, &term_attributes) != 0)
return false;

if (ioctl (terminal->fd, TIOCGLCKTRMIOS, &locked_term_attributes) == 0)
{
terminal->original_locked_term_attributes = locked_term_attributes;
terminal->original_locked_term_attributes_saved = true;

memset (&locked_term_attributes, 0xff, sizeof (locked_term_attributes));
if (ioctl (terminal->fd, TIOCSLCKTRMIOS, &locked_term_attributes) < 0)
{
ply_trace ("couldn't lock terminal settings: %m");
}
}

terminal->is_unbuffered = true;

return true;
@@ -198,6 +213,16 @@ ply_terminal_set_buffered_input (ply_terminal_t *terminal)
if (!terminal->is_unbuffered)
return true;

if (terminal->original_locked_term_attributes_saved)
{
if (ioctl (terminal->fd, TIOCSLCKTRMIOS,
&terminal->original_locked_term_attributes) < 0)
{
ply_trace ("couldn't unlock terminal settings: %m");
}
terminal->original_locked_term_attributes_saved = false;
}

tcgetattr (terminal->fd, &term_attributes);

/* If someone already messed with the terminal settings,
@@ -321,7 +346,11 @@ get_active_vt (ply_terminal_t *terminal)
return -1;

if (terminal->initial_vt_number < 0)
terminal->initial_vt_number = vt_state.v_active;
{
terminal->initial_vt_number = vt_state.v_active;
ply_trace ("Remembering that initial vt is %d",
terminal->initial_vt_number);
}

return vt_state.v_active;
}
@@ -713,6 +742,16 @@ set_active_vt (ply_terminal_t *terminal,
return true;
}

static bool
wait_for_vt_to_become_active (ply_terminal_t *terminal,
int vt_number)
{
if (ioctl (terminal->fd, VT_WAITACTIVE, vt_number) < 0)
return false;

return true;
}

static bool
deallocate_vt (ply_terminal_t *terminal,
int vt_number)
@@ -723,7 +762,6 @@ deallocate_vt (ply_terminal_t *terminal,
return true;
}


bool
ply_terminal_activate_vt (ply_terminal_t *terminal)
{
@@ -736,7 +774,11 @@ ply_terminal_activate_vt (ply_terminal_t *terminal)
return true;

if (!set_active_vt (terminal, terminal->vt_number))
return false;
{
ply_trace ("unable to set active vt to %d: %m",
terminal->vt_number);
return false;
}

return true;
}
@@ -775,16 +817,29 @@ ply_terminal_deactivate_vt (ply_terminal_t *terminal)

if (ply_terminal_is_active (terminal))
{
ply_trace ("Attempting to set active vt back to %d from %d",
terminal->initial_vt_number, old_vt_number);
if (!set_active_vt (terminal, terminal->initial_vt_number))
{
ply_trace ("Couldn't number to initial VT");
ply_trace ("Couldn't move console to initial vt: %m");
return false;
}

if (!wait_for_vt_to_become_active (terminal, terminal->initial_vt_number))
{
ply_trace ("Error while waiting for vt %d to become active: %m",
terminal->initial_vt_number);
return false;
}
}
else
{
ply_trace ("terminal for vt %d is inactive", terminal->vt_number);
}

if (!deallocate_vt (terminal, old_vt_number))
{
ply_trace ("Couldn't deallocate vt %d", old_vt_number);
ply_trace ("couldn't deallocate vt %d: %m", old_vt_number);
return false;
}



+ 18
- 18
src/libply-splash-graphics/ply-animation.c View File

@@ -104,11 +104,11 @@ static void
ply_animation_remove_frames (ply_animation_t *animation)
{
int i;
ply_image_t **frames;
ply_pixel_buffer_t **frames;

frames = (ply_image_t **) ply_array_steal_elements (animation->frames);
frames = (ply_pixel_buffer_t **) ply_array_steal_elements (animation->frames);
for (i = 0; frames[i] != NULL; i++)
ply_image_free (frames[i]);
ply_pixel_buffer_free (frames[i]);
free (frames);
}

@@ -131,7 +131,7 @@ animate_at_time (ply_animation_t *animation,
double time)
{
int number_of_frames;
ply_image_t * const * frames;
ply_pixel_buffer_t * const * frames;
bool should_continue;

number_of_frames = ply_array_get_size (animation->frames);
@@ -147,12 +147,10 @@ animate_at_time (ply_animation_t *animation,
if (animation->stop_requested)
should_continue = false;

frames = (ply_image_t * const *) ply_array_get_elements (animation->frames);
frames = (ply_pixel_buffer_t * const *) ply_array_get_elements (animation->frames);
ply_pixel_buffer_get_size (frames[animation->frame_number], &animation->frame_area);
animation->frame_area.x = animation->x;
animation->frame_area.y = animation->y;
animation->frame_area.width = ply_image_get_width (frames[animation->frame_number]);
animation->frame_area.height = ply_image_get_height (frames[animation->frame_number]);

ply_pixel_display_draw_area (animation->display,
animation->x, animation->y,
@@ -207,6 +205,7 @@ ply_animation_add_frame (ply_animation_t *animation,
const char *filename)
{
ply_image_t *image;
ply_pixel_buffer_t *frame;

image = ply_image_new (filename);

@@ -216,10 +215,12 @@ ply_animation_add_frame (ply_animation_t *animation,
return false;
}

ply_array_add_element (animation->frames, image);
frame = ply_image_convert_to_pixel_buffer (image);

ply_array_add_element (animation->frames, frame);

animation->width = MAX (animation->width, ply_image_get_width (image));
animation->height = MAX (animation->height, ply_image_get_height (image));
animation->width = MAX (animation->width, ply_pixel_buffer_get_width (frame));
animation->height = MAX (animation->height, ply_pixel_buffer_get_height (frame));

return true;
}
@@ -365,7 +366,7 @@ ply_animation_draw_area (ply_animation_t *animation,
unsigned long width,
unsigned long height)
{
ply_image_t * const * frames;
ply_pixel_buffer_t * const * frames;
uint32_t *frame_data;
int number_of_frames;
int frame_index;
@@ -376,12 +377,11 @@ ply_animation_draw_area (ply_animation_t *animation,
number_of_frames = ply_array_get_size (animation->frames);
frame_index = MIN(animation->frame_number, number_of_frames - 1);

frames = (ply_image_t * const *) ply_array_get_elements (animation->frames);
frame_data = ply_image_get_data (frames[frame_index]);

ply_pixel_buffer_fill_with_argb32_data (buffer,
&animation->frame_area, 0, 0,
frame_data);
frames = (ply_pixel_buffer_t * const *) ply_array_get_elements (animation->frames);
ply_pixel_buffer_fill_with_buffer (buffer,
frames[frame_index],
animation->frame_area.x,
animation->frame_area.y);
}

long


+ 40
- 17
src/libply-splash-graphics/ply-entry.c View File

@@ -94,6 +94,7 @@ ply_entry_new (const char *image_dir)
entry->bullet_image = ply_image_new (image_path);
free (image_path);
entry->label = ply_label_new ();
ply_label_set_color (entry->label, 0, 0, 0, 1);

entry->number_of_bullets = 0;
entry->text = strdup("");
@@ -165,25 +166,26 @@ ply_entry_draw_area (ply_entry_t *entry,
unsigned long height)
{
ply_rectangle_t bullet_area;
uint32_t *text_field_data, *bullet_data;
ply_rectangle_t clip_area;
ply_pixel_buffer_t *bullet_buffer, *text_field_buffer;
int i, number_of_visible_bullets;

if (entry->is_hidden)
return;

text_field_data = ply_image_get_data (entry->text_field_image);
text_field_buffer = ply_image_get_buffer (entry->text_field_image);

ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&entry->area, 0, 0,
text_field_data);
ply_pixel_buffer_fill_with_buffer (pixel_buffer,
text_field_buffer,
entry->area.x,
entry->area.y);

if (entry->is_password)
{
bullet_data = ply_image_get_data (entry->bullet_image);
bullet_area.width = ply_image_get_width (entry->bullet_image);
bullet_area.height = ply_image_get_height (entry->bullet_image);
bullet_buffer = ply_image_get_buffer (entry->bullet_image);
ply_pixel_buffer_get_size (bullet_buffer, &bullet_area);

if (entry->number_of_bullets < entry->max_number_of_visible_bullets)
if (entry->number_of_bullets <= entry->max_number_of_visible_bullets)
number_of_visible_bullets = entry->number_of_bullets;
else
{
@@ -192,12 +194,16 @@ ply_entry_draw_area (ply_entry_t *entry,
/* We've got more bullets than we can show in the available space, so
* draw a little half bullet to indicate some bullets are offscreen
*/
bullet_area.x = entry->area.x;
bullet_area.x = entry->area.x - bullet_area.width / 2.0;
bullet_area.y = entry->area.y + entry->area.height / 2.0 - bullet_area.height / 2.0;

ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&bullet_area, bullet_area.width / 2.0, 0,
bullet_data);
clip_area = bullet_area;
clip_area.x = entry->area.x;
ply_pixel_buffer_fill_with_buffer_with_clip (pixel_buffer,
bullet_buffer,
bullet_area.x,
bullet_area.y,
&clip_area);
}

for (i = 0; i < number_of_visible_bullets; i++)
@@ -205,14 +211,20 @@ ply_entry_draw_area (ply_entry_t *entry,
bullet_area.x = entry->area.x + i * bullet_area.width + bullet_area.width / 2.0;
bullet_area.y = entry->area.y + entry->area.height / 2.0 - bullet_area.height / 2.0;

ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&bullet_area, 0, 0,
bullet_data);
ply_pixel_buffer_fill_with_buffer (pixel_buffer,
bullet_buffer,
bullet_area.x,
bullet_area.y);
}
}
else
{
ply_label_set_text (entry->label, entry->text);
ply_label_show (entry->label,
NULL,
entry->area.x,
entry->area.y + entry->area.height / 2
- ply_label_get_height (entry->label) / 2);
ply_label_draw_area (entry->label, pixel_buffer,
entry->area.x, entry->area.y,
entry->area.width, entry->area.height);
@@ -267,6 +279,17 @@ ply_entry_set_text (ply_entry_t *entry, const char* text)
}
}

void
ply_entry_set_text_color (ply_entry_t *entry,
float red,
float green,
float blue,
float alpha)
{
ply_label_set_color (entry->label, red, green, blue, alpha);
}


void
ply_entry_show (ply_entry_t *entry,
ply_event_loop_t *loop,


+ 5
- 0
src/libply-splash-graphics/ply-entry.h View File

@@ -60,6 +60,11 @@ void ply_entry_add_bullet (ply_entry_t *entry);
void ply_entry_remove_bullet (ply_entry_t *entry);
void ply_entry_remove_all_bullets (ply_entry_t *entry);
void ply_entry_set_text (ply_entry_t *entry, const char* text);
void ply_entry_set_text_color (ply_entry_t *entry,
float red,
float green,
float blue,
float alpha);

#endif



+ 11
- 1
src/libply-splash-graphics/ply-image.c View File

@@ -255,11 +255,21 @@ ply_image_rotate (ply_image_t *image,
return new_image;
}

ply_pixel_buffer_t *
ply_image_get_buffer (ply_image_t *image)
{
assert (image != NULL);

return image->buffer;
}

ply_pixel_buffer_t *
ply_image_convert_to_pixel_buffer (ply_image_t *image)
{
ply_pixel_buffer_t *buffer;

assert (image != NULL);

buffer = image->buffer;
image->buffer = NULL;
ply_image_free (image);


+ 1
- 0
src/libply-splash-graphics/ply-image.h View File

@@ -39,6 +39,7 @@ long ply_image_get_width (ply_image_t *image);
long ply_image_get_height (ply_image_t *image);
ply_image_t *ply_image_resize (ply_image_t *image, long width, long height);
ply_image_t *ply_image_rotate (ply_image_t *oldimage, long center_x, long center_y, double theta_offset);
ply_pixel_buffer_t *ply_image_get_buffer (ply_image_t *image);
ply_pixel_buffer_t *ply_image_convert_to_pixel_buffer (ply_image_t *image);

#endif


+ 29
- 60
src/libply-splash-graphics/ply-progress-animation.c View File

@@ -193,16 +193,13 @@ ply_progress_animation_draw_area (ply_progress_animation_t *progress_animation,
unsigned long width,
unsigned long height)
{
uint32_t *frame_data;

if (progress_animation->is_hidden)
return;

frame_data = ply_pixel_buffer_get_argb32_data (progress_animation->last_rendered_frame);

ply_pixel_buffer_fill_with_argb32_data (buffer,
&progress_animation->frame_area, 0, 0,
frame_data);
ply_pixel_buffer_fill_with_buffer (buffer,
progress_animation->last_rendered_frame,
progress_animation->frame_area.x,
progress_animation->frame_area.y);
}

void
@@ -211,7 +208,7 @@ ply_progress_animation_draw (ply_progress_animation_t *progress_animation)
int number_of_frames;
int frame_number;
ply_image_t * const * frames;
uint32_t *previous_frame_data, *frame_data;
ply_pixel_buffer_t *previous_frame_buffer, *current_frame_buffer;

if (progress_animation->is_hidden)
return;
@@ -235,7 +232,7 @@ ply_progress_animation_draw (ply_progress_animation_t *progress_animation)

progress_animation->frame_area.x = progress_animation->area.x;
progress_animation->frame_area.y = progress_animation->area.y;
frame_data = ply_image_get_data (frames[frame_number]);
current_frame_buffer = ply_image_get_buffer (frames[frame_number]);

if (progress_animation->is_transitioning)
{
@@ -255,7 +252,7 @@ ply_progress_animation_draw (ply_progress_animation_t *progress_animation)
if (progress_animation->transition == PLY_PROGRESS_ANIMATION_TRANSITION_MERGE_FADE)
{
width = MAX(ply_image_get_width (frames[frame_number]), ply_image_get_width (frames[frame_number - 1]));
height = MAX(ply_image_get_height (frames[frame_number]), ply_image_get_width (frames[frame_number - 1]));
height = MAX(ply_image_get_height (frames[frame_number]), ply_image_get_height (frames[frame_number - 1]));
progress_animation->frame_area.width = width;
progress_animation->frame_area.height = height;

@@ -264,82 +261,54 @@ ply_progress_animation_draw (ply_progress_animation_t *progress_animation)
faded_data = ply_pixel_buffer_get_argb32_data (progress_animation->last_rendered_frame);

image_fade_merge (frames[frame_number - 1], frames[frame_number], fade_percentage, width, height, faded_data);

ply_pixel_display_draw_area (progress_animation->display,
progress_animation->frame_area.x,
progress_animation->frame_area.y,
progress_animation->frame_area.width,
progress_animation->frame_area.height);
}
else
{
ply_rectangle_t fill_area;

previous_frame_data = ply_image_get_data (frames[frame_number - 1]);
previous_frame_buffer = ply_image_get_buffer (frames[frame_number - 1]);
if (progress_animation->transition == PLY_PROGRESS_ANIMATION_TRANSITION_FADE_OVER)
{
ply_pixel_buffer_free (progress_animation->last_rendered_frame);
progress_animation->frame_area.width = ply_image_get_width (frames[frame_number - 1]);
progress_animation->frame_area.height = ply_image_get_height (frames[frame_number - 1]);

progress_animation->last_rendered_frame = ply_pixel_buffer_new (progress_animation->frame_area.width,
progress_animation->frame_area.height);
fill_area.x = 0;
fill_area.y = 0;
fill_area.width = progress_animation->frame_area.width;
fill_area.height = progress_animation->frame_area.height;
ply_pixel_buffer_fill_with_argb32_data (progress_animation->last_rendered_frame,
&fill_area, 0, 0,
previous_frame_data);
progress_animation->last_rendered_frame = ply_pixel_buffer_new (ply_image_get_width (frames[frame_number - 1]),
ply_image_get_height (frames[frame_number - 1]));
ply_pixel_buffer_fill_with_buffer (progress_animation->last_rendered_frame,
previous_frame_buffer,
0,
0);
}
else
{
fade_out_opacity = 1.0 - fade_percentage;
progress_animation->frame_area.width = ply_image_get_width (frames[frame_number - 1]);
progress_animation->frame_area.height = ply_image_get_height (frames[frame_number - 1]);

fill_area.x = 0;
fill_area.y = 0;
fill_area.width = progress_animation->frame_area.width;
fill_area.height = progress_animation->frame_area.height;
ply_pixel_buffer_fill_with_argb32_data_at_opacity (progress_animation->last_rendered_frame,
&fill_area, 0, 0,
previous_frame_data, fade_out_opacity);
ply_pixel_buffer_fill_with_buffer_at_opacity (progress_animation->last_rendered_frame,
previous_frame_buffer,
0,
0,
fade_out_opacity);
}

progress_animation->frame_area.width = ply_image_get_width (frames[frame_number]);
progress_animation->frame_area.height = ply_image_get_height (frames[frame_number]);
fill_area.x = 0;
fill_area.y = 0;
fill_area.width = progress_animation->frame_area.width;
fill_area.height = progress_animation->frame_area.height;
ply_pixel_buffer_fill_with_argb32_data_at_opacity (progress_animation->last_rendered_frame,
&fill_area, 0, 0,
frame_data, fade_percentage);
ply_pixel_buffer_fill_with_buffer_at_opacity (progress_animation->last_rendered_frame,
current_frame_buffer,
0,
0,
fade_percentage);

width = MAX(ply_image_get_width (frames[frame_number]), ply_image_get_width (frames[frame_number - 1]));
height = MAX(ply_image_get_height (frames[frame_number]), ply_image_get_width (frames[frame_number - 1]));
height = MAX(ply_image_get_height (frames[frame_number]), ply_image_get_height (frames[frame_number - 1]));
progress_animation->frame_area.width = width;
progress_animation->frame_area.height = height;
}
}
else
{
ply_rectangle_t fill_area;

ply_pixel_buffer_free (progress_animation->last_rendered_frame);
progress_animation->frame_area.width = ply_image_get_width (frames[frame_number]);
progress_animation->frame_area.height = ply_image_get_height (frames[frame_number]);
progress_animation->last_rendered_frame = ply_pixel_buffer_new (progress_animation->frame_area.width,
progress_animation->frame_area.height);

fill_area.x = 0;
fill_area.y = 0;
fill_area.width = progress_animation->frame_area.width;
fill_area.height = progress_animation->frame_area.height;
ply_pixel_buffer_fill_with_argb32_data (progress_animation->last_rendered_frame,
&fill_area, 0, 0,
frame_data);
ply_pixel_buffer_fill_with_buffer (progress_animation->last_rendered_frame,
current_frame_buffer,
0,
0);
}

progress_animation->previous_frame_number = frame_number;


+ 26
- 20
src/libply-splash-graphics/ply-throbber.c View File

@@ -55,6 +55,10 @@
#define FRAMES_PER_SECOND 30
#endif

#ifndef THROBBER_DURATION
#define THROBBER_DURATION 2.0
#endif

struct _ply_throbber
{
ply_array_t *frames;
@@ -104,11 +108,11 @@ static void
ply_throbber_remove_frames (ply_throbber_t *throbber)
{
int i;
ply_image_t **frames;
ply_pixel_buffer_t **frames;

frames = (ply_image_t **) ply_array_steal_elements (throbber->frames);
frames = (ply_pixel_buffer_t **) ply_array_steal_elements (throbber->frames);
for (i = 0; frames[i] != NULL; i++)
ply_image_free (frames[i]);
ply_pixel_buffer_free (frames[i]);
free (frames);
}

@@ -131,8 +135,9 @@ animate_at_time (ply_throbber_t *throbber,
double time)
{
int number_of_frames;
ply_image_t * const * frames;
ply_pixel_buffer_t * const * frames;
bool should_continue;
double percent_in_sequence;

number_of_frames = ply_array_get_size (throbber->frames);

@@ -140,8 +145,8 @@ animate_at_time (ply_throbber_t *throbber,
return true;

should_continue = true;
throbber->frame_number = (.5 * sin (time) + .5) * number_of_frames;
percent_in_sequence = fmod (time, THROBBER_DURATION) / THROBBER_DURATION;
throbber->frame_number = (int) (number_of_frames * percent_in_sequence);

if (throbber->stop_trigger != NULL)
{
@@ -149,12 +154,10 @@ animate_at_time (ply_throbber_t *throbber,
should_continue = false;
}

frames = (ply_image_t * const *) ply_array_get_elements (throbber->frames);
frames = (ply_pixel_buffer_t * const *) ply_array_get_elements (throbber->frames);
ply_pixel_buffer_get_size (frames[throbber->frame_number], &throbber->frame_area);
throbber->frame_area.x = throbber->x;
throbber->frame_area.y = throbber->y;
throbber->frame_area.width = ply_image_get_width (frames[throbber->frame_number]);
throbber->frame_area.height = ply_image_get_height (frames[throbber->frame_number]);
ply_pixel_display_draw_area (throbber->display,
throbber->x, throbber->y,
throbber->frame_area.width,
@@ -185,6 +188,7 @@ on_timeout (ply_throbber_t *throbber)

if (!should_continue)
{
throbber->is_stopped = true;
if (throbber->stop_trigger != NULL)
{
ply_trigger_pull (throbber->stop_trigger, NULL);
@@ -202,9 +206,10 @@ on_timeout (ply_throbber_t *throbber)

static bool
ply_throbber_add_frame (ply_throbber_t *throbber,
const char *filename)
const char *filename)
{
ply_image_t *image;
ply_pixel_buffer_t *frame;

image = ply_image_new (filename);

@@ -214,10 +219,12 @@ ply_throbber_add_frame (ply_throbber_t *throbber,
return false;
}

ply_array_add_element (throbber->frames, image);
frame = ply_image_convert_to_pixel_buffer (image);

ply_array_add_element (throbber->frames, frame);

throbber->width = MAX (throbber->width, ply_image_get_width (image));
throbber->height = MAX (throbber->height, ply_image_get_height (image));
throbber->width = MAX (throbber->width, ply_pixel_buffer_get_width (frame));
throbber->height = MAX (throbber->height, ply_pixel_buffer_get_height (frame));

return true;
}
@@ -365,18 +372,17 @@ ply_throbber_draw_area (ply_throbber_t *throbber,
unsigned long width,
unsigned long height)
{
ply_image_t * const * frames;
ply_pixel_buffer_t * const * frames;
uint32_t *frame_data;

if (throbber->is_stopped)
return;

frames = (ply_image_t * const *) ply_array_get_elements (throbber->frames);
frame_data = ply_image_get_data (frames[throbber->frame_number]);

ply_pixel_buffer_fill_with_argb32_data (buffer,
&throbber->frame_area, 0, 0,
frame_data);
ply_pixel_buffer_fill_with_buffer (buffer,
frames[throbber->frame_number],
throbber->frame_area.x,
throbber->frame_area.y);
}

long


+ 57
- 5
src/libply/ply-event-loop.c View File

@@ -56,6 +56,7 @@ typedef struct
ply_list_t *fd_watches;
uint32_t is_getting_polled : 1;
uint32_t is_disconnected : 1;
int reference_count;
} ply_event_source_t;

typedef struct
@@ -319,6 +320,12 @@ ply_fd_watch_free (ply_fd_watch_t *watch)
free (watch);
}

static void
ply_event_source_take_reference (ply_event_source_t *source)
{
source->reference_count++;
}

static ply_event_source_t *
ply_event_source_new (int fd)
{
@@ -331,6 +338,7 @@ ply_event_source_new (int fd)
source->fd_watches = ply_list_new ();
source->is_getting_polled = false;
source->is_disconnected = false;
source->reference_count = 0;

return source;
}
@@ -348,6 +356,22 @@ ply_event_source_free (ply_event_source_t *source)
free (source);
}

static void
ply_event_source_drop_reference (ply_event_source_t *source)
{
if (source == NULL)
return;

source->reference_count--;

assert (source->reference_count >= 0);

if (source->reference_count == 0)
{
ply_event_source_free (source);
}
}

static void
ply_event_loop_update_source_event_mask (ply_event_loop_t *loop,
ply_event_source_t *source)
@@ -404,6 +428,7 @@ ply_event_loop_add_destination_for_source (ply_event_loop_t *loop,
assert (source != NULL);

destination->source = source;
ply_event_source_take_reference (source);
destination_node = ply_list_append_data (source->destinations, destination);
assert (destination_node != NULL);
assert (destination->source == source);
@@ -412,6 +437,7 @@ ply_event_loop_add_destination_for_source (ply_event_loop_t *loop,

watch = ply_fd_watch_new (destination);

ply_event_source_take_reference (source);
ply_list_append_data (source->fd_watches, watch);

return watch;
@@ -449,6 +475,7 @@ ply_event_loop_remove_destination_by_fd_watch (ply_event_loop_t *loop,
assert (source != NULL);

ply_list_remove_data (source->destinations, destination);
ply_event_source_drop_reference (source);
assert (ply_list_find_node (source->destinations, destination) == NULL);
ply_event_loop_update_source_event_mask (loop, source);
}
@@ -601,6 +628,7 @@ ply_event_loop_add_source (ply_event_loop_t *loop,

source->is_getting_polled = true;

ply_event_source_take_reference (source);
ply_list_append_data (loop->sources, source);
}

@@ -622,6 +650,7 @@ ply_event_loop_remove_source_node (ply_event_loop_t *loop,
}

ply_list_remove_node (loop->sources, source_node);
ply_event_source_drop_reference (source);
}

static void
@@ -749,6 +778,7 @@ ply_event_loop_stop_watching_fd (ply_event_loop_t *loop,
{
ply_trace ("source for fd %d is already disconnected", source->fd);
ply_list_remove_data (source->fd_watches, watch);
ply_event_source_drop_reference (source);
ply_fd_watch_free (watch);
return;
}
@@ -757,6 +787,7 @@ ply_event_loop_stop_watching_fd (ply_event_loop_t *loop,
ply_event_loop_remove_destination_by_fd_watch (loop, watch);

ply_list_remove_data (source->fd_watches, watch);
ply_event_source_drop_reference (source);
ply_fd_watch_free (watch);
ply_event_destination_free (destination);

@@ -764,8 +795,6 @@ ply_event_loop_stop_watching_fd (ply_event_loop_t *loop,
{
ply_trace ("no more destinations remaing for fd %d, removing source", source->fd);
ply_event_loop_remove_source (loop, source);
ply_trace ("freeing source for fd %d", source->fd);
ply_event_source_free (source);
}
}

@@ -1083,6 +1112,7 @@ ply_event_loop_free_watches_for_source (ply_event_loop_t *loop,
assert (watch != NULL);
ply_fd_watch_free (watch);
ply_list_remove_node (source->fd_watches, node);
ply_event_source_drop_reference (source);
node = next_node;
}
}
@@ -1142,6 +1172,7 @@ ply_event_loop_free_destinations_for_source (ply_event_loop_t *loop,
ply_event_destination_free (destination);

ply_list_remove_node (source->destinations, node);
ply_event_source_drop_reference (source);
node = next_node;
}
}
@@ -1169,9 +1200,6 @@ ply_event_loop_disconnect_source (ply_event_loop_t *loop,
ply_trace ("removing source with fd %d from event loop", source->fd);
ply_event_loop_remove_source (loop, source);
ply_trace ("done removing source with fd %d from event loop", source->fd);

ply_trace ("freeing source with fd %d", source->fd);
ply_event_source_free (source);
}

static void
@@ -1261,6 +1289,19 @@ ply_event_loop_process_pending_events (ply_event_loop_t *loop)
}
while ((number_of_received_events < 0) && ((errno == EINTR) || (errno == EAGAIN)));

/* first reference all sources, so they stay alive for the duration of this
* iteration of the loop
*/
for (i = 0; i < number_of_received_events; i++)
{
ply_event_source_t *source;
source = (ply_event_source_t *) (events[i].data.ptr);

ply_event_source_take_reference (source);
}

/* Then process the incoming events
*/
for (i = 0; i < number_of_received_events; i++)
{
ply_event_source_t *source;
@@ -1293,6 +1334,17 @@ ply_event_loop_process_pending_events (ply_event_loop_t *loop)
if (loop->should_exit)
break;
}

/* Finally, kill off any unused sources
*/
for (i = 0; i < number_of_received_events; i++)
{
ply_event_source_t *source;

source = (ply_event_source_t *) (events[i].data.ptr);

ply_event_source_drop_reference (source);
}
}

void


+ 55
- 0
src/libply/ply-key-file.c View File

@@ -60,6 +60,13 @@ struct _ply_key_file
ply_hashtable_t *groups;
};

typedef struct
{
ply_key_file_foreach_func_t *func;
void *user_data;
char *group_name;
} ply_key_file_foreach_func_data_t;

static bool ply_key_file_open_file (ply_key_file_t *key_file);
static void ply_key_file_close_file (ply_key_file_t *key_file);

@@ -357,4 +364,52 @@ ply_key_file_get_value (ply_key_file_t *key_file,
return strdup (entry->value);
}

static void
ply_key_file_foreach_entry_entries (void *key,
void *data,
void *user_data)
{
ply_key_file_entry_t *entry;
ply_key_file_foreach_func_data_t *func_data;

func_data = user_data;
entry = data;

func_data->func(func_data->group_name,
entry->key,
entry->value,
func_data->user_data);
}

static void
ply_key_file_foreach_entry_groups (void *key,
void *data,
void *user_data)
{
ply_key_file_group_t *group;
ply_key_file_foreach_func_data_t *func_data;

func_data = user_data;
group = data;
func_data->group_name = group->name;

ply_hashtable_foreach (group->entries,
ply_key_file_foreach_entry_entries,
func_data);
}

void
ply_key_file_foreach_entry (ply_key_file_t *key_file,
ply_key_file_foreach_func_t func,
void *user_data)
{
ply_key_file_foreach_func_data_t func_data;

func_data.func = func;
func_data.user_data = user_data;
ply_hashtable_foreach (key_file->groups,
ply_key_file_foreach_entry_groups,
&func_data);
}

/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */

+ 7
- 0
src/libply/ply-key-file.h View File

@@ -27,6 +27,10 @@
#include <unistd.h>

typedef struct _ply_key_file ply_key_file_t;
typedef void (ply_key_file_foreach_func_t) (const char *group_name,
const char *key,
const char *value,
void *user_data);

#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
ply_key_file_t *ply_key_file_new (const char *filename);
@@ -38,6 +42,9 @@ bool ply_key_file_has_key (ply_key_file_t *key_file,
char *ply_key_file_get_value (ply_key_file_t *key_file,
const char *group_name,
const char *key);
void ply_key_file_foreach_entry (ply_key_file_t *key_file,
ply_key_file_foreach_func_t func,
void *user_data);
#endif

#endif /* PLY_KEY_FILE_H */


+ 46
- 24
src/main.c View File

@@ -91,6 +91,7 @@ typedef struct
ply_list_t *keystroke_triggers;
ply_list_t *entry_triggers;
ply_buffer_t *entry_buffer;
ply_list_t *messages;
ply_command_parser_t *command_parser;
ply_mode_t mode;
ply_renderer_t *renderer;
@@ -171,6 +172,23 @@ on_update (state_t *state,
status);
}

static void
show_messages (state_t *state)
{
ply_list_node_t *node = ply_list_get_first_node (state->messages);
while (node != NULL)
{
ply_list_node_t *next_node;
char *message = ply_list_node_get_data (node);

ply_trace ("displaying messages");

ply_boot_splash_display_message (state->boot_splash, message);
next_node = ply_list_get_next_node (state->messages, node);
node = next_node;
}
}

static void
show_detailed_splash (state_t *state)
{
@@ -203,10 +221,8 @@ find_override_splash (state_t *state)
char *end;
splash_string = strdup (splash_string + strlen ("plymouth:splash="));

end = strstr (splash_string, " ");

if (end != NULL)
*end = '\0';
end = splash_string + strcspn (splash_string, " \n");
*end = '\0';

ply_trace ("Splash is configured to be '%s'", splash_string);

@@ -374,6 +390,7 @@ on_display_message (state_t *state,
ply_trace ("displaying message %s", message);
if (state->boot_splash != NULL)
ply_boot_splash_display_message (state->boot_splash, message);
ply_list_append_data (state->messages, strdup(message));
}

static void
@@ -670,7 +687,6 @@ remove_displays_and_keyboard (state_t *state)
if (state->keyboard != NULL)
{
ply_trace ("removing keyboard");
ply_keyboard_stop_watching_for_input (state->keyboard);
ply_keyboard_free (state->keyboard);
state->keyboard = NULL;
}
@@ -720,6 +736,7 @@ on_show_splash (state_t *state)
show_detailed_splash (state);
state->showing_details = true;
}
show_messages (state);
}

static void
@@ -845,12 +862,6 @@ deactivate_splash (state_t *state)
ply_renderer_deactivate (state->renderer);
}

if (state->keyboard != NULL)
{
ply_trace ("deactivating keyboard");
ply_keyboard_stop_watching_for_input (state->keyboard);
}

if ((state->session != NULL) && state->is_attached)
{
ply_trace ("deactivating terminal session");
@@ -921,6 +932,13 @@ on_deactivate (state_t *state,
state->deactivate_trigger = deactivate_trigger;

ply_trace ("deactivating");

if (state->keyboard != NULL)
{
ply_trace ("deactivating keyboard");
ply_keyboard_stop_watching_for_input (state->keyboard);
}

if (state->boot_splash != NULL)
{
ply_boot_splash_become_idle (state->boot_splash,
@@ -985,14 +1003,24 @@ on_quit (state_t *state,
return;
}

if (state->system_initialized)
ply_progress_save_cache (state->progress,
get_cache_file_for_mode (state->mode));

state->quit_trigger = quit_trigger;
state->should_retain_splash = retain_splash;

ply_trace ("time to quit, closing log");
if (state->session != NULL)
ply_terminal_session_close_log (state->session);
ply_trace ("unloading splash");

if (state->keyboard != NULL)
{
ply_trace ("deactivating keyboard");
ply_keyboard_stop_watching_for_input (state->keyboard);
}

ply_trace ("unloading splash");
if (state->is_inactive && !retain_splash)
{
/* We've been deactivated and X failed to start
@@ -1117,6 +1145,7 @@ toggle_between_splash_and_details (state_t *state)
state->showing_details = false;
}
update_display (state);
show_messages (state);
}

static void
@@ -1263,7 +1292,6 @@ add_display_and_keyboard_for_terminal (state_t *state,
display = ply_text_display_new (state->terminal);

ply_list_append_data (state->text_displays, display);
state->keyboard = keyboard;
set_keyboard (state, keyboard);
}

@@ -1515,8 +1543,8 @@ check_verbosity (state_t *state)
path = NULL;
if ((strstr (state->kernel_command_line, " plymouth:debug ") != NULL)
|| (strstr (state->kernel_command_line, "plymouth:debug ") != NULL)
|| (strstr (state->kernel_command_line, " plymouth:debug") != NULL)
|| (path = strstr (state->kernel_command_line, " plymouth:debug=file:")) != NULL)
|| (path = strstr (state->kernel_command_line, " plymouth:debug=file:")) != NULL
|| (strstr (state->kernel_command_line, " plymouth:debug") != NULL))
{
#ifdef LOG_TO_DEBUG_FILE
int fd;
@@ -1532,12 +1560,8 @@ check_verbosity (state_t *state)

path += strlen (" plymouth:debug=file:");
debug_buffer_path = strdup (path);
end = strstr (debug_buffer_path, " ");

if (end != NULL)
*end = '\0';

debug_buffer_path = path;
end = debug_buffer_path + strcspn (debug_buffer_path, " \n");
*end = '\0';
}

if (debug_buffer == NULL)
@@ -1674,6 +1698,7 @@ initialize_environment (state_t *state)
state->entry_buffer = ply_buffer_new();
state->pixel_displays = ply_list_new ();
state->text_displays = ply_list_new ();
state->messages = ply_list_new ();
state->keyboard = NULL;

if (!state->default_tty)
@@ -1938,9 +1963,6 @@ main (int argc,
exit_code = ply_event_loop_run (state.loop);
ply_trace ("exited event loop");

ply_progress_save_cache (state.progress,
get_cache_file_for_mode (state.mode));

ply_boot_splash_free (state.boot_splash);
state.boot_splash = NULL;



+ 1
- 1
src/plugins/renderers/drm/plugin.c View File

@@ -42,7 +42,7 @@
#include <values.h>
#include <unistd.h>

#include <drm/drm.h>
#include <drm.h>
#include <xf86drm.h>
#include <xf86drmMode.h>



+ 5
- 2
src/plugins/splash/details/plugin.c View File

@@ -250,9 +250,12 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
detach_from_event_loop,
plugin);

size = ply_buffer_get_size (boot_buffer);
if (boot_buffer)
{
size = ply_buffer_get_size (boot_buffer);

write_on_views (plugin, ply_buffer_get_bytes (boot_buffer), size);
write_on_views (plugin, ply_buffer_get_bytes (boot_buffer), size);
}

return true;
}


+ 3
- 3
src/plugins/splash/fade-throbber/plugin.c View File

@@ -697,14 +697,14 @@ draw_normal_view (view_t *view,
star_area.x = star->x;
star_area.y = star->y;
ply_pixel_buffer_fill_with_argb32_data_at_opacity (pixel_buffer,
&star_area, 0, 0,
&star_area,
star_data,
star->opacity);
node = next_node;
}

ply_pixel_buffer_fill_with_argb32_data_at_opacity (pixel_buffer,
&logo_area, 0, 0,
&logo_area,
logo_data,
view->logo_opacity);
}
@@ -731,7 +731,7 @@ draw_prompt_view (view_t *view,

lock_data = ply_image_get_data (plugin->lock_image);
ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&view->lock_area, 0, 0,
&view->lock_area,
lock_data);
}



+ 61
- 0
src/plugins/splash/script/plugin.c View File

@@ -79,6 +79,7 @@ struct _ply_boot_splash_plugin
char *script_filename;
char *image_dir;

ply_list_t *script_env_vars;
script_op_t *script_main_op;

script_state_t *script_state;
@@ -91,6 +92,12 @@ struct _ply_boot_splash_plugin
uint32_t is_animating : 1;
};

typedef struct
{
char *key;
char *value;
} script_env_var_t;

static void detach_from_event_loop (ply_boot_splash_plugin_t *plugin);
static void stop_animation (ply_boot_splash_plugin_t *plugin);
ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void);
@@ -138,6 +145,26 @@ unpause_displays (ply_boot_splash_plugin_t *plugin)
}
}

static void
add_script_env_var (const char *group_name,
const char *key,
const char *value,
void *user_data)
{
ply_list_t *script_env_vars;
script_env_var_t *new_env_var;

if (strcmp (group_name, "script-env-vars") != 0)
return;

script_env_vars = user_data;
new_env_var = malloc (sizeof (script_env_var_t));
new_env_var->key = strdup (key);
new_env_var->value = strdup (value);

ply_list_append_data (script_env_vars, new_env_var);
}

static ply_boot_splash_plugin_t *
create_plugin (ply_key_file_t *key_file)
{
@@ -149,6 +176,10 @@ create_plugin (ply_key_file_t *key_file)
plugin->script_filename = ply_key_file_get_value (key_file,
"script",
"ScriptFile");

plugin->script_env_vars = ply_list_new ();
ply_key_file_foreach_entry (key_file, add_script_env_var, plugin->script_env_vars);

plugin->displays = ply_list_new ();
return plugin;
}
@@ -156,6 +187,9 @@ create_plugin (ply_key_file_t *key_file)
static void
destroy_plugin (ply_boot_splash_plugin_t *plugin)
{
ply_list_node_t *node;
script_env_var_t *env_var;

if (plugin == NULL)
return;

@@ -169,6 +203,16 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
detach_from_event_loop (plugin);
}

for (node = ply_list_get_first_node (plugin->script_env_vars);
node != NULL;
node = ply_list_get_next_node (plugin->script_env_vars, node))
{
env_var = ply_list_node_get_data (node);
free (env_var->key);
free (env_var->value);
free (env_var);
}
ply_list_free (plugin->script_env_vars);
free (plugin->script_filename);
free (plugin->image_dir);
free (plugin);
@@ -208,9 +252,26 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin,
static bool
start_script_animation (ply_boot_splash_plugin_t *plugin)
{
ply_list_node_t *node;
script_obj_t *target_obj;
script_obj_t *value_obj;
script_env_var_t *env_var;
assert (plugin != NULL);

plugin->script_state = script_state_new (plugin);
for (node = ply_list_get_first_node (plugin->script_env_vars);
node != NULL;
node = ply_list_get_next_node (plugin->script_env_vars, node))
{
env_var = ply_list_node_get_data (node);
target_obj = script_obj_hash_get_element (plugin->script_state->global,
env_var->key);
value_obj = script_obj_new_string (env_var->value);
script_obj_assign (target_obj, value_obj);
}
plugin->script_image_lib = script_lib_image_setup (plugin->script_state,
plugin->image_dir);
plugin->script_sprite_lib = script_lib_sprite_setup (plugin->script_state,


+ 5
- 4
src/plugins/splash/script/script-lib-image.c View File

@@ -163,19 +163,20 @@ static script_return_t image_text (script_state_t *state,
char *text = script_obj_hash_get_string (state->local, "text");
/* These colour values are currently unused, but will be once label supports them */
float alpha;
float red = CLAMP(script_obj_hash_get_number (state->local, "red"), 0, 1);
float green = CLAMP(script_obj_hash_get_number (state->local, "green"), 0, 1);
float blue = CLAMP(script_obj_hash_get_number (state->local, "blue"), 0, 1);
float alpha = 1;

alpha_obj = script_obj_hash_peek_element (state->local, "alpha");

if (alpha_obj)
if (script_obj_is_number (alpha_obj))
{
alpha = CLAMP(script_obj_as_number (alpha_obj), 0, 1);
script_obj_unref(alpha_obj);
}
else
alpha = 1;
script_obj_unref(alpha_obj);

if (!text) return script_return_obj_null ();



+ 13
- 15
src/plugins/splash/script/script-lib-sprite.c View File

@@ -458,28 +458,26 @@ static void script_lib_sprite_draw_area (script_lib_display_t *display,
node = ply_list_get_next_node (data->sprite_list, node))
{
sprite_t *sprite = ply_list_node_get_data (node);
ply_rectangle_t sprite_area;
int position_x, position_y;

if (!sprite->image) continue;
if (sprite->remove_me) continue;
if (sprite->opacity < 0.011) continue;

ply_pixel_buffer_get_size (sprite->image, &sprite_area);
position_x = sprite->x - display->x;
position_y = sprite->y - display->y;

sprite_area.x = sprite->x - display->x;
sprite_area.y = sprite->y - display->y;
if (position_x >= (x + width)) continue;
if (position_y >= (y + height)) continue;

if (sprite_area.x >= (x + width)) continue;
if (sprite_area.y >= (y + height)) continue;

if ((sprite_area.x + (int) sprite_area.width) <= x) continue;
if ((sprite_area.y + (int) sprite_area.height) <= y) continue;
ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (pixel_buffer,
&sprite_area,
&clip_area,
0, 0,
ply_pixel_buffer_get_argb32_data (sprite->image),
sprite->opacity);
if ((position_x + (int) ply_pixel_buffer_get_width (sprite->image)) <= x) continue;
if ((position_y + (int) ply_pixel_buffer_get_height (sprite->image)) <= y) continue;
ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (pixel_buffer,
sprite->image,
position_x,
position_y,
&clip_area,
sprite->opacity);
}
}



+ 6
- 6
src/plugins/splash/space-flares/plugin.c View File

@@ -1317,13 +1317,13 @@ on_draw (view_t *view,

box_data = ply_image_get_data (plugin->box_image);
ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&view->box_area, 0, 0,
&view->box_area,
box_data);
ply_entry_draw_area (view->entry, pixel_buffer, x, y, width, height);
ply_label_draw_area (view->label, pixel_buffer, x, y, width, height);
lock_data = ply_image_get_data (plugin->lock_image);
ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&view->lock_area, 0, 0,
&view->lock_area,
lock_data);
}
else
@@ -1365,7 +1365,7 @@ on_draw (view_t *view,
else
{
ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip (pixel_buffer,
&sprite_area, &clip_area, 0, 0,
&sprite_area, &clip_area,
ply_image_get_data (sprite->image), sprite->opacity);
}
}
@@ -1400,7 +1400,7 @@ draw_background (view_t *view,
image_area.height = ply_image_get_height (view->scaled_background_image);

ply_pixel_buffer_fill_with_argb32_data_with_clip (pixel_buffer,
&image_area, &area, 0, 0,
&image_area, &area,
ply_image_get_data (view->scaled_background_image));
image_area.x = image_area.width-ply_image_get_width(plugin->star_image);
@@ -1410,7 +1410,7 @@ draw_background (view_t *view,
ply_pixel_buffer_fill_with_argb32_data_with_clip (pixel_buffer,
&image_area, &area, 0, 0,
&image_area, &area,
ply_image_get_data (plugin->star_image));
image_area.x = 20;
@@ -1420,7 +1420,7 @@ draw_background (view_t *view,
ply_pixel_buffer_fill_with_argb32_data_with_clip (pixel_buffer,
&image_area, &area, 0, 0,
&image_area, &area,
ply_image_get_data (plugin->logo_image));
}



+ 3
- 3
src/plugins/splash/throbgress/plugin.c View File

@@ -466,7 +466,7 @@ draw_logo (view_t *view,
view->logo_area.height = height;

ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&view->logo_area, 0, 0,
&view->logo_area,
logo_data);
}

@@ -570,13 +570,13 @@ on_draw (view_t *view,

box_data = ply_image_get_data (plugin->box_image);
ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,