mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 10:08:06 +02:00
[label] Clean up dirty area on change of text or position
When the text or the position is changed, label will call draw events on areas which were previously drawn on. The two-step plugin is updated with the new method.
This commit is contained in:
parent
469578a974
commit
bfaa5e9742
2 changed files with 23 additions and 18 deletions
|
|
@ -211,12 +211,21 @@ draw_control (ply_label_plugin_control_t *label,
|
|||
|
||||
void
|
||||
set_text_for_control (ply_label_plugin_control_t *label,
|
||||
const char *text)
|
||||
const char *text)
|
||||
{
|
||||
ply_rectangle_t dirty_area;
|
||||
|
||||
if (label->text != text)
|
||||
{
|
||||
dirty_area = label->area;
|
||||
free (label->text);
|
||||
label->text = strdup (text);
|
||||
size_control (label);
|
||||
if (!label->is_hidden)
|
||||
ply_pixel_display_draw_area (label->display,
|
||||
dirty_area.x, dirty_area.y,
|
||||
dirty_area.width, dirty_area.height);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -226,6 +235,9 @@ show_control (ply_label_plugin_control_t *label,
|
|||
long x,
|
||||
long y)
|
||||
{
|
||||
ply_rectangle_t dirty_area;
|
||||
|
||||
dirty_area = label->area;
|
||||
label->display = display;
|
||||
label->area.x = x;
|
||||
label->area.y = y;
|
||||
|
|
@ -234,6 +246,13 @@ show_control (ply_label_plugin_control_t *label,
|
|||
|
||||
size_control (label);
|
||||
|
||||
if (!label->is_hidden)
|
||||
ply_pixel_display_draw_area (label->display,
|
||||
dirty_area.x, dirty_area.y,
|
||||
dirty_area.width, dirty_area.height);
|
||||
|
||||
label->is_hidden = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ struct _ply_boot_splash_plugin
|
|||
double animation_horizontal_alignment;
|
||||
double animation_vertical_alignment;
|
||||
char *animation_dir;
|
||||
char *message;
|
||||
|
||||
ply_progress_animation_transition_t transition;
|
||||
double transition_duration;
|
||||
|
|
@ -144,6 +143,8 @@ view_new (ply_boot_splash_plugin_t *plugin,
|
|||
|
||||
view->label = ply_label_new ();
|
||||
view->message_label = ply_label_new ();
|
||||
ply_label_set_text (view->message_label, "");
|
||||
ply_label_show (view->message_label, view->display, 10, 10);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
@ -429,7 +430,6 @@ create_plugin (ply_key_file_t *key_file)
|
|||
free (image_path);
|
||||
|
||||
plugin->animation_dir = image_dir;
|
||||
plugin->message = NULL;
|
||||
|
||||
alignment = ply_key_file_get_value (key_file, "two-step", "HorizontalAlignment");
|
||||
if (alignment != NULL)
|
||||
|
|
@ -536,12 +536,6 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
|
|||
ply_image_free (plugin->corner_image);
|
||||
|
||||
free_views (plugin);
|
||||
if (plugin->message != NULL)
|
||||
{
|
||||
free (plugin->message);
|
||||
plugin->message = NULL;
|
||||
}
|
||||
|
||||
free (plugin);
|
||||
}
|
||||
|
||||
|
|
@ -1039,8 +1033,6 @@ show_message (ply_boot_splash_plugin_t *plugin,
|
|||
|
||||
ply_label_set_text (view->message_label, message);
|
||||
|
||||
ply_label_show (view->message_label, view->display, 10, 10);
|
||||
|
||||
ply_pixel_display_draw_area (view->display, 10, 10,
|
||||
ply_label_get_width (view->message_label),
|
||||
ply_label_get_height(view->message_label));
|
||||
|
|
@ -1059,9 +1051,6 @@ display_normal (ply_boot_splash_plugin_t *plugin)
|
|||
start_progress_animation (plugin);
|
||||
|
||||
redraw_views (plugin);
|
||||
if (plugin->message)
|
||||
display_message (plugin, plugin->message);
|
||||
|
||||
}
|
||||
unpause_views (plugin);
|
||||
}
|
||||
|
|
@ -1100,10 +1089,7 @@ static void
|
|||
display_message (ply_boot_splash_plugin_t *plugin,
|
||||
const char *message)
|
||||
{
|
||||
if (plugin->message != NULL)
|
||||
free (plugin->message);
|
||||
plugin->message = strdup (message);
|
||||
show_message (plugin, plugin->message);
|
||||
show_message (plugin, message);
|
||||
}
|
||||
|
||||
ply_boot_splash_plugin_interface_t *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue