commit b8a726908351a07a370f1f22bf2830e911451aa5
parent 6e324f8370afbfcb55a260d073068925480ef90c
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 21 Jun 2013 01:05:54 -0700
Use resource accessor methods
Diffstat:
9 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/compositor.c b/compositor.c
@@ -192,7 +192,7 @@ static void handle_drm_event(struct wl_listener * listener, void * data)
static void handle_surface_destroy(struct wl_listener * listener, void * data)
{
struct wl_resource * resource = data;
- struct swc_surface * surface = resource->data;
+ struct swc_surface * surface = wl_resource_get_user_data(resource);
wl_list_remove(&surface->link);
@@ -218,7 +218,7 @@ static void handle_switch_vt(uint32_t time, uint32_t value, void * data)
static void create_surface(struct wl_client * client,
struct wl_resource * resource, uint32_t id)
{
- struct swc_compositor * compositor = resource->data;
+ struct swc_compositor * compositor = wl_resource_get_user_data(resource);
struct swc_surface * surface;
struct swc_output * output;
diff --git a/data_device_manager.c b/data_device_manager.c
@@ -12,7 +12,7 @@ static void get_data_device(struct wl_client * client,
struct wl_resource * resource, uint32_t id,
struct wl_resource * seat_resource)
{
- struct swc_seat * seat = seat_resource->data;
+ struct swc_seat * seat = wl_resource_get_user_data(seat_resource);
printf("get_data_device\n");
diff --git a/keyboard.c b/keyboard.c
@@ -75,7 +75,7 @@ struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
client_resource = wl_client_add_object(client, &wl_keyboard_interface,
NULL, id, NULL);
wl_resource_set_destructor(client_resource, &swc_unbind_resource);
- wl_list_insert(&keyboard->resources, &client_resource->link);
+ wl_list_insert(&keyboard->resources, wl_resource_get_link(client_resource));
printf("keyboard: adding client %p, resource: %p\n", client, client_resource);
diff --git a/output.c b/output.c
@@ -20,8 +20,8 @@ static void bind_output(struct wl_client * client, void * data,
resource = wl_client_add_object(client, &wl_output_interface, NULL, id,
output);
- wl_list_insert(&output->resource_list, &resource->link);
- resource->destroy = &swc_unbind_resource;
+ wl_list_insert(&output->resource_list, wl_resource_get_link(resource));
+ wl_resource_set_destructor(resource, &swc_unbind_resource);
wl_output_send_geometry(resource, output->x, output->y,
output->physical_width, output->physical_height, 0, "unknown",
diff --git a/pointer.c b/pointer.c
@@ -78,8 +78,8 @@ static void set_cursor(struct wl_client * client,
struct wl_resource * surface_resource,
int32_t hotspot_x, int32_t hotspot_y)
{
- struct swc_pointer * pointer = resource->data;
- struct swc_surface * surface = surface_resource->data;
+ struct swc_pointer * pointer = wl_resource_get_user_data(resource);
+ struct swc_surface * surface = wl_resource_get_user_data(surface_resource);
struct swc_event event;
printf("set_cursor\n");
@@ -108,7 +108,8 @@ struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
client_resource = wl_client_add_object(client, &wl_pointer_interface,
&pointer_implementation, id, pointer);
wl_resource_set_destructor(client_resource, &swc_unbind_resource);
- wl_list_insert(&pointer->resources, &client_resource->link);
+ wl_list_insert(&pointer->resources,
+ wl_resource_get_user_data(client_resource));
return client_resource;
}
diff --git a/region.c b/region.c
@@ -10,7 +10,7 @@ static void destroy(struct wl_client * client, struct wl_resource * resource)
static void add(struct wl_client * client, struct wl_resource * resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
- struct swc_region * region = resource->data;
+ struct swc_region * region = wl_resource_get_user_data(resource);
pixman_region32_union_rect(®ion->region, ®ion->region,
x, y, width, height);
@@ -19,7 +19,7 @@ static void add(struct wl_client * client, struct wl_resource * resource,
static void subtract(struct wl_client * client, struct wl_resource * resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
- struct swc_region * region = resource->data;
+ struct swc_region * region = wl_resource_get_user_data(resource);
pixman_region32_t operand;
pixman_region32_init_rect(&operand, x, y, width, height);
diff --git a/seat.c b/seat.c
@@ -159,7 +159,7 @@ static void handle_evdev_event(struct wl_listener * listener, void * data)
static void get_pointer(struct wl_client * client, struct wl_resource * resource,
uint32_t id)
{
- struct swc_seat * seat = resource->data;
+ struct swc_seat * seat = wl_resource_get_user_data(resource);
struct swc_pointer * pointer = &seat->pointer;
swc_pointer_bind(pointer, client, id);
@@ -210,7 +210,7 @@ static void bind_seat(struct wl_client * client, void * data, uint32_t version,
resource = wl_client_add_object(client, &wl_seat_interface,
&seat_implementation, id, seat);
- wl_list_insert(&seat->resources, &resource->link);
+ wl_list_insert(&seat->resources, wl_resource_get_link(resource));
wl_resource_set_destructor(resource, &swc_unbind_resource);
wl_seat_send_capabilities(resource, seat->capabilities);
diff --git a/surface.c b/surface.c
@@ -42,14 +42,14 @@ static void destroy(struct wl_client * client, struct wl_resource * resource)
static void attach(struct wl_client * client, struct wl_resource * resource,
struct wl_resource * buffer_resource, int32_t x, int32_t y)
{
- struct swc_surface * surface = resource->data;
+ struct swc_surface * surface = wl_resource_get_user_data(resource);
surface->pending.x = x;
surface->pending.y = y;
if (buffer_resource)
{
- struct wl_buffer * buffer = buffer_resource->data;
+ struct wl_buffer * buffer = wl_resource_get_user_data(buffer_resource);
surface->pending.state.buffer = buffer;
surface->geometry.width = buffer->width;
@@ -67,7 +67,7 @@ static void attach(struct wl_client * client, struct wl_resource * resource,
static void damage(struct wl_client * client, struct wl_resource * resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
- struct swc_surface * surface = resource->data;
+ struct swc_surface * surface = wl_resource_get_user_data(resource);
pixman_region32_union_rect(&surface->pending.state.damage,
&surface->pending.state.damage,
@@ -77,26 +77,26 @@ static void damage(struct wl_client * client, struct wl_resource * resource,
static void frame(struct wl_client * client, struct wl_resource * resource,
uint32_t id)
{
- struct swc_surface * surface = resource->data;
+ struct swc_surface * surface = wl_resource_get_user_data(resource);
struct wl_resource * callback_resource;
callback_resource = wl_client_add_object(client, &wl_callback_interface,
NULL, id, NULL);
wl_list_insert(surface->pending.state.frame_callbacks.prev,
- &callback_resource->link);
+ wl_resource_get_link(callback_resource));
}
static void set_opaque_region(struct wl_client * client,
struct wl_resource * resource,
struct wl_resource * region_resource)
{
- struct swc_surface * surface = resource->data;
+ struct swc_surface * surface = wl_resource_get_user_data(resource);
//printf("surface_set_opaque_region\n");
if (region_resource)
{
- struct swc_region * region = region_resource->data;
+ struct swc_region * region = wl_resource_get_user_data(region_resource);
pixman_region32_copy(&surface->pending.state.opaque, ®ion->region);
}
@@ -108,13 +108,13 @@ static void set_input_region(struct wl_client * client,
struct wl_resource * resource,
struct wl_resource * region_resource)
{
- struct swc_surface * surface = resource->data;
+ struct swc_surface * surface = wl_resource_get_user_data(resource);
printf("surface.set_input_region\n");
if (region_resource)
{
- struct swc_region * region = region_resource->data;
+ struct swc_region * region = wl_resource_get_user_data(region_resource);
pixman_region32_copy(&surface->pending.state.input, ®ion->region);
}
@@ -124,7 +124,7 @@ static void set_input_region(struct wl_client * client,
static void commit(struct wl_client * client, struct wl_resource * resource)
{
- struct swc_surface * surface = resource->data;
+ struct swc_surface * surface = wl_resource_get_user_data(resource);
struct swc_event event;
event.data = surface;
diff --git a/util.c b/util.c
@@ -5,7 +5,7 @@
void swc_unbind_resource(struct wl_resource * resource)
{
- wl_list_remove(&resource->link);
+ wl_list_remove(wl_resource_get_link(resource));
free(resource);
}