summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2011-08-19 14:41:57 -0400
committerKristian Høgsberg <krh@bitplanet.net>2011-08-19 14:41:57 -0400
commit419e40718a252f739a34c19e9baae3b49912fb0f (patch)
treecf4fc222536f0928fea254ab79e1870ee8771bbf
parent3d85c1271e4c76a492b2da6f711d68fde8ea082f (diff)
Use wl_display_bind() for binding to globals
-rw-r--r--clients/simple-egl.c7
-rw-r--r--clients/simple-shm.c13
-rw-r--r--compositor/compositor-wayland.c15
-rw-r--r--compositor/compositor.c5
-rw-r--r--compositor/meego-tablet-shell.c3
-rw-r--r--compositor/xserver-launcher.c3
6 files changed, 29 insertions, 17 deletions
diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index 2ffbee2..8365639 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -299,7 +299,7 @@ compositor_handle_visual(void *data,
switch (token) {
case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32:
d->premultiplied_argb_visual =
- wl_visual_create(d->display, id, 1);
+ wl_display_bind(d->display, id, &wl_visual_interface);
break;
}
}
@@ -315,11 +315,12 @@ display_handle_global(struct wl_display *display, uint32_t id,
struct display *d = data;
if (strcmp(interface, "wl_compositor") == 0) {
- d->compositor = wl_compositor_create(display, id, 1);
+ d->compositor =
+ wl_display_bind(display, id, &wl_compositor_interface);
wl_compositor_add_listener(d->compositor,
&compositor_listener, d);
} else if (strcmp(interface, "wl_shell") == 0) {
- d->shell = wl_shell_create(display, id, 1);
+ d->shell = wl_display_bind(display, id, &wl_shell_interface);
}
}
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index 7b45005..f064fcd 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -152,7 +152,8 @@ compositor_handle_visual(void *data,
switch (token) {
case WL_COMPOSITOR_VISUAL_XRGB32:
- d->xrgb_visual = wl_visual_create(d->display, id, 1);
+ d->xrgb_visual = wl_display_bind(d->display,
+ id, &wl_visual_interface);
break;
}
}
@@ -168,13 +169,14 @@ display_handle_global(struct wl_display *display, uint32_t id,
struct display *d = data;
if (strcmp(interface, "wl_compositor") == 0) {
- d->compositor = wl_compositor_create(display, id, 1);
+ d->compositor =
+ wl_display_bind(display, id, &wl_compositor_interface);
wl_compositor_add_listener(d->compositor,
&compositor_listener, d);
} else if (strcmp(interface, "wl_shell") == 0) {
- d->shell = wl_shell_create(display, id, 1);
+ d->shell = wl_display_bind(display, id, &wl_shell_interface);
} else if (strcmp(interface, "wl_shm") == 0) {
- d->shm = wl_shm_create(display, id, 1);
+ d->shm = wl_display_bind(display, id, &wl_shm_interface);
}
}
@@ -192,6 +194,7 @@ static struct display *
create_display(void)
{
struct display *display;
+ int i;
display = malloc(sizeof *display);
display->display = wl_display_connect(NULL);
@@ -203,7 +206,7 @@ create_display(void)
wl_display_get_fd(display->display, event_mask_update, display);
- while (!display->xrgb_visual)
+ while (display->xrgb_visual)
wl_display_roundtrip(display->display);
return display;
diff --git a/compositor/compositor-wayland.c b/compositor/compositor-wayland.c
index 6e12eec..fc67341 100644
--- a/compositor/compositor-wayland.c
+++ b/compositor/compositor-wayland.c
@@ -439,7 +439,8 @@ display_add_input(struct wayland_compositor *c, uint32_t id)
memset(input, 0, sizeof *input);
input->compositor = c;
- input->input_device = wl_input_device_create(c->parent.display, id, 1);
+ input->input_device = wl_display_bind(c->parent.display,
+ id, &wl_input_device_interface);
wl_list_insert(c->input_list.prev, &input->link);
wl_input_device_add_listener(input->input_device,
@@ -456,7 +457,8 @@ compositor_handle_visual(void *data,
switch (token) {
case WL_COMPOSITOR_VISUAL_ARGB32:
- c->parent.visual = wl_visual_create(c->parent.display, id, 1);
+ c->parent.visual = wl_display_bind(c->parent.display,
+ id, &wl_visual_interface);
break;
}
}
@@ -472,16 +474,19 @@ display_handle_global(struct wl_display *display, uint32_t id,
struct wayland_compositor *c = data;
if (strcmp(interface, "wl_compositor") == 0) {
- c->parent.compositor = wl_compositor_create(display, id, 1);
+ c->parent.compositor =
+ wl_display_bind(display, id, &wl_compositor_interface);
wl_compositor_add_listener(c->parent.compositor,
&compositor_listener, c);
} else if (strcmp(interface, "wl_output") == 0) {
- c->parent.output = wl_output_create(display, id, 1);
+ c->parent.output =
+ wl_display_bind(display, id, &wl_output_interface);
wl_output_add_listener(c->parent.output, &output_listener, c);
} else if (strcmp(interface, "wl_input_device") == 0) {
display_add_input(c, id);
} else if (strcmp(interface, "wl_shell") == 0) {
- c->parent.shell = wl_shell_create(display, id, 1);
+ c->parent.shell =
+ wl_display_bind(display, id, &wl_shell_interface);
wl_shell_add_listener(c->parent.shell, &shell_listener, c);
}
}
diff --git a/compositor/compositor.c b/compositor/compositor.c
index e01d625..8061092 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -1655,14 +1655,15 @@ wlsc_input_device_init(struct wlsc_input_device *device,
}
static void
-wlsc_output_post_geometry(struct wl_client *client,
- struct wl_object *global, uint32_t version)
+wlsc_output_post_geometry(struct wl_client *client, struct wl_object *global,
+ uint32_t version, uint32_t id)
{
struct wlsc_output *output =
container_of(global, struct wlsc_output, resource.object);
struct wlsc_mode *mode;
output->resource.client = client;
+ output->resource.object.id = id;
wl_resource_post_event(&output->resource,
WL_OUTPUT_GEOMETRY,
output->x,
diff --git a/compositor/meego-tablet-shell.c b/compositor/meego-tablet-shell.c
index 26c4c08..f81abad 100644
--- a/compositor/meego-tablet-shell.c
+++ b/compositor/meego-tablet-shell.c
@@ -623,7 +623,7 @@ meego_tablet_shell_set_selection_focus(struct wlsc_shell *shell,
static void
bind_shell(struct wl_client *client,
- struct wl_object *global, uint32_t version)
+ struct wl_object *global, uint32_t version, uint32_t id)
{
struct meego_tablet_shell *shell =
container_of(global,
@@ -635,6 +635,7 @@ bind_shell(struct wl_client *client,
return;
shell->resource.client = client;
+ shell->resource.object.id = id;
}
void
diff --git a/compositor/xserver-launcher.c b/compositor/xserver-launcher.c
index 51c2352..ba4669d 100644
--- a/compositor/xserver-launcher.c
+++ b/compositor/xserver-launcher.c
@@ -460,7 +460,7 @@ wlsc_wm_destroy(struct wlsc_wm *wm)
static void
wlsc_xserver_bind(struct wl_client *client,
- struct wl_object *global, uint32_t version)
+ struct wl_object *global, uint32_t version, uint32_t id)
{
struct wlsc_xserver *wxs =
container_of(global, struct wlsc_xserver,
@@ -471,6 +471,7 @@ wlsc_xserver_bind(struct wl_client *client,
if (client != wxs->xserver.resource.client)
return;
+ wxs->xserver.resource.object.id = id;
wxs->wm = wlsc_wm_create(wxs);
if (wxs == NULL) {
fprintf(stderr, "failed to create wm\n");