summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-02-07 09:57:25 -0500
committerKristian Høgsberg <krh@bitplanet.net>2012-02-07 09:57:25 -0500
commit2e28b10a3f30d2f229cd321499cda0e54dcc5eb6 (patch)
tree7254c10a2e12166a237408ef0117617cfa05b1c7
parentd11d9444352b01712111f318fe49f8f41bc01119 (diff)
compositor-wayland: Add display sub-option for wayland backend
This lets us launch the compositor on a separate wayland socket that what we're listening on.
-rw-r--r--src/compositor-wayland.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index ad09b84..f0501d7 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -492,7 +492,8 @@ wayland_destroy(struct weston_compositor *ec)
}
static struct weston_compositor *
-wayland_compositor_create(struct wl_display *display, int width, int height)
+wayland_compositor_create(struct wl_display *display,
+ int width, int height, const char *display_name)
{
struct wayland_compositor *c;
struct wl_event_loop *loop;
@@ -504,7 +505,7 @@ wayland_compositor_create(struct wl_display *display, int width, int height)
memset(c, 0, sizeof *c);
- c->parent.display = wl_display_connect(NULL);
+ c->parent.display = wl_display_connect(display_name);
if (c->parent.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
@@ -552,9 +553,9 @@ WL_EXPORT struct weston_compositor *
backend_init(struct wl_display *display, char *options)
{
int width = 1024, height = 640, i;
- char *p, *value;
+ char *p, *value, *display_name = NULL;
- static char * const tokens[] = { "width", "height", NULL };
+ static char * const tokens[] = { "width", "height", "display", NULL };
p = options;
while (i = getsubopt(&p, tokens, &value), i != -1) {
@@ -565,8 +566,11 @@ backend_init(struct wl_display *display, char *options)
case 1:
height = strtol(value, NULL, 0);
break;
+ case 2:
+ display_name = strdup(value);
+ break;
}
}
- return wayland_compositor_create(display, width, height);
+ return wayland_compositor_create(display, width, height, display_name);
}