Pass argc and argv through to weston_compositor_init

Allowing it to do option parsing as well.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Daniel Stone 2012-06-01 11:11:10 -04:00 committed by Kristian Høgsberg
parent 576cd15d8d
commit baf4359285
6 changed files with 23 additions and 14 deletions

View File

@ -403,7 +403,7 @@ android_compositor_destroy(struct weston_compositor *base)
} }
static struct weston_compositor * static struct weston_compositor *
android_compositor_create(struct wl_display *display) android_compositor_create(struct wl_display *display, int argc, char *argv[])
{ {
struct android_compositor *compositor; struct android_compositor *compositor;
struct android_output *output; struct android_output *output;
@ -425,7 +425,7 @@ android_compositor_create(struct wl_display *display)
if (android_init_egl(compositor, output) < 0) if (android_init_egl(compositor, output) < 0)
return NULL; return NULL;
if (weston_compositor_init(&compositor->base, display) < 0) if (weston_compositor_init(&compositor->base, display, argc, argv) < 0)
return NULL; return NULL;
android_compositor_add_output(compositor, output); android_compositor_add_output(compositor, output);
@ -440,5 +440,5 @@ android_compositor_create(struct wl_display *display)
WL_EXPORT struct weston_compositor * 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[])
{ {
return android_compositor_create(display); return android_compositor_create(display, argc, argv);
} }

View File

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

View File

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

View File

@ -847,7 +847,8 @@ x11_destroy(struct weston_compositor *ec)
static struct weston_compositor * static struct weston_compositor *
x11_compositor_create(struct wl_display *display, x11_compositor_create(struct wl_display *display,
int width, int height, int count, int fullscreen) int width, int height, int count, int fullscreen,
int argc, char *argv[])
{ {
struct x11_compositor *c; struct x11_compositor *c;
xcb_screen_iterator_t s; xcb_screen_iterator_t s;
@ -882,7 +883,7 @@ x11_compositor_create(struct wl_display *display,
c->base.destroy = x11_destroy; c->base.destroy = x11_destroy;
/* Can't init base class until we have a current egl context */ /* Can't init base class until we have a current egl context */
if (weston_compositor_init(&c->base, display) < 0) if (weston_compositor_init(&c->base, display, argc, argv) < 0)
return NULL; return NULL;
for (i = 0, x = 0; i < count; i++) { for (i = 0, x = 0; i < count; i++) {
@ -920,5 +921,6 @@ backend_init(struct wl_display *display, int argc, char *argv[])
parse_options(x11_options, ARRAY_LENGTH(x11_options), argc, argv); parse_options(x11_options, ARRAY_LENGTH(x11_options), argc, argv);
return x11_compositor_create(display, return x11_compositor_create(display,
width, height, count, fullscreen); width, height, count, fullscreen,
argc, argv);
} }

View File

@ -2838,7 +2838,10 @@ compositor_bind(struct wl_client *client,
} }
WL_EXPORT int WL_EXPORT int
weston_compositor_init(struct weston_compositor *ec, struct wl_display *display) weston_compositor_init(struct weston_compositor *ec,
struct wl_display *display,
int argc,
char *argv[])
{ {
struct wl_event_loop *loop; struct wl_event_loop *loop;
const char *extensions; const char *extensions;

View File

@ -623,7 +623,8 @@ uint32_t
weston_compositor_get_time(void); weston_compositor_get_time(void);
int int
weston_compositor_init(struct weston_compositor *ec, struct wl_display *display); weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
int argc, char *argv[]);
void void
weston_compositor_shutdown(struct weston_compositor *ec); weston_compositor_shutdown(struct weston_compositor *ec);
void void