Pass config_file through to weston_compositor_init

This allows us to do config parsing there.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
dev
Daniel Stone 13 years ago committed by Kristian Høgsberg
parent baf4359285
commit c1be8e59de
  1. 11
      src/compositor-android.c
  2. 11
      src/compositor-drm.c
  3. 10
      src/compositor-wayland.c
  4. 10
      src/compositor-x11.c
  5. 10
      src/compositor.c
  6. 5
      src/compositor.h

@ -403,7 +403,8 @@ android_compositor_destroy(struct weston_compositor *base)
}
static struct weston_compositor *
android_compositor_create(struct wl_display *display, int argc, char *argv[])
android_compositor_create(struct wl_display *display, int argc, char *argv[],
const char *config_file)
{
struct android_compositor *compositor;
struct android_output *output;
@ -425,7 +426,8 @@ android_compositor_create(struct wl_display *display, int argc, char *argv[])
if (android_init_egl(compositor, output) < 0)
return NULL;
if (weston_compositor_init(&compositor->base, display, argc, argv) < 0)
if (weston_compositor_init(&compositor->base, display, argc, argv,
config_file) < 0)
return NULL;
android_compositor_add_output(compositor, output);
@ -438,7 +440,8 @@ android_compositor_create(struct wl_display *display, int argc, char *argv[])
}
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int argc, char *argv[])
backend_init(struct wl_display *display, int argc, char *argv[],
const char *config_file)
{
return android_compositor_create(display, argc, argv);
return android_compositor_create(display, argc, argv, config_file);
}

@ -1739,7 +1739,7 @@ static const char default_seat[] = "seat0";
static struct weston_compositor *
drm_compositor_create(struct wl_display *display,
int connector, const char *seat, int tty,
int argc, char *argv[])
int argc, char *argv[], const char *config_file)
{
struct drm_compositor *ec;
struct udev_enumerate *e;
@ -1805,7 +1805,8 @@ drm_compositor_create(struct wl_display *display,
ec->prev_state = WESTON_COMPOSITOR_ACTIVE;
/* Can't init base class until we have a current egl context */
if (weston_compositor_init(&ec->base, display, argc, argv) < 0)
if (weston_compositor_init(&ec->base, display, argc, argv,
config_file) < 0)
return NULL;
for (key = KEY_F1; key < KEY_F9; key++)
@ -1853,7 +1854,8 @@ drm_compositor_create(struct wl_display *display,
}
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int argc, char *argv[])
backend_init(struct wl_display *display, int argc, char *argv[],
const char *config_file)
{
int connector = 0, tty = 0;
const char *seat = default_seat;
@ -1866,5 +1868,6 @@ backend_init(struct wl_display *display, int argc, char *argv[])
parse_options(drm_options, ARRAY_LENGTH(drm_options), argc, argv);
return drm_compositor_create(display, connector, seat, tty, argc, argv);
return drm_compositor_create(display, connector, seat, tty, argc, argv,
config_file);
}

@ -738,7 +738,7 @@ wayland_destroy(struct weston_compositor *ec)
static struct weston_compositor *
wayland_compositor_create(struct wl_display *display,
int width, int height, const char *display_name,
int argc, char *argv[])
int argc, char *argv[], const char *config_file)
{
struct wayland_compositor *c;
struct wl_event_loop *loop;
@ -770,7 +770,8 @@ wayland_compositor_create(struct wl_display *display,
c->base.destroy = wayland_destroy;
/* Can't init base class until we have a current egl context */
if (weston_compositor_init(&c->base, display, argc, argv) < 0)
if (weston_compositor_init(&c->base, display, argc, argv,
config_file) < 0)
return NULL;
create_border(c);
@ -793,7 +794,8 @@ wayland_compositor_create(struct wl_display *display,
}
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int argc, char *argv[])
backend_init(struct wl_display *display, int argc, char *argv[],
const char *config_file)
{
int width = 1024, height = 640;
char *display_name = NULL;
@ -808,5 +810,5 @@ backend_init(struct wl_display *display, int argc, char *argv[])
ARRAY_LENGTH(wayland_options), argc, argv);
return wayland_compositor_create(display, width, height, display_name,
argc, argv);
argc, argv, config_file);
}

@ -848,7 +848,7 @@ x11_destroy(struct weston_compositor *ec)
static struct weston_compositor *
x11_compositor_create(struct wl_display *display,
int width, int height, int count, int fullscreen,
int argc, char *argv[])
int argc, char *argv[], const char *config_file)
{
struct x11_compositor *c;
xcb_screen_iterator_t s;
@ -883,7 +883,8 @@ x11_compositor_create(struct wl_display *display,
c->base.destroy = x11_destroy;
/* Can't init base class until we have a current egl context */
if (weston_compositor_init(&c->base, display, argc, argv) < 0)
if (weston_compositor_init(&c->base, display, argc, argv,
config_file) < 0)
return NULL;
for (i = 0, x = 0; i < count; i++) {
@ -907,7 +908,8 @@ x11_compositor_create(struct wl_display *display,
}
WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, int argc, char *argv[])
backend_init(struct wl_display *display, int argc, char *argv[],
const char *config_file)
{
int width = 1024, height = 640, fullscreen = 0, count = 1;
@ -922,5 +924,5 @@ backend_init(struct wl_display *display, int argc, char *argv[])
return x11_compositor_create(display,
width, height, count, fullscreen,
argc, argv);
argc, argv, config_file);
}

@ -2841,7 +2841,8 @@ WL_EXPORT int
weston_compositor_init(struct weston_compositor *ec,
struct wl_display *display,
int argc,
char *argv[])
char *argv[],
const char *config_file)
{
struct wl_event_loop *loop;
const char *extensions;
@ -3041,7 +3042,7 @@ int main(int argc, char *argv[])
int (*module_init)(struct weston_compositor *ec);
struct weston_compositor
*(*backend_init)(struct wl_display *display,
int argc, char *argv[]);
int argc, char *argv[], const char *config_file);
int i;
char *backend = NULL;
char *shell = NULL;
@ -3116,13 +3117,12 @@ int main(int argc, char *argv[])
config_file = config_file_path("weston.ini");
parse_config_file(config_file, cs, ARRAY_LENGTH(cs), shell);
free(config_file);
backend_init = load_module(backend, "backend_init", &backend_module);
if (!backend_init)
exit(EXIT_FAILURE);
ec = backend_init(display, argc, argv);
ec = backend_init(display, argc, argv, config_file);
if (ec == NULL) {
fprintf(stderr, "failed to create compositor\n");
exit(EXIT_FAILURE);
@ -3133,7 +3133,7 @@ int main(int argc, char *argv[])
if (argv[1])
exit(EXIT_FAILURE);
weston_compositor_xkb_init(ec, &xkb_names);
free(config_file);
ec->option_idle_time = idle_time;
ec->idle_time = idle_time;

@ -624,7 +624,7 @@ weston_compositor_get_time(void);
int
weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
int argc, char *argv[]);
int argc, char *argv[], const char *config_file);
void
weston_compositor_shutdown(struct weston_compositor *ec);
void
@ -722,7 +722,8 @@ void
weston_surface_destroy(struct weston_surface *surface);
struct weston_compositor *
backend_init(struct wl_display *display, int argc, char *argv[]);
backend_init(struct wl_display *display, int argc, char *argv[],
const char *config_file);
int
weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode);

Loading…
Cancel
Save