mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-09 05:58:22 +02:00
Use wl_display_bind() for binding to globals
This commit is contained in:
parent
d9551a3377
commit
f790c79ec7
6 changed files with 29 additions and 17 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue