summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-06-01 11:14:02 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-06-01 11:14:38 -0400
commitc1be8e59de2e68764da4790064f337e788dfaf89 (patch)
tree01a169db44bd8cd841925fb201063959ac6fbd63
parentbaf43592855c78b36dee33cb0d8e325388ae2dd5 (diff)
Pass config_file through to weston_compositor_init
This allows us to do config parsing there. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--src/compositor-android.c11
-rw-r--r--src/compositor-drm.c11
-rw-r--r--src/compositor-wayland.c10
-rw-r--r--src/compositor-x11.c10
-rw-r--r--src/compositor.c10
-rw-r--r--src/compositor.h5
6 files changed, 34 insertions, 23 deletions
diff --git a/src/compositor-android.c b/src/compositor-android.c
index 91bbf74d..3343481e 100644
--- a/src/compositor-android.c
+++ b/src/compositor-android.c
@@ -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);
}
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 5217c0ea..500ea7ca 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -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);
}
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 688aa591..870c2081 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -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);
}
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index ac6dce40..d23553e4 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -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);
}
diff --git a/src/compositor.c b/src/compositor.c
index f9c9b2ca..ef3802dd 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -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;
diff --git a/src/compositor.h b/src/compositor.h
index e00dfe3f..23beb5f5 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -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);