Use wl_resource_get_user_data for weston_surface resources

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Jason Ekstrand 2013-06-14 10:07:53 -05:00 committed by Kristian Høgsberg
parent de4667351c
commit 0f2ef7ebd3
6 changed files with 42 additions and 31 deletions

View file

@ -1410,7 +1410,7 @@ surface_attach(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *buffer_resource, int32_t sx, int32_t sy)
{
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
struct wl_buffer *buffer = NULL;
if (buffer_resource)
@ -1436,7 +1436,7 @@ surface_damage(struct wl_client *client,
struct wl_resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
pixman_region32_union_rect(&surface->pending.damage,
&surface->pending.damage,
@ -1457,7 +1457,7 @@ surface_frame(struct wl_client *client,
struct wl_resource *resource, uint32_t callback)
{
struct weston_frame_callback *cb;
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
cb = malloc(sizeof *cb);
if (cb == NULL) {
@ -1480,7 +1480,7 @@ surface_set_opaque_region(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *region_resource)
{
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
struct weston_region *region;
if (region_resource) {
@ -1497,7 +1497,7 @@ surface_set_input_region(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *region_resource)
{
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
struct weston_region *region;
if (region_resource) {
@ -1607,7 +1607,7 @@ weston_subsurface_parent_commit(struct weston_subsurface *sub,
static void
surface_commit(struct wl_client *client, struct wl_resource *resource)
{
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
struct weston_subsurface *sub = weston_surface_to_subsurface(surface);
if (sub) {
@ -1627,7 +1627,7 @@ static void
surface_set_buffer_transform(struct wl_client *client,
struct wl_resource *resource, int transform)
{
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
surface->pending.buffer_transform = transform;
}
@ -1637,7 +1637,7 @@ surface_set_buffer_scale(struct wl_client *client,
struct wl_resource *resource,
int32_t scale)
{
struct weston_surface *surface = resource->data;
struct weston_surface *surface = wl_resource_get_user_data(resource);
surface->pending.buffer_scale = scale;
}
@ -2058,7 +2058,8 @@ subsurface_place_above(struct wl_client *client,
struct wl_resource *sibling_resource)
{
struct weston_subsurface *sub = resource->data;
struct weston_surface *surface = sibling_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(sibling_resource);
struct weston_subsurface *sibling;
if (!sub)
@ -2079,7 +2080,8 @@ subsurface_place_below(struct wl_client *client,
struct wl_resource *sibling_resource)
{
struct weston_subsurface *sub = resource->data;
struct weston_surface *surface = sibling_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(sibling_resource);
struct weston_subsurface *sibling;
if (!sub)
@ -2321,8 +2323,10 @@ subcompositor_get_subsurface(struct wl_client *client,
struct wl_resource *surface_resource,
struct wl_resource *parent_resource)
{
struct weston_surface *surface = surface_resource->data;
struct weston_surface *parent = parent_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
struct weston_surface *parent =
wl_resource_get_user_data(parent_resource);
struct weston_subsurface *sub;
static const char where[] = "get_subsurface: wl_subsurface@";

View file

@ -372,13 +372,13 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
if (seat->pointer->button_count == 0 ||
seat->pointer->grab_serial != serial ||
seat->pointer->focus != origin_resource->data)
seat->pointer->focus != wl_resource_get_user_data(origin_resource))
return;
/* FIXME: Check that the data source type array isn't empty. */
if (icon_resource)
icon = icon_resource->data;
icon = wl_resource_get_user_data(icon_resource);
if (icon && icon->configure) {
wl_resource_post_error(icon_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
@ -493,7 +493,7 @@ data_device_set_selection(struct wl_client *client,
return;
/* FIXME: Store serial and check against incoming serial here. */
weston_seat_set_selection(resource->data, source_resource->data,
weston_seat_set_selection(resource->data, wl_resource_get_user_data(source_resource),
serial);
}

View file

@ -1108,7 +1108,7 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
struct weston_surface *surface = NULL;
if (surface_resource)
surface = surface_resource->data;
surface = wl_resource_get_user_data(surface_resource);
if (pointer->focus == NULL)
return;

View file

@ -985,7 +985,7 @@ workspace_manager_move_surface(struct wl_client *client,
{
struct desktop_shell *shell = resource->data;
struct weston_surface *surface =
(struct weston_surface *) surface_resource;
wl_resource_get_user_data(surface_resource);
struct weston_surface *main_surface;
main_surface = weston_surface_get_main_surface(surface);
@ -1668,7 +1668,8 @@ shell_surface_set_transient(struct wl_client *client,
int x, int y, uint32_t flags)
{
struct shell_surface *shsurf = resource->data;
struct weston_surface *parent = parent_resource->data;
struct weston_surface *parent =
wl_resource_get_user_data(parent_resource);
set_transient(shsurf, parent, x, y, flags);
}
@ -2307,7 +2308,8 @@ shell_get_shell_surface(struct wl_client *client,
uint32_t id,
struct wl_resource *surface_resource)
{
struct weston_surface *surface = surface_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
struct desktop_shell *shell = resource->data;
struct shell_surface *shsurf;
@ -2434,7 +2436,8 @@ desktop_shell_set_background(struct wl_client *client,
struct wl_resource *surface_resource)
{
struct desktop_shell *shell = resource->data;
struct weston_surface *surface = surface_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
if (surface->configure) {
wl_resource_post_error(surface_resource,
@ -2467,7 +2470,8 @@ desktop_shell_set_panel(struct wl_client *client,
struct wl_resource *surface_resource)
{
struct desktop_shell *shell = resource->data;
struct weston_surface *surface = surface_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
if (surface->configure) {
wl_resource_post_error(surface_resource,
@ -2521,7 +2525,8 @@ desktop_shell_set_lock_surface(struct wl_client *client,
struct wl_resource *surface_resource)
{
struct desktop_shell *shell = resource->data;
struct weston_surface *surface = surface_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
shell->prepare_event_sent = false;
@ -2585,7 +2590,7 @@ desktop_shell_set_grab_surface(struct wl_client *client,
{
struct desktop_shell *shell = resource->data;
shell->grab_surface = surface_resource->data;
shell->grab_surface = wl_resource_get_user_data(surface_resource);
}
static void
@ -3667,7 +3672,8 @@ screensaver_set_surface(struct wl_client *client,
struct wl_resource *output_resource)
{
struct desktop_shell *shell = resource->data;
struct weston_surface *surface = surface_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
struct weston_output *output = output_resource->data;
surface->configure = screensaver_configure;
@ -3865,7 +3871,8 @@ input_panel_get_input_panel_surface(struct wl_client *client,
uint32_t id,
struct wl_resource *surface_resource)
{
struct weston_surface *surface = surface_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
struct desktop_shell *shell = resource->data;
struct input_panel_surface *ipsurf;

View file

@ -180,7 +180,7 @@ tablet_shell_set_lockscreen(struct wl_client *client,
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
struct weston_surface *es = surface_resource->data;
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
weston_surface_set_position(es, 0, 0);
shell->lockscreen_surface = es;
@ -207,7 +207,7 @@ tablet_shell_set_switcher(struct wl_client *client,
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
struct weston_surface *es = surface_resource->data;
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
/* FIXME: Switcher should be centered and the compositor
* should do the tinting of the background. With the cache
@ -227,7 +227,7 @@ tablet_shell_set_homescreen(struct wl_client *client,
{
struct tablet_shell *shell = resource->data;
shell->home_surface = surface_resource->data;
shell->home_surface = wl_resource_get_user_data(surface_resource);
shell->home_surface->configure = tablet_shell_surface_configure;
weston_surface_set_position(shell->home_surface, 0, 0);
@ -280,7 +280,7 @@ tablet_shell_show_grid(struct wl_client *client,
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
struct weston_surface *es = surface_resource->data;
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
tablet_shell_switch_to(shell, es);
}
@ -291,7 +291,7 @@ tablet_shell_show_panels(struct wl_client *client,
struct wl_resource *surface_resource)
{
struct tablet_shell *shell = resource->data;
struct weston_surface *es = surface_resource->data;
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
tablet_shell_switch_to(shell, es);
}

View file

@ -188,7 +188,7 @@ text_input_activate(struct wl_client *client,
wl_list_insert(&text_input->input_methods, &input_method->link);
input_method_init_seat(weston_seat);
text_input->surface = surface->data;
text_input->surface = wl_resource_get_user_data(surface);
input_method_context_create(text_input, input_method);