static struct weston_compositor *
drm_compositor_create(struct wl_display *display,
int connector, const char *seat, int tty, int pixman,
- int *argc, char *argv[], int config_fd)
+ int *argc, char *argv[],
+ struct weston_config *config)
{
struct drm_compositor *ec;
struct udev_device *drm_device;
ec->use_pixman = pixman;
if (weston_compositor_init(&ec->base, display, argc, argv,
- config_fd) < 0) {
+ config) < 0) {
weston_log("%s failed\n", __func__);
goto err_base;
}
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
int connector = 0, tty = 0, use_pixman = 0;
const char *seat = default_seat;
parse_options(drm_options, ARRAY_LENGTH(drm_options), argc, argv);
return drm_compositor_create(display, connector, seat, tty, use_pixman,
- argc, argv, config_fd);
+ argc, argv, config);
}
static struct weston_compositor *
fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[],
- int config_fd, struct fbdev_parameters *param)
+ struct weston_config *config,
+ struct fbdev_parameters *param)
{
struct fbdev_compositor *compositor;
const char *seat = default_seat;
return NULL;
if (weston_compositor_init(&compositor->base, display, argc, argv,
- config_fd) < 0)
+ config) < 0)
goto out_free;
compositor->udev = udev_new();
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
/* TODO: Ideally, available frame buffers should be enumerated using
* udev, rather than passing a device node in as a parameter. */
parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
- return fbdev_compositor_create(display, argc, argv, config_fd,
- ¶m);
+ return fbdev_compositor_create(display, argc, argv, config, ¶m);
}
static struct weston_compositor *
headless_compositor_create(struct wl_display *display,
- int width, int height, const char *display_name,
- int *argc, char *argv[], int config_fd)
+ int width, int height, const char *display_name,
+ int *argc, char *argv[],
+ struct weston_config *config)
{
struct headless_compositor *c;
memset(c, 0, sizeof *c);
- if (weston_compositor_init(&c->base, display, argc, argv,
- config_fd) < 0)
+ if (weston_compositor_init(&c->base, display, argc, argv, config) < 0)
goto err_free;
weston_seat_init(&c->fake_seat, &c->base);
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
int width = 1024, height = 640;
char *display_name = NULL;
ARRAY_LENGTH(headless_options), argc, argv);
return headless_compositor_create(display, width, height, display_name,
- argc, argv, config_fd);
+ argc, argv, config);
}
static struct weston_compositor *
rdp_compositor_create(struct wl_display *display,
struct rdp_compositor_config *config,
- int *argc, char *argv[], int config_fd)
+ int *argc, char *argv[], struct weston_config *config)
{
struct rdp_compositor *c;
char *fd_str;
memset(c, 0, sizeof *c);
- if (weston_compositor_init(&c->base, display, argc, argv,
- config_fd) < 0)
+ if (weston_compositor_init(&c->base, display, argc, argv, config) < 0)
goto err_free;
c->base.destroy = rdp_destroy;
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
struct rdp_compositor_config config;
rdp_compositor_config_init(&config);
};
parse_options(rdp_options, ARRAY_LENGTH(rdp_options), argc, argv);
- return rdp_compositor_create(display, &config, argc, argv, config_fd);
+ return rdp_compositor_create(display, &config, argc, argv, config);
}
static struct weston_compositor *
rpi_compositor_create(struct wl_display *display, int *argc, char *argv[],
- int config_fd, struct rpi_parameters *param)
+ struct weston_config *config,
+ struct rpi_parameters *param)
{
struct rpi_compositor *compositor;
const char *seat = default_seat;
return NULL;
if (weston_compositor_init(&compositor->base, display, argc, argv,
- config_fd) < 0)
+ config) < 0)
goto out_free;
compositor->udev = udev_new();
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
const char *transform = "normal";
int ret;
else
param.output_transform = ret;
- return rpi_compositor_create(display, argc, argv, config_fd, ¶m);
+ return rpi_compositor_create(display, argc, argv, config, ¶m);
}
static struct weston_compositor *
wayland_compositor_create(struct wl_display *display,
int width, int height, const char *display_name,
- int *argc, char *argv[], int config_fd)
+ int *argc, char *argv[],
+ struct weston_config *config)
{
struct wayland_compositor *c;
struct wl_event_loop *loop;
memset(c, 0, sizeof *c);
if (weston_compositor_init(&c->base, display, argc, argv,
- config_fd) < 0)
+ config) < 0)
goto err_free;
c->parent.wl_display = wl_display_connect(display_name);
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
int width = 1024, height = 640;
char *display_name = NULL;
ARRAY_LENGTH(wayland_options), argc, argv);
return wayland_compositor_create(display, width, height, display_name,
- argc, argv, config_fd);
+ argc, argv, config);
}
int fullscreen,
int no_input,
int use_pixman,
- int *argc, char *argv[], int config_fd)
+ int *argc, char *argv[],
+ struct weston_config *config)
{
struct x11_compositor *c;
struct x11_output *output;
memset(c, 0, sizeof *c);
- if (weston_compositor_init(&c->base, display, argc, argv,
- config_fd) < 0)
+ if (weston_compositor_init(&c->base, display, argc, argv, config) < 0)
goto err_free;
c->dpy = XOpenDisplay(NULL);
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
int fullscreen = 0;
int no_input = 0;
fullscreen,
no_input,
use_pixman,
- argc, argv, config_fd);
+ argc, argv, config);
}
weston_compositor_init(struct weston_compositor *ec,
struct wl_display *display,
int *argc, char *argv[],
- int config_fd)
+ struct weston_config *config)
{
struct wl_event_loop *loop;
struct xkb_rule_names xkb_names;
struct weston_config_section *s;
- ec->config_fd = config_fd;
- ec->config = weston_config_parse(config_fd);
-
+ ec->config = config;
ec->wl_display = display;
wl_signal_init(&ec->destroy_signal);
wl_signal_init(&ec->activate_signal);
wl_event_loop_destroy(ec->input_loop);
- close(ec->config_fd);
+ weston_config_destroy(ec->config);
}
WL_EXPORT void
struct wl_event_loop *loop;
struct weston_compositor
*(*backend_init)(struct wl_display *display,
- int *argc, char *argv[], int config_fd);
+ int *argc, char *argv[],
+ struct weston_config *config);
int i, config_fd;
char *backend = NULL;
- const char *modules = "desktop-shell.so", *option_modules = NULL;
+ char *modules, *option_modules = NULL;
char *log = NULL;
int32_t idle_time = 300;
int32_t help = 0;
char *socket_name = "wayland-0";
int32_t version = 0;
-
- const struct config_key core_config_keys[] = {
- { "modules", CONFIG_KEY_STRING, &modules },
- };
-
- const struct config_section cs[] = {
- { "core",
- core_config_keys, ARRAY_LENGTH(core_config_keys) },
- };
+ struct weston_config *config;
+ struct weston_config_section *section;
const struct weston_option core_options[] = {
{ WESTON_OPTION_STRING, "backend", 'B', &backend },
}
config_fd = open_config_file("weston.ini");
- parse_config_file(config_fd, cs, ARRAY_LENGTH(cs), NULL);
+ config = weston_config_parse(config_fd);
+ close(config_fd);
+
+ section = weston_config_get_section(config, "core", NULL, NULL);
+ weston_config_section_get_string(section, "modules",
+ &modules, "desktop-shell.so");
backend_init = load_module(backend, "backend_init");
if (!backend_init)
exit(EXIT_FAILURE);
- ec = backend_init(display, &argc, argv, config_fd);
+ ec = backend_init(display, &argc, argv, config);
if (ec == NULL) {
weston_log("fatal: failed to create compositor\n");
exit(EXIT_FAILURE);
struct xkb_rule_names xkb_names;
struct xkb_context *xkb_context;
struct weston_xkb_info xkb_info;
-
- int config_fd;
};
struct weston_buffer_reference {
int
weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
- int *argc, char *argv[], int config_fd);
+ int *argc, char *argv[], struct weston_config *config);
void
weston_compositor_shutdown(struct weston_compositor *ec);
void
struct weston_compositor *
backend_init(struct wl_display *display, int *argc, char *argv[],
- int config_fd);
+ struct weston_config *config);
int
module_init(struct weston_compositor *compositor,
}
static void
-shell_configuration(struct desktop_shell *shell, int config_fd)
+shell_configuration(struct desktop_shell *shell)
{
struct weston_config_section *section;
int duration;
wl_array_init(&shell->workspaces.array);
wl_list_init(&shell->workspaces.client_list);
- shell_configuration(shell, ec->config_fd);
+ shell_configuration(shell);
for (i = 0; i < shell->workspaces.num; i++) {
pws = wl_array_add(&shell->workspaces.array, sizeof *pws);