WL_EXPORT int backend_init(struct weston_compositor *compositor, int *argc, char *argv[], struct weston_config *wc, struct weston_backend_config *config_base) { struct headless_backend *b; struct weston_headless_backend_config config = {{ 0, }}; if (config_base == NULL || config_base->struct_version != WESTON_HEADLESS_BACKEND_CONFIG_VERSION || config_base->struct_size > sizeof(struct weston_headless_backend_config)) { weston_log("headless backend config structure is invalid\n"); return -1; } config_init_to_defaults(&config); memcpy(&config, config_base, config_base->struct_size); b = headless_backend_create(compositor, &config); if (b == NULL) return -1; return 0; }
WL_EXPORT int backend_init(struct weston_compositor *compositor, int *argc, char *argv[], struct weston_config *config, struct weston_backend_config *config_base) { int width = 1024, height = 640; char *display_name = NULL; struct headless_parameters param = { 0, }; const char *transform = "normal"; struct headless_backend *b; const struct weston_option headless_options[] = { { WESTON_OPTION_INTEGER, "width", 0, &width }, { WESTON_OPTION_INTEGER, "height", 0, &height }, { WESTON_OPTION_BOOLEAN, "use-pixman", 0, ¶m.use_pixman }, { WESTON_OPTION_STRING, "transform", 0, &transform }, }; parse_options(headless_options, ARRAY_LENGTH(headless_options), argc, argv); param.width = width; param.height = height; if (weston_parse_transform(transform, ¶m.transform) < 0) weston_log("Invalid transform \"%s\"\n", transform); b = headless_backend_create(compositor, ¶m, display_name); if (b == NULL) return -1; return 0; }