From a0d2dde6cd31e60595b9cf5b8901a5b3e0fee0ab Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 14 Jun 2013 10:08:01 -0500 Subject: [PATCH] output: Use wl_resource_get accessors for weston_output resources Signed-off-by: Jason Ekstrand --- src/compositor.c | 21 ++++----------------- src/data-device.c | 6 +++--- src/screenshooter.c | 3 ++- src/shell.c | 12 ++++++------ 4 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 38ef0958..e57f61fe 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -502,19 +502,6 @@ weston_surface_damage_below(struct weston_surface *surface) pixman_region32_fini(&damage); } -static struct wl_resource * -find_resource_for_client(struct wl_list *list, struct wl_client *client) -{ - struct wl_resource *r; - - wl_list_for_each(r, list, link) { - if (r->client == client) - return r; - } - - return NULL; -} - static void weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask) { @@ -536,7 +523,7 @@ weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask) wl_list_for_each(output, &es->compositor->output_list, link) { if (1 << output->id & different) resource = - find_resource_for_client(&output->resource_list, + wl_resource_find_for_client(&output->resource_list, client); if (resource == NULL) continue; @@ -2489,7 +2476,7 @@ weston_compositor_stack_plane(struct weston_compositor *ec, static void unbind_resource(struct wl_resource *resource) { - wl_list_remove(&resource->link); + wl_list_remove(wl_resource_get_link(resource)); free(resource); } @@ -2504,8 +2491,8 @@ bind_output(struct wl_client *client, resource = wl_client_add_object(client, &wl_output_interface, NULL, id, data); - wl_list_insert(&output->resource_list, &resource->link); - resource->destroy = unbind_resource; + wl_list_insert(&output->resource_list, wl_resource_get_link(resource)); + wl_resource_set_destructor(resource, unbind_resource); wl_output_send_geometry(resource, output->x, diff --git a/src/data-device.c b/src/data-device.c index 1735620d..37f6996f 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -366,8 +366,8 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, uint32_t serial) { - struct weston_seat *seat = resource->data; - struct weston_drag *drag = resource->data; + struct weston_seat *seat = wl_resource_get_user_data(resource); + struct weston_drag *drag = wl_resource_get_user_data(resource); struct weston_surface *icon = NULL; if (seat->pointer->button_count == 0 || @@ -573,7 +573,7 @@ get_data_device(struct wl_client *client, struct wl_resource *manager_resource, uint32_t id, struct wl_resource *seat_resource) { - struct weston_seat *seat = seat_resource->data; + struct weston_seat *seat = wl_resource_get_user_data(seat_resource); struct wl_resource *resource; resource = wl_client_add_object(client, &wl_data_device_interface, diff --git a/src/screenshooter.c b/src/screenshooter.c index 3a4f6c23..1fdfc9a0 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -175,7 +175,8 @@ screenshooter_shoot(struct wl_client *client, struct wl_resource *output_resource, struct wl_resource *buffer_resource) { - struct weston_output *output = output_resource->data; + struct weston_output *output = + wl_resource_get_user_data(output_resource); struct screenshooter_frame_listener *l; struct wl_buffer *buffer = buffer_resource->data; diff --git a/src/shell.c b/src/shell.c index 7660f156..a3b1b1f8 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1717,7 +1717,7 @@ shell_surface_set_maximized(struct wl_client *client, /* get the default output, if the client set it as NULL check whether the ouput is available */ if (output_resource) - shsurf->output = output_resource->data; + shsurf->output = wl_resource_get_user_data(output_resource); else if (es->output) shsurf->output = es->output; else @@ -1930,7 +1930,7 @@ shell_surface_set_fullscreen(struct wl_client *client, struct weston_output *output; if (output_resource) - output = output_resource->data; + output = wl_resource_get_user_data(output_resource); else output = NULL; @@ -2449,7 +2449,7 @@ desktop_shell_set_background(struct wl_client *client, surface->configure = background_configure; surface->configure_private = shell; - surface->output = output_resource->data; + surface->output = wl_resource_get_user_data(output_resource); desktop_shell_send_configure(resource, 0, surface_resource, surface->output->width, @@ -2483,7 +2483,7 @@ desktop_shell_set_panel(struct wl_client *client, surface->configure = panel_configure; surface->configure_private = shell; - surface->output = output_resource->data; + surface->output = wl_resource_get_user_data(output_resource); desktop_shell_send_configure(resource, 0, surface_resource, surface->output->width, @@ -3675,7 +3675,7 @@ screensaver_set_surface(struct wl_client *client, struct desktop_shell *shell = wl_resource_get_user_data(resource); struct weston_surface *surface = wl_resource_get_user_data(surface_resource); - struct weston_output *output = output_resource->data; + struct weston_output *output = wl_resource_get_user_data(output_resource); surface->configure = screensaver_configure; surface->configure_private = shell; @@ -3838,7 +3838,7 @@ input_panel_surface_set_toplevel(struct wl_client *client, wl_list_insert(&shell->input_panel.surfaces, &input_panel_surface->link); - input_panel_surface->output = output_resource->data; + input_panel_surface->output = wl_resource_get_user_data(output_resource); input_panel_surface->panel = 0; }