plymouth/0001-splash-remove-pixel_pixel-in-sprite-lib-when-notifie.patch

102 lines
3.8 KiB
Diff
Raw Normal View History

From 61525fba34c724b6e319f6b3b8198c0c0f8aa677 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 19 Jun 2014 16:18:12 +0200
Subject: [PATCH] splash: remove pixel_pixel in sprite-lib when notified they
are gone
---
src/plugins/splash/script/plugin.c | 1 +
src/plugins/splash/script/script-lib-sprite.c | 28 +++++++++++++++++++++++----
src/plugins/splash/script/script-lib-sprite.h | 1 +
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/plugins/splash/script/plugin.c b/src/plugins/splash/script/plugin.c
index c5c1e16..8e37b37 100644
--- a/src/plugins/splash/script/plugin.c
+++ b/src/plugins/splash/script/plugin.c
@@ -401,6 +401,7 @@ static void
remove_pixel_display (ply_boot_splash_plugin_t *plugin,
ply_pixel_display_t *display)
{
+ script_lib_sprite_pixel_display_removed (plugin->script_sprite_lib, display);
ply_list_remove_data(plugin->displays, display);
}
diff --git a/src/plugins/splash/script/script-lib-sprite.c b/src/plugins/splash/script/script-lib-sprite.c
index e0ced7e..166c7e7 100644
--- a/src/plugins/splash/script/script-lib-sprite.c
+++ b/src/plugins/splash/script/script-lib-sprite.c
@@ -77,7 +77,7 @@ static script_return_t sprite_get_image (script_state_t *state,
{
script_lib_sprite_data_t *data = user_data;
sprite_t *sprite = script_obj_as_native_of_class (state->this, data->class);
-
+
if (sprite && sprite->image_obj)
{
script_obj_ref (sprite->image_obj);
@@ -481,7 +481,7 @@ static void script_lib_sprite_draw_area (script_lib_display_t *display,
}
}
-static void
+static void
draw_area (script_lib_sprite_data_t *data,
int x,
int y,
@@ -533,10 +533,10 @@ script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
ply_pixel_display_t *pixel_display = ply_list_node_get_data (node);
script_lib_display_t *script_display = malloc (sizeof(script_lib_display_t));
script_display->pixel_display = pixel_display;
-
+
script_display->x = (max_width - ply_pixel_display_get_width (pixel_display)) / 2;
script_display->y = (max_height - ply_pixel_display_get_height (pixel_display)) / 2;
-
+
script_display->data = data;
ply_pixel_display_set_draw_handler (pixel_display,
(ply_pixel_display_draw_handler_t)
@@ -698,6 +698,26 @@ region_add_area (ply_region_t *region,
ply_region_add_rectangle (region, &rectangle);
}
+void script_lib_sprite_pixel_display_removed (script_lib_sprite_data_t *data, ply_pixel_display_t *pixel_display)
+{
+ ply_list_node_t *node;
+ ply_list_node_t *next_node;
+ script_lib_display_t* display;
+
+ node = ply_list_get_first_node (data->displays);
+ while (node)
+ {
+ next_node = ply_list_get_next_node (data->displays, node);
+ display = ply_list_node_get_data (node);
+
+ if (display->pixel_display == pixel_display)
+ {
+ ply_list_remove_node (data->displays, node);
+ }
+ node = next_node;
+ }
+}
+
void
script_lib_sprite_refresh (script_lib_sprite_data_t *data)
{
diff --git a/src/plugins/splash/script/script-lib-sprite.h b/src/plugins/splash/script/script-lib-sprite.h
index 0cb0681..2404b85 100644
--- a/src/plugins/splash/script/script-lib-sprite.h
+++ b/src/plugins/splash/script/script-lib-sprite.h
@@ -65,6 +65,7 @@ typedef struct
script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
ply_list_t *displays);
+void script_lib_sprite_pixel_display_removed (script_lib_sprite_data_t *data, ply_pixel_display_t *pixel_display);
void script_lib_sprite_refresh (script_lib_sprite_data_t *data);
void script_lib_sprite_destroy (script_lib_sprite_data_t *data);
--
1.8.4.5