examples/tinyds: Clarify single output support 75/278175/1
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 20 Apr 2022 10:54:19 +0000 (19:54 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 18 Jul 2022 05:58:30 +0000 (14:58 +0900)
tinyds doesn't support multiple outputs for now, so don't pretend to
support multiple outputs.

Change-Id: Ic28b275423e5618677f34373ad677ad387a7f754

src/examples/tinyds.c

index ed3ed01..0c88849 100644 (file)
@@ -57,7 +57,6 @@ struct tinyds_output
 
     struct wl_listener output_destroy;
     struct wl_listener output_frame;
-    struct wl_list link; // tinyds_server::outputs
 
     int width, height;
 
@@ -73,10 +72,9 @@ struct tinyds_server
     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;
@@ -127,7 +125,7 @@ main(void)
 
     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);
@@ -143,7 +141,7 @@ main(void)
 
     wl_display_run(server->display);
 
-    fini_output(&server->primary_output);
+    fini_output(&server->output);
     fini_server(server);
     wl_display_destroy(display);
 
@@ -256,7 +254,6 @@ init_server(struct tinyds_server *server, struct wl_display *display)
 {
     server->display = display;
 
-    wl_list_init(&server->outputs);
     wl_list_init(&server->views);
 
     if (wl_display_init_shm(display) != 0)
@@ -347,8 +344,6 @@ init_output(struct tinyds_output *output, struct tinyds_server *server,
     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:
@@ -362,7 +357,6 @@ err_swapchain:
 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);
@@ -372,21 +366,16 @@ fini_output(struct tinyds_output *output)
 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);