Browse Source

Imported Upstream version 0.8.3

suites/beowulf upstream/0.8.3
Laurent Bigonville 8 years ago
parent
commit
a7ccf3c0c5
  1. 10
      aclocal.m4
  2. 8
      build-tools/ltmain.sh
  3. 24
      configure
  4. 2
      configure.ac
  5. 6
      src/libply-splash-core/ply-boot-splash.c
  6. 136
      src/libply-splash-core/ply-pixel-buffer.c
  7. 34
      src/libply-splash-core/ply-pixel-buffer.h
  8. 65
      src/libply-splash-core/ply-terminal.c
  9. 36
      src/libply-splash-graphics/ply-animation.c
  10. 57
      src/libply-splash-graphics/ply-entry.c
  11. 5
      src/libply-splash-graphics/ply-entry.h
  12. 12
      src/libply-splash-graphics/ply-image.c
  13. 1
      src/libply-splash-graphics/ply-image.h
  14. 89
      src/libply-splash-graphics/ply-progress-animation.c
  15. 46
      src/libply-splash-graphics/ply-throbber.c
  16. 62
      src/libply/ply-event-loop.c
  17. 55
      src/libply/ply-key-file.c
  18. 7
      src/libply/ply-key-file.h
  19. 70
      src/main.c
  20. 2
      src/plugins/renderers/drm/plugin.c
  21. 7
      src/plugins/splash/details/plugin.c
  22. 6
      src/plugins/splash/fade-throbber/plugin.c
  23. 61
      src/plugins/splash/script/plugin.c
  24. 9
      src/plugins/splash/script/script-lib-image.c
  25. 28
      src/plugins/splash/script/script-lib-sprite.c
  26. 12
      src/plugins/splash/space-flares/plugin.c
  27. 6
      src/plugins/splash/throbgress/plugin.c
  28. 230
      src/plugins/splash/two-step/plugin.c
  29. 2
      src/ply-splash-core.pc.in
  30. 5
      themes/script/script.plymouth.in

10
aclocal.m4

@ -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)
])

8
build-tools/ltmain.sh

@ -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

24
configure

@ -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'`\\"

2
configure.ac

@ -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
src/libply-splash-core/ply-boot-splash.c

@ -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)
{

136
src/libply-splash-core/ply-pixel-buffer.c

@ -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)
{

34
src/libply-splash-core/ply-pixel-buffer.h

@ -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);

65
src/libply-splash-core/ply-terminal.c

@ -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;
}

36
src/libply-splash-graphics/ply-animation.c

@ -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

57
src/libply-splash-graphics/ply-entry.c

@ -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
src/libply-splash-graphics/ply-entry.h

@ -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

12
src/libply-splash-graphics/ply-image.c

@ -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
src/libply-splash-graphics/ply-image.h

@ -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

89
src/libply-splash-graphics/ply-progress-animation.c

@ -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;

46
src/libply-splash-graphics/ply-throbber.c

@ -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

62
src/libply/ply-event-loop.c

@ -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
src/libply/ply-key-file.c

@ -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
src/libply/ply-key-file.h

@ -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,