[PATCH weston v6 21/73] weston: migrate wayland to head-based output API

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 16 14:57:06 UTC 2018


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Migrate the Wayland frontend to use the new head-based output
configuration API: listen for heads_changed, and process all heads.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 compositor/main.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 5d5ff248..873f7a3a 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1636,19 +1636,9 @@ load_x11_backend(struct weston_compositor *c,
 	return 0;
 }
 
-static void
-wayland_backend_output_configure_hotplug(struct wl_listener *listener, void *data)
-{
-	struct weston_output *output = data;
-
-	/* This backend has all values hardcoded, so nothing can be configured here */
-	weston_output_enable(output);
-}
-
-static void
-wayland_backend_output_configure(struct wl_listener *listener, void *data)
+static int
+wayland_backend_output_configure(struct weston_output *output)
 {
-	struct weston_output *output = data;
 	struct wet_output_config defaults = {
 		.width = 1024,
 		.height = 640,
@@ -1656,10 +1646,7 @@ wayland_backend_output_configure(struct wl_listener *listener, void *data)
 		.transform = WL_OUTPUT_TRANSFORM_NORMAL
 	};
 
-	if (wet_configure_windowed_output_from_config(output, &defaults) < 0)
-		weston_log("Cannot configure output \"%s\".\n", output->name);
-
-	weston_output_enable(output);
+	return wet_configure_windowed_output_from_config(output, &defaults);
 }
 
 static int
@@ -1726,13 +1713,15 @@ load_wayland_backend(struct weston_compositor *c,
 	if (api == NULL) {
 		/* We will just assume if load_backend() finished cleanly and
 		 * windowed_output_api is not present that wayland backend is
-		 * started with --sprawl or runs on fullscreen-shell. */
-		wet_set_pending_output_handler(c, wayland_backend_output_configure_hotplug);
+		 * started with --sprawl or runs on fullscreen-shell.
+		 * In this case, all values are hardcoded, so nothing can be
+		 * configured; simply create and enable an output. */
+		wet_set_simple_head_configurator(c, NULL);
 
 		return 0;
 	}
 
-	wet_set_pending_output_handler(c, wayland_backend_output_configure);
+	wet_set_simple_head_configurator(c, wayland_backend_output_configure);
 
 	section = NULL;
 	while (weston_config_next_section(wc, &section, &section_name)) {
-- 
2.13.6



More information about the wayland-devel mailing list