struct wl_listener output_destroy;
struct wl_listener output_frame;
- struct wl_list link; // tinyds_server::outputs
int width, height;
struct ds_compositor *compositor;
struct ds_xdg_shell *xdg_shell;
- struct tinyds_output primary_output;
+ struct tinyds_output output;
struct wl_list views;
- struct wl_list outputs;
struct wl_listener new_input;
struct wl_listener new_xdg_surface;
assert(init_server(server, display) == true);
- assert(init_output(&server->primary_output, server,
+ assert(init_output(&server->output, server,
OUTPUT_WIDTH, OUTPUT_HEIGHT) == true);
socket = wl_display_add_socket_auto(display);
wl_display_run(server->display);
- fini_output(&server->primary_output);
+ fini_output(&server->output);
fini_server(server);
wl_display_destroy(display);
{
server->display = display;
- wl_list_init(&server->outputs);
wl_list_init(&server->views);
if (wl_display_init_shm(display) != 0)
output->output_frame.notify = output_handle_frame;
ds_output_add_frame_listener(output->ds_output, &output->output_frame);
- wl_list_insert(&server->outputs, &output->link);
-
return true;
err_output:
static void
fini_output(struct tinyds_output *output)
{
- wl_list_remove(&output->link);
if (output->ds_output)
ds_output_destroy(output->ds_output);
ds_swapchain_destroy(output->swapchain);
static void
draw_server(struct tinyds_server *server)
{
- struct tinyds_output *output;
-
- wl_list_for_each(output, &server->outputs, link)
- draw_output(output);
+ draw_output(&server->output);
}
static void
draw_server_with_damage(struct tinyds_server *server)
{
- struct tinyds_output *output;
+ struct tinyds_output *output = &server->output;
- wl_list_for_each(output, &server->outputs, link) {
- output->damaged = true;
- draw_output(output);
- }
+ output->damaged = true;
+ draw_output(output);
}
static void view_send_frame_done(struct tinyds_view *view);