@ -369,6 +369,9 @@ destroy_surface(struct wl_resource *resource)
wl_list_remove ( & surface - > buffer_link ) ;
pixman_region32_fini ( & surface - > damage ) ;
pixman_region32_fini ( & surface - > opaque ) ;
free ( surface ) ;
}
@ -808,11 +811,14 @@ weston_output_repaint(struct weston_output *output)
weston_surface_draw ( es , output , & repaint ) ;
pixman_region32_subtract ( & es - > damage ,
& es - > damage , & output - > region ) ;
pixman_region32_fini ( & repaint ) ;
}
}
if ( ec - > fade . spring . current > 0.001 )
fade_output ( output , ec - > fade . spring . current , & total_damage ) ;
pixman_region32_fini ( & total_damage ) ;
}
struct weston_frame_callback {
@ -1677,6 +1683,18 @@ weston_input_device_init(struct weston_input_device *device,
device - > selection_data_source = NULL ;
}
WL_EXPORT void
weston_input_device_release ( struct weston_input_device * device )
{
wl_list_remove ( & device - > link ) ;
/* The global object is destroyed at wl_display_destroy() time. */
if ( device - > sprite )
destroy_surface ( & device - > sprite - > surface . resource ) ;
wl_input_device_release ( & device - > input_device ) ;
}
static void
bind_output ( struct wl_client * client ,
void * data , uint32_t version , uint32_t id )
@ -1991,7 +2009,7 @@ weston_compositor_init(struct weston_compositor *ec, struct wl_display *display)
ec - > fade . animation . frame = fade_frame ;
wl_list_init ( & ec - > fade . animation . link ) ;
screenshooter_create ( ec ) ;
ec - > screenshooter = screenshooter_create ( ec ) ;
weston_data_device_manager_init ( ec ) ;
@ -2019,9 +2037,21 @@ weston_compositor_shutdown(struct weston_compositor *ec)
{
struct weston_output * output , * next ;
wl_event_source_remove ( ec - > idle_source ) ;
if ( ec - > screenshooter )
screenshooter_destroy ( ec - > screenshooter ) ;
/* Destroy all outputs associated with this compositor */
wl_list_for_each_safe ( output , next , & ec - > output_list , link )
output - > destroy ( output ) ;
weston_binding_list_destroy_all ( & ec - > binding_list ) ;
wl_shm_finish ( ec - > shm ) ;
wl_array_release ( & ec - > vertices ) ;
wl_array_release ( & ec - > indices ) ;
}
static int on_term_signal ( int signal_number , void * data )
@ -2066,6 +2096,7 @@ int main(int argc, char *argv[])
{
struct wl_display * display ;
struct weston_compositor * ec ;
struct wl_event_source * signals [ 4 ] ;
struct wl_event_loop * loop ;
int o , xserver = 0 ;
void * shell_module , * backend_module ;
@ -2077,6 +2108,7 @@ int main(int argc, char *argv[])
char * shell = NULL ;
char * p ;
int option_idle_time = 300 ;
int i ;
static const char opts [ ] = " B:b:o:S:i:s:x " ;
static const struct option longopts [ ] = {
@ -2121,12 +2153,16 @@ int main(int argc, char *argv[])
display = wl_display_create ( ) ;
loop = wl_display_get_event_loop ( display ) ;
wl_event_loop_add_signal ( loop , SIGTERM , on_term_signal , display ) ;
wl_event_loop_add_signal ( loop , SIGINT , on_term_signal , display ) ;
wl_event_loop_add_signal ( loop , SIGQUIT , on_term_signal , display ) ;
signals [ 0 ] = wl_event_loop_add_signal ( loop , SIGTERM , on_term_signal ,
display ) ;
signals [ 1 ] = wl_event_loop_add_signal ( loop , SIGINT , on_term_signal ,
display ) ;
signals [ 2 ] = wl_event_loop_add_signal ( loop , SIGQUIT , on_term_signal ,
display ) ;
wl_list_init ( & child_process_list ) ;
wl_event_loop_add_signal ( loop , SIGCHLD , sigchld_handler , NULL ) ;
signals [ 3 ] = wl_event_loop_add_signal ( loop , SIGCHLD , sigchld_handler ,
NULL ) ;
if ( ! backend ) {
if ( getenv ( " WAYLAND_DISPLAY " ) )
@ -2172,12 +2208,20 @@ int main(int argc, char *argv[])
wl_display_run ( display ) ;
/* prevent further rendering while shutting down */
ec - > state = WESTON_COMPOSITOR_SLEEPING ;
if ( xserver )
weston_xserver_destroy ( ec ) ;
ec - > shell - > destroy ( ec - > shell ) ;
if ( ec - > has_bind_display )
ec - > unbind_display ( ec - > display , display ) ;
for ( i = ARRAY_LENGTH ( signals ) ; i ; )
wl_event_source_remove ( signals [ - - i ] ) ;
ec - > destroy ( ec ) ;
wl_display_destroy ( display ) ;