weston: migrate x11 to head-based output API
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 17 Aug 2017 13:54:58 +0000 (16:54 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 17 Apr 2018 12:19:57 +0000 (15:19 +0300)
Migrate the x11 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@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
compositor/main.c

index 55be7cd..b21bd46 100644 (file)
@@ -1537,10 +1537,9 @@ out:
        return ret;
 }
 
-static void
-x11_backend_output_configure(struct wl_listener *listener, void *data)
+static int
+x11_backend_output_configure(struct weston_output *output)
 {
-       struct weston_output *output = data;
        struct wet_output_config defaults = {
                .width = 1024,
                .height = 600,
@@ -1548,10 +1547,7 @@ x11_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
@@ -1587,6 +1583,8 @@ load_x11_backend(struct weston_compositor *c,
        config.base.struct_version = WESTON_X11_BACKEND_CONFIG_VERSION;
        config.base.struct_size = sizeof(struct weston_x11_backend_config);
 
+       wet_set_simple_head_configurator(c, x11_backend_output_configure);
+
        /* load the actual backend and configure it */
        ret = weston_compositor_load_backend(c, WESTON_BACKEND_X11,
                                             &config.base);
@@ -1594,8 +1592,6 @@ load_x11_backend(struct weston_compositor *c,
        if (ret < 0)
                return ret;
 
-       wet_set_pending_output_handler(c, x11_backend_output_configure);
-
        api = weston_windowed_output_get_api(c);
 
        if (!api) {