};
struct input_panel_surface {
- struct wl_resource resource;
+ struct wl_resource *resource;
+ struct wl_signal destroy_signal;
struct desktop_shell *shell;
static void
destroy_input_panel_surface(struct input_panel_surface *input_panel_surface)
{
+ wl_signal_emit(&input_panel_surface->destroy_signal, input_panel_surface);
+
wl_list_remove(&input_panel_surface->surface_destroy_listener.link);
wl_list_remove(&input_panel_surface->link);
struct input_panel_surface,
surface_destroy_listener);
- if (ipsurface->resource.client) {
- wl_resource_destroy(&ipsurface->resource);
+ if (ipsurface->resource) {
+ wl_resource_destroy(ipsurface->resource);
} else {
- wl_signal_emit(&ipsurface->resource.destroy_signal,
- &ipsurface->resource);
destroy_input_panel_surface(ipsurface);
}
}
+
static struct input_panel_surface *
create_input_panel_surface(struct desktop_shell *shell,
struct weston_surface *surface)
input_panel_surface->surface = surface;
- wl_signal_init(&input_panel_surface->resource.destroy_signal);
+ wl_signal_init(&input_panel_surface->destroy_signal);
input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy;
wl_signal_add(&surface->destroy_signal,
&input_panel_surface->surface_destroy_listener);
struct wl_resource *output_resource,
uint32_t position)
{
- struct input_panel_surface *input_panel_surface = resource->data;
+ struct input_panel_surface *input_panel_surface =
+ wl_resource_get_user_data(resource);
struct desktop_shell *shell = input_panel_surface->shell;
wl_list_insert(&shell->input_panel.surfaces,
input_panel_surface_set_overlay_panel(struct wl_client *client,
struct wl_resource *resource)
{
- struct input_panel_surface *input_panel_surface = resource->data;
+ struct input_panel_surface *input_panel_surface =
+ wl_resource_get_user_data(resource);
struct desktop_shell *shell = input_panel_surface->shell;
wl_list_insert(&shell->input_panel.surfaces,
static void
destroy_input_panel_surface_resource(struct wl_resource *resource)
{
- struct input_panel_surface *ipsurf = resource->data;
+ struct input_panel_surface *ipsurf =
+ wl_resource_get_user_data(resource);
destroy_input_panel_surface(ipsurf);
}
return;
}
- ipsurf->resource.destroy = destroy_input_panel_surface_resource;
- ipsurf->resource.object.id = id;
- ipsurf->resource.object.interface = &wl_input_panel_surface_interface;
- ipsurf->resource.object.implementation =
- (void (**)(void)) &input_panel_surface_implementation;
- ipsurf->resource.data = ipsurf;
+ ipsurf->resource = wl_client_add_object(client,
+ &wl_input_panel_surface_interface,
+ &input_panel_surface_implementation,
+ id, ipsurf);
- wl_client_add_resource(client, &ipsurf->resource);
+ wl_resource_set_destructor(ipsurf->resource,
+ destroy_input_panel_surface_resource);
}
static const struct wl_input_panel_interface input_panel_implementation = {
id, shell);
if (shell->input_panel.binding == NULL) {
- resource->destroy = unbind_input_panel;
+ wl_resource_set_destructor(resource, unbind_input_panel);
shell->input_panel.binding = resource;
return;
}
};
struct tablet_shell {
- struct wl_resource resource;
+ struct wl_resource *resource;
struct wl_listener lock_listener;
struct wl_listener unlock_listener;
};
struct tablet_client {
- struct wl_resource resource;
+ struct wl_resource *resource;
struct tablet_shell *shell;
struct wl_client *client;
struct weston_surface *surface;
tablet_shell_set_state(shell, STATE_LOCKED);
shell->previous_state = STATE_HOME;
- tablet_shell_send_show_lockscreen(&shell->resource);
+ tablet_shell_send_show_lockscreen(shell->resource);
}
} else if (shell->current_client &&
shell->current_client->surface != surface &&
struct wl_resource *resource,
struct wl_resource *surface_resource)
{
- struct tablet_shell *shell = resource->data;
+ struct tablet_shell *shell = wl_resource_get_user_data(resource);
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
weston_surface_set_position(es, 0, 0);
struct wl_resource *resource,
struct wl_resource *surface_resource)
{
- struct tablet_shell *shell = resource->data;
+ struct tablet_shell *shell = wl_resource_get_user_data(resource);
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
/* FIXME: Switcher should be centered and the compositor
struct wl_resource *resource,
struct wl_resource *surface_resource)
{
- struct tablet_shell *shell = resource->data;
+ struct tablet_shell *shell = wl_resource_get_user_data(resource);
shell->home_surface = wl_resource_get_user_data(surface_resource);
shell->home_surface->configure = tablet_shell_surface_configure;
struct wl_resource *resource,
struct wl_resource *surface_resource)
{
- struct tablet_shell *shell = resource->data;
+ struct tablet_shell *shell = wl_resource_get_user_data(resource);
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
tablet_shell_switch_to(shell, es);
struct wl_resource *resource,
struct wl_resource *surface_resource)
{
- struct tablet_shell *shell = resource->data;
+ struct tablet_shell *shell = wl_resource_get_user_data(resource);
struct weston_surface *es = wl_resource_get_user_data(surface_resource);
tablet_shell_switch_to(shell, es);
destroy_tablet_client(struct wl_resource *resource)
{
struct tablet_client *tablet_client =
- container_of(resource, struct tablet_client, resource);
+ wl_resource_get_user_data(resource);
free(tablet_client->name);
free(tablet_client);
static void
tablet_client_activate(struct wl_client *client, struct wl_resource *resource)
{
- struct tablet_client *tablet_client = resource->data;
+ struct tablet_client *tablet_client = wl_resource_get_user_data(resource);
struct tablet_shell *shell = tablet_client->shell;
shell->current_client = tablet_client;
struct wl_resource *resource,
uint32_t id, const char *name, int fd)
{
- struct tablet_shell *shell = resource->data;
+ struct tablet_shell *shell = wl_resource_get_user_data(resource);
struct weston_compositor *compositor = shell->compositor;
struct tablet_client *tablet_client;
tablet_client->shell = shell;
tablet_client->name = strdup(name);
- tablet_client->resource.destroy = destroy_tablet_client;
- tablet_client->resource.object.id = id;
- tablet_client->resource.object.interface =
- &tablet_client_interface;
- tablet_client->resource.object.implementation =
- (void (**)(void)) &tablet_client_implementation;
+ tablet_client->resource = wl_client_add_object(client,
+ &tablet_client_interface,
+ &tablet_client_implementation,
+ id, tablet_client);
+ wl_resource_set_destructor(tablet_client->resource,
+ destroy_tablet_client);
- wl_client_add_resource(client, &tablet_client->resource);
tablet_client->surface = NULL;
shell->current_client = tablet_client;
{
switch (shell->state) {
case STATE_SWITCHER:
- tablet_shell_send_hide_switcher(&shell->resource);
+ tablet_shell_send_hide_switcher(shell->resource);
break;
default:
- tablet_shell_send_show_switcher(&shell->resource);
+ tablet_shell_send_show_switcher(shell->resource);
tablet_shell_set_state(shell, STATE_SWITCHER);
break;
}
if (shell->state == STATE_LOCKED)
return;
if (shell->state == STATE_SWITCHER)
- tablet_shell_send_hide_switcher(&shell->resource);
+ tablet_shell_send_hide_switcher(shell->resource);
- tablet_shell_send_show_lockscreen(&shell->resource);
+ tablet_shell_send_show_lockscreen(shell->resource);
tablet_shell_set_state(shell, STATE_LOCKED);
}
go_home(struct tablet_shell *shell, struct weston_seat *seat)
{
if (shell->state == STATE_SWITCHER)
- tablet_shell_send_hide_switcher(&shell->resource);
+ tablet_shell_send_hide_switcher(shell->resource);
weston_surface_activate(shell->home_surface, seat);
* tries to access the object?. */
return;
- shell->resource.object.id = id;
- shell->resource.object.interface = &tablet_shell_interface;
- shell->resource.object.implementation =
- (void (**)(void)) &tablet_shell_implementation;
- shell->resource.client = client;
- shell->resource.data = shell;
- shell->resource.destroy = destroy_tablet_shell;
-
- wl_client_add_resource(client, &shell->resource);
+ shell->resource = wl_client_add_object(client,
+ &tablet_shell_interface,
+ &tablet_shell_implementation,
+ id, shell);
+ wl_resource_set_destructor(shell->resource, destroy_tablet_shell);
}
static void