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-29 17:12:36 -0400
commitf790c79ec71a371552077253539efeeb7966a9d1 (patch)
tree923769079360102af9067366628ef7757fa4deab
parentd9551a3377698841aacbb26b801cca37c03f47fc (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 2ffbee2a..8365639c 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 7b45005e..f064fcd8 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 fad04aa9..128ce117 100644
--- a/compositor/compositor-wayland.c
+++ b/compositor/compositor-wayland.c
@@ -453,7 +453,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,
@@ -470,7 +471,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;
}
}
@@ -486,16 +488,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 0daf2060..2cf0f2ce 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 26c4c085..f81abadb 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 51c23528..ba4669da 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");