[PATCH weston 6/9] Pass argc and argv through to weston_compositor_init

Daniel Stone daniel at fooishbar.org
Fri Jun 1 04:14:03 PDT 2012


Allowing it to do option parsing as well.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/compositor-android.c |    6 +++---
 src/compositor-drm.c     |    7 ++++---
 src/compositor-wayland.c |    8 +++++---
 src/compositor-x11.c     |    8 +++++---
 src/compositor.c         |    5 ++++-
 src/compositor.h         |    3 ++-
 6 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/compositor-android.c b/src/compositor-android.c
index 268538a..91bbf74 100644
--- a/src/compositor-android.c
+++ b/src/compositor-android.c
@@ -403,7 +403,7 @@ android_compositor_destroy(struct weston_compositor *base)
 }
 
 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_output *output;
@@ -425,7 +425,7 @@ android_compositor_create(struct wl_display *display)
 	if (android_init_egl(compositor, output) < 0)
 		return NULL;
 
-	if (weston_compositor_init(&compositor->base, display) < 0)
+	if (weston_compositor_init(&compositor->base, display, argc, argv) < 0)
 		return NULL;
 
 	android_compositor_add_output(compositor, output);
@@ -440,5 +440,5 @@ android_compositor_create(struct wl_display *display)
 WL_EXPORT struct weston_compositor *
 backend_init(struct wl_display *display, int argc, char *argv[])
 {
-	return android_compositor_create(display);
+	return android_compositor_create(display, argc, argv);
 }
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 98e8b07..5217c0e 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1738,7 +1738,8 @@ 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 connector, const char *seat, int tty,
+		      int argc, char *argv[])
 {
 	struct drm_compositor *ec;
 	struct udev_enumerate *e;
@@ -1804,7 +1805,7 @@ 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) < 0)
+	if (weston_compositor_init(&ec->base, display, argc, argv) < 0)
 		return NULL;
 
 	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);
 
-	return drm_compositor_create(display, connector, seat, tty);
+	return drm_compositor_create(display, connector, seat, tty, argc, argv);
 }
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 61868af..cae7ba3 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -755,7 +755,8 @@ 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 width, int height, const char *display_name,
+			  int argc, char *argv[])
 {
 	struct wayland_compositor *c;
 	struct wl_event_loop *loop;
@@ -789,7 +790,7 @@ 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) < 0)
+	if (weston_compositor_init(&c->base, display, argc, argv) < 0)
 		return NULL;
 
 	if (wayland_input_create(c) < 0)
@@ -826,5 +827,6 @@ backend_init(struct wl_display *display, int argc, char *argv[])
 	parse_options(wayland_options,
 		      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);
 }
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index c148474..ac6dce4 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -847,7 +847,8 @@ 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 width, int height, int count, int fullscreen,
+		      int argc, char *argv[])
 {
 	struct x11_compositor *c;
 	xcb_screen_iterator_t s;
@@ -882,7 +883,7 @@ 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) < 0)
+	if (weston_compositor_init(&c->base, display, argc, argv) < 0)
 		return NULL;
 
 	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);
 
 	return x11_compositor_create(display,
-				     width, height, count, fullscreen);
+				     width, height, count, fullscreen,
+				     argc, argv);
 }
diff --git a/src/compositor.c b/src/compositor.c
index d450ac3..f9c9b2c 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2838,7 +2838,10 @@ compositor_bind(struct wl_client *client,
 }
 
 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;
 	const char *extensions;
diff --git a/src/compositor.h b/src/compositor.h
index 693b723..e00dfe3 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -623,7 +623,8 @@ uint32_t
 weston_compositor_get_time(void);
 
 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
 weston_compositor_shutdown(struct weston_compositor *ec);
 void
-- 
1.7.10



More information about the wayland-devel mailing list