@ -1375,6 +1375,7 @@ create_cursors(struct display *display)
static void
static void
destroy_cursors ( struct display * display )
destroy_cursors ( struct display * display )
{
{
if ( display - > cursor_theme )
wl_cursor_theme_destroy ( display - > cursor_theme ) ;
wl_cursor_theme_destroy ( display - > cursor_theme ) ;
free ( display - > cursors ) ;
free ( display - > cursors ) ;
}
}
@ -6245,6 +6246,12 @@ display_create(int *argc, char *argv[])
if ( d = = NULL )
if ( d = = NULL )
return NULL ;
return NULL ;
wl_list_init ( & d - > window_list ) ;
wl_list_init ( & d - > deferred_list ) ;
wl_list_init ( & d - > input_list ) ;
wl_list_init ( & d - > output_list ) ;
wl_list_init ( & d - > global_list ) ;
d - > display = wl_display_connect ( NULL ) ;
d - > display = wl_display_connect ( NULL ) ;
if ( d - > display = = NULL ) {
if ( d - > display = = NULL ) {
fprintf ( stderr , " failed to connect to Wayland display: %s \n " ,
fprintf ( stderr , " failed to connect to Wayland display: %s \n " ,
@ -6266,17 +6273,13 @@ display_create(int *argc, char *argv[])
display_watch_fd ( d , d - > display_fd , EPOLLIN | EPOLLERR | EPOLLHUP ,
display_watch_fd ( d , d - > display_fd , EPOLLIN | EPOLLERR | EPOLLHUP ,
& d - > display_task ) ;
& d - > display_task ) ;
wl_list_init ( & d - > deferred_list ) ;
wl_list_init ( & d - > input_list ) ;
wl_list_init ( & d - > output_list ) ;
wl_list_init ( & d - > global_list ) ;
d - > registry = wl_display_get_registry ( d - > display ) ;
d - > registry = wl_display_get_registry ( d - > display ) ;
wl_registry_add_listener ( d - > registry , & registry_listener , d ) ;
wl_registry_add_listener ( d - > registry , & registry_listener , d ) ;
if ( wl_display_roundtrip ( d - > display ) < 0 ) {
if ( wl_display_roundtrip ( d - > display ) < 0 ) {
fprintf ( stderr , " Failed to process Wayland connection: %s \n " ,
fprintf ( stderr , " Failed to process Wayland connection: %s \n " ,
strerror ( errno ) ) ;
strerror ( errno ) ) ;
display_destroy ( d ) ;
return NULL ;
return NULL ;
}
}
@ -6290,8 +6293,6 @@ display_create(int *argc, char *argv[])
d - > theme = theme_create ( ) ;
d - > theme = theme_create ( ) ;
wl_list_init ( & d - > window_list ) ;
init_dummy_surface ( d ) ;
init_dummy_surface ( d ) ;
return d ;
return d ;
@ -6327,7 +6328,9 @@ display_destroy(struct display *display)
if ( ! wl_list_empty ( & display - > deferred_list ) )
if ( ! wl_list_empty ( & display - > deferred_list ) )
fprintf ( stderr , " toytoolkit warning: deferred tasks exist. \n " ) ;
fprintf ( stderr , " toytoolkit warning: deferred tasks exist. \n " ) ;
if ( display - > dummy_surface )
cairo_surface_destroy ( display - > dummy_surface ) ;
cairo_surface_destroy ( display - > dummy_surface ) ;
if ( display - > dummy_surface_data )
free ( display - > dummy_surface_data ) ;
free ( display - > dummy_surface_data ) ;
display_destroy_outputs ( display ) ;
display_destroy_outputs ( display ) ;
@ -6335,6 +6338,7 @@ display_destroy(struct display *display)
xkb_context_unref ( display - > xkb_context ) ;
xkb_context_unref ( display - > xkb_context ) ;
if ( display - > theme )
theme_destroy ( display - > theme ) ;
theme_destroy ( display - > theme ) ;
destroy_cursors ( display ) ;
destroy_cursors ( display ) ;
@ -6355,6 +6359,7 @@ display_destroy(struct display *display)
if ( display - > data_device_manager )
if ( display - > data_device_manager )
wl_data_device_manager_destroy ( display - > data_device_manager ) ;
wl_data_device_manager_destroy ( display - > data_device_manager ) ;
if ( display - > compositor )
wl_compositor_destroy ( display - > compositor ) ;
wl_compositor_destroy ( display - > compositor ) ;
wl_registry_destroy ( display - > registry ) ;
wl_registry_destroy ( display - > registry ) ;