backend/wayland: Implement start() interface of ds_backend
[platform/core/uifw/libds.git] / src / libds / backend / wayland / output.c
index 36ea5f7..c57820f 100644 (file)
@@ -23,6 +23,25 @@ ds_wl_backend_create_output(struct ds_backend *ds_backend)
 
     backend = wl_backend_from_backend(ds_backend);
 
+    if (!ds_backend->started) {
+        backend->requested_outputs++;
+        return NULL;
+    }
+
+    output = create_wl_output(backend);
+    if (!output) {
+        ds_err("Could not create ds_wl_output");
+        return NULL;
+    }
+
+    return &output->base;
+}
+
+struct ds_wl_output *
+create_wl_output(struct ds_wl_backend *backend)
+{
+    struct ds_wl_output *output;
+
     output = calloc(1, sizeof *output);
     if (!output) {
         ds_log_errno(DS_ERR, "Could not allocate ds_wl_output");
@@ -72,7 +91,7 @@ ds_wl_backend_create_output(struct ds_backend *ds_backend)
 
     ds_dbg("Wayland output(%p) created", output);
 
-    return &output->base;
+    return output;
 
 err:
     ds_output_destroy(&output->base);