Make use of wl_resource.destroy_listener_list for surfaces.
This commit is contained in:
parent
d8e181bd3f
commit
4721a3c912
@ -170,7 +170,6 @@ wlsc_surface_create(struct wlsc_compositor *compositor,
|
||||
if (surface == NULL)
|
||||
return NULL;
|
||||
|
||||
wl_list_init(&surface->surface.destroy_listener_list);
|
||||
wl_list_init(&surface->link);
|
||||
wl_list_init(&surface->buffer_link);
|
||||
surface->map_type = WLSC_SURFACE_MAP_UNMAPPED;
|
||||
@ -232,9 +231,7 @@ destroy_surface(struct wl_resource *resource, struct wl_client *client)
|
||||
{
|
||||
struct wlsc_surface *surface =
|
||||
container_of(resource, struct wlsc_surface, surface.resource);
|
||||
struct wl_listener *l, *next;
|
||||
struct wlsc_compositor *compositor = surface->compositor;
|
||||
uint32_t time;
|
||||
|
||||
wlsc_surface_damage(surface);
|
||||
|
||||
@ -251,11 +248,6 @@ destroy_surface(struct wl_resource *resource, struct wl_client *client)
|
||||
|
||||
wl_list_remove(&surface->buffer_link);
|
||||
|
||||
time = wlsc_compositor_get_time();
|
||||
wl_list_for_each_safe(l, next,
|
||||
&surface->surface.destroy_listener_list, link)
|
||||
l->func(l, &surface->surface, time);
|
||||
|
||||
free(surface);
|
||||
}
|
||||
|
||||
@ -825,7 +817,8 @@ static void
|
||||
surface_destroy(struct wl_client *client,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
wl_resource_destroy(&surface->resource, client);
|
||||
wl_resource_destroy(&surface->resource, client,
|
||||
wlsc_compositor_get_time());
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
|
@ -119,7 +119,7 @@ meego_tablet_shell_set_state(struct meego_tablet_shell *shell, int state)
|
||||
|
||||
static void
|
||||
handle_zoom_surface_destroy(struct wl_listener *listener,
|
||||
struct wl_surface *surface, uint32_t time)
|
||||
struct wl_resource *resource, uint32_t time)
|
||||
{
|
||||
struct meego_tablet_zoom *zoom =
|
||||
container_of(listener, struct meego_tablet_zoom, listener);
|
||||
@ -185,7 +185,7 @@ meego_tablet_zoom_run(struct meego_tablet_shell *shell,
|
||||
zoom->spring.timestamp);
|
||||
|
||||
zoom->listener.func = handle_zoom_surface_destroy;
|
||||
wl_list_insert(surface->surface.destroy_listener_list.prev,
|
||||
wl_list_insert(surface->surface.resource.destroy_listener_list.prev,
|
||||
&zoom->listener.link);
|
||||
|
||||
wl_list_insert(shell->compositor->animation_list.prev,
|
||||
@ -231,7 +231,7 @@ meego_tablet_shell_attach(struct wlsc_shell *base,
|
||||
|
||||
static void
|
||||
handle_lockscreen_surface_destroy(struct wl_listener *listener,
|
||||
struct wl_surface *surface, uint32_t time)
|
||||
struct wl_resource *resource, uint32_t time)
|
||||
{
|
||||
struct meego_tablet_shell *shell =
|
||||
container_of(listener,
|
||||
@ -257,13 +257,13 @@ tablet_shell_set_lockscreen(struct wl_client *client,
|
||||
shell->lockscreen_surface = es;
|
||||
|
||||
shell->lockscreen_listener.func = handle_lockscreen_surface_destroy;
|
||||
wl_list_insert(es->surface.destroy_listener_list.prev,
|
||||
wl_list_insert(es->surface.resource.destroy_listener_list.prev,
|
||||
&shell->lockscreen_listener.link);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_switcher_surface_destroy(struct wl_listener *listener,
|
||||
struct wl_surface *surface, uint32_t time)
|
||||
struct wl_resource *resource, uint32_t time)
|
||||
{
|
||||
struct meego_tablet_shell *shell =
|
||||
container_of(listener,
|
||||
@ -297,7 +297,7 @@ tablet_shell_set_switcher(struct wl_client *client,
|
||||
es, es->width, es->height);
|
||||
|
||||
shell->switcher_listener.func = handle_switcher_surface_destroy;
|
||||
wl_list_insert(es->surface.destroy_listener_list.prev,
|
||||
wl_list_insert(es->surface.resource.destroy_listener_list.prev,
|
||||
&shell->switcher_listener.link);
|
||||
}
|
||||
|
||||
@ -369,7 +369,8 @@ static void
|
||||
tablet_client_destroy(struct wl_client *client,
|
||||
struct meego_tablet_client *tablet_client)
|
||||
{
|
||||
wl_resource_destroy(&tablet_client->resource, client);
|
||||
wl_resource_destroy(&tablet_client->resource,
|
||||
client, wlsc_compositor_get_time());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -299,7 +299,7 @@ wl_drag_set_pointer_focus(struct wl_drag *drag,
|
||||
|
||||
wl_list_remove(&drag->drag_focus_listener.link);
|
||||
if (surface)
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
wl_list_insert(surface->resource.destroy_listener_list.prev,
|
||||
&drag->drag_focus_listener.link);
|
||||
}
|
||||
|
||||
@ -450,7 +450,8 @@ drag_activate(struct wl_client *client,
|
||||
static void
|
||||
drag_destroy(struct wl_client *client, struct wl_drag *drag)
|
||||
{
|
||||
wl_resource_destroy(&drag->resource, client);
|
||||
wl_resource_destroy(&drag->resource, client,
|
||||
wlsc_compositor_get_time());
|
||||
}
|
||||
|
||||
static const struct wl_drag_interface drag_interface = {
|
||||
@ -461,10 +462,11 @@ static const struct wl_drag_interface drag_interface = {
|
||||
|
||||
static void
|
||||
drag_handle_surface_destroy(struct wl_listener *listener,
|
||||
struct wl_surface *surface, uint32_t time)
|
||||
struct wl_resource *resource, uint32_t time)
|
||||
{
|
||||
struct wl_drag *drag =
|
||||
container_of(listener, struct wl_drag, drag_focus_listener);
|
||||
struct wl_surface *surface = (struct wl_surface *) resource;
|
||||
|
||||
if (drag->drag_focus == surface)
|
||||
wl_drag_set_pointer_focus(drag, NULL, time, 0, 0, 0, 0);
|
||||
@ -523,7 +525,7 @@ wlsc_selection_set_focus(struct wlsc_shell *shell,
|
||||
WL_SELECTION_OFFER_OFFER, *p);
|
||||
|
||||
wl_list_remove(&selection->selection_focus_listener.link);
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
wl_list_insert(surface->resource.destroy_listener_list.prev,
|
||||
&selection->selection_focus_listener.link);
|
||||
|
||||
wl_client_post_event(surface->client,
|
||||
@ -536,7 +538,7 @@ wlsc_selection_set_focus(struct wlsc_shell *shell,
|
||||
|
||||
wl_list_remove(&selection->selection_focus_listener.link);
|
||||
if (surface)
|
||||
wl_list_insert(surface->destroy_listener_list.prev,
|
||||
wl_list_insert(surface->resource.destroy_listener_list.prev,
|
||||
&selection->selection_focus_listener.link);
|
||||
}
|
||||
|
||||
@ -604,7 +606,8 @@ selection_activate(struct wl_client *client,
|
||||
static void
|
||||
selection_destroy(struct wl_client *client, struct wl_selection *selection)
|
||||
{
|
||||
wl_resource_destroy(&selection->resource, client);
|
||||
wl_resource_destroy(&selection->resource, client,
|
||||
wlsc_compositor_get_time());
|
||||
}
|
||||
|
||||
static const struct wl_selection_interface selection_interface = {
|
||||
@ -636,7 +639,7 @@ destroy_selection(struct wl_resource *resource, struct wl_client *client)
|
||||
|
||||
static void
|
||||
selection_handle_surface_destroy(struct wl_listener *listener,
|
||||
struct wl_surface *surface, uint32_t time)
|
||||
struct wl_resource *resource, uint32_t time)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ static void
|
||||
wlsc_switcher_next(struct wlsc_switcher *switcher)
|
||||
{
|
||||
struct wl_list *l;
|
||||
struct wl_surface *current;
|
||||
|
||||
wlsc_surface_damage(switcher->current);
|
||||
l = switcher->current->link.next;
|
||||
@ -43,7 +44,8 @@ wlsc_switcher_next(struct wlsc_switcher *switcher)
|
||||
l = switcher->compositor->surface_list.next;
|
||||
switcher->current = container_of(l, struct wlsc_surface, link);
|
||||
wl_list_remove(&switcher->listener.link);
|
||||
wl_list_insert(switcher->current->surface.destroy_listener_list.prev,
|
||||
current = &switcher->current->surface;
|
||||
wl_list_insert(current->resource.destroy_listener_list.prev,
|
||||
&switcher->listener.link);
|
||||
switcher->compositor->overlay = switcher->current;
|
||||
wlsc_surface_damage(switcher->current);
|
||||
@ -51,7 +53,7 @@ wlsc_switcher_next(struct wlsc_switcher *switcher)
|
||||
|
||||
static void
|
||||
switcher_handle_surface_destroy(struct wl_listener *listener,
|
||||
struct wl_surface *surface, uint32_t time)
|
||||
struct wl_resource *resource, uint32_t time)
|
||||
{
|
||||
struct wlsc_switcher *switcher =
|
||||
container_of(listener, struct wlsc_switcher, listener);
|
||||
|
Loading…
Reference in New Issue
Block a user