@ -371,6 +371,16 @@ clock_timer_reset(struct panel_clock *clock)
return 0 ;
}
static void
panel_destroy_clock ( struct panel_clock * clock )
{
widget_destroy ( clock - > widget ) ;
close ( clock - > clock_fd ) ;
free ( clock ) ;
}
static void
panel_add_clock ( struct panel * panel )
{
@ -447,6 +457,39 @@ panel_configure(void *data,
window_schedule_resize ( panel - > window , width , 32 ) ;
}
static void
panel_destroy_launcher ( struct panel_launcher * launcher )
{
wl_array_release ( & launcher - > argv ) ;
wl_array_release ( & launcher - > envp ) ;
free ( launcher - > path ) ;
cairo_surface_destroy ( launcher - > icon ) ;
widget_destroy ( launcher - > widget ) ;
wl_list_remove ( & launcher - > link ) ;
free ( launcher ) ;
}
static void
panel_destroy ( struct panel * panel )
{
struct panel_launcher * tmp ;
struct panel_launcher * launcher ;
panel_destroy_clock ( panel - > clock ) ;
wl_list_for_each_safe ( launcher , tmp , & panel - > launcher_list , link )
panel_destroy_launcher ( launcher ) ;
widget_destroy ( panel - > widget ) ;
window_destroy ( panel - > window ) ;
free ( panel ) ;
}
static struct panel *
panel_create ( struct display * display )
{
@ -885,6 +928,15 @@ static const struct desktop_shell_listener listener = {
desktop_shell_grab_cursor
} ;
static void
background_destroy ( struct background * background )
{
widget_destroy ( background - > widget ) ;
window_destroy ( background - > window ) ;
free ( background ) ;
}
static struct background *
background_create ( struct desktop * desktop )
{
@ -911,6 +963,13 @@ grab_surface_enter_handler(struct widget *widget, struct input *input,
return desktop - > grab_cursor ;
}
static void
grab_surface_destroy ( struct desktop * desktop )
{
widget_destroy ( desktop - > grab_widget ) ;
window_destroy ( desktop - > grab_window ) ;
}
static void
grab_surface_create ( struct desktop * desktop )
{
@ -932,6 +991,27 @@ grab_surface_create(struct desktop *desktop)
grab_surface_enter_handler ) ;
}
static void
output_destroy ( struct output * output )
{
background_destroy ( output - > background ) ;
panel_destroy ( output - > panel ) ;
wl_output_destroy ( output - > output ) ;
wl_list_remove ( & output - > link ) ;
free ( output ) ;
}
static void
desktop_destroy_outputs ( struct desktop * desktop )
{
struct output * tmp ;
struct output * output ;
wl_list_for_each_safe ( output , tmp , & desktop - > outputs , link )
output_destroy ( output ) ;
}
static void
create_output ( struct desktop * desktop , uint32_t id )
{
@ -1043,5 +1123,13 @@ int main(int argc, char *argv[])
display_run ( desktop . display ) ;
/* Cleanup */
grab_surface_destroy ( & desktop ) ;
desktop_destroy_outputs ( & desktop ) ;
if ( desktop . unlock_dialog )
unlock_dialog_destroy ( desktop . unlock_dialog ) ;
desktop_shell_destroy ( desktop . shell ) ;
display_destroy ( desktop . display ) ;
return 0 ;
}