Mostly mechanical rewrite to track waylands change to struct wl_signal.
output->pending_scanout_buffer = es->buffer;
output->pending_scanout_buffer->busy_count++;
- wl_list_insert(output->pending_scanout_buffer->resource.destroy_listener_list.prev,
- &output->pending_scanout_buffer_destroy_listener.link);
+ wl_signal_add(&output->pending_scanout_buffer->resource.destroy_signal,
+ &output->pending_scanout_buffer_destroy_listener);
pixman_region32_fini(&es->damage);
pixman_region32_init(&es->damage);
if (s->pending_surface) {
wl_list_remove(&s->pending_destroy_listener.link);
- wl_list_insert(s->pending_surface->buffer->resource.destroy_listener_list.prev,
- &s->destroy_listener.link);
+ wl_signal_add(&s->pending_surface->buffer->resource.destroy_signal,
+ &s->destroy_listener);
s->surface = s->pending_surface;
s->pending_surface = NULL;
s->fb_id = s->pending_fb_id;
if (output->pending_scanout_buffer) {
output->scanout_buffer = output->pending_scanout_buffer;
wl_list_remove(&output->pending_scanout_buffer_destroy_listener.link);
- wl_list_insert(output->scanout_buffer->resource.destroy_listener_list.prev,
- &output->scanout_buffer_destroy_listener.link);
+ wl_signal_add(&output->scanout_buffer->resource.destroy_signal,
+ &output->scanout_buffer_destroy_listener);
output->pending_scanout_buffer = NULL;
}
msecs = sec * 1000 + usec / 1000;
s->src_h = (box->y2 - box->y1) << 16;
pixman_region32_fini(&src_rect);
- wl_list_insert(es->buffer->resource.destroy_listener_list.prev,
- &s->pending_destroy_listener.link);
+ wl_signal_add(&es->buffer->resource.destroy_signal,
+ &s->pending_destroy_listener);
return 0;
}
}
static void
-output_handle_scanout_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+output_handle_scanout_buffer_destroy(struct wl_listener *listener, void *data)
{
struct drm_output *output =
container_of(listener, struct drm_output,
static void
output_handle_pending_scanout_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+ void *data)
{
struct drm_output *output =
container_of(listener, struct drm_output,
}
static void
-sprite_handle_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+sprite_handle_buffer_destroy(struct wl_listener *listener, void *data)
{
struct drm_sprite *sprite =
container_of(listener, struct drm_sprite,
}
static void
-sprite_handle_pending_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+sprite_handle_pending_buffer_destroy(struct wl_listener *listener, void *data)
{
struct drm_sprite *sprite =
container_of(listener, struct drm_sprite,
wl_list_insert(ec->base.output_list.prev, &output->base.link);
- output->scanout_buffer_destroy_listener.func =
+ output->scanout_buffer_destroy_listener.notify =
output_handle_scanout_buffer_destroy;
- output->pending_scanout_buffer_destroy_listener.func =
+ output->pending_scanout_buffer_destroy_listener.notify =
output_handle_pending_scanout_buffer_destroy;
output->next_fb_id = 0;
sprite->pending_surface = NULL;
sprite->fb_id = 0;
sprite->pending_fb_id = 0;
- sprite->destroy_listener.func = sprite_handle_buffer_destroy;
- sprite->pending_destroy_listener.func =
+ sprite->destroy_listener.notify = sprite_handle_buffer_destroy;
+ sprite->pending_destroy_listener.notify =
sprite_handle_pending_buffer_destroy;
sprite->compositor = ec;
sprite->count_formats = plane->count_formats;
}
static void
-surface_handle_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+surface_handle_buffer_destroy(struct wl_listener *listener, void *data)
{
struct weston_surface *es =
container_of(listener, struct weston_surface,
if (surface == NULL)
return NULL;
- wl_list_init(&surface->surface.resource.destroy_listener_list);
+ wl_signal_init(&surface->surface.resource.destroy_signal);
wl_list_init(&surface->link);
wl_list_init(&surface->layer_link);
pixman_region32_init(&surface->transform.opaque);
wl_list_init(&surface->frame_callback_list);
- surface->buffer_destroy_listener.func = surface_handle_buffer_destroy;
+ surface->buffer_destroy_listener.notify = surface_handle_buffer_destroy;
wl_list_init(&surface->geometry.transformation_list);
wl_list_insert(&surface->geometry.transformation_list,
}
buffer->busy_count++;
- wl_list_insert(es->buffer->resource.destroy_listener_list.prev,
- &es->buffer_destroy_listener.link);
+ wl_signal_add(&es->buffer->resource.destroy_signal,
+ &es->buffer_destroy_listener);
if (es->geometry.width != buffer->width ||
es->geometry.height != buffer->height) {
}
static void
-destroy_device_saved_kbd_focus(struct wl_listener *listener,
- struct wl_resource *resource)
+destroy_device_saved_kbd_focus(struct wl_listener *listener, void *data)
{
struct weston_input_device *wd;
if (surface) {
wd->saved_kbd_focus = surface;
- wd->saved_kbd_focus_listener.func =
+ wd->saved_kbd_focus_listener.notify =
destroy_device_saved_kbd_focus;
- wl_list_insert(surface->resource.destroy_listener_list.prev,
- &wd->saved_kbd_focus_listener.link);
+ wl_signal_add(&surface->resource.destroy_signal,
+ &wd->saved_kbd_focus_listener);
}
wl_input_device_set_keyboard_focus(&wd->input_device, NULL);
}
static void
-lose_touch_focus_resource(struct wl_listener *listener,
- struct wl_resource *resource)
+lose_touch_focus_resource(struct wl_listener *listener, void *data)
{
struct weston_input_device *device =
container_of(listener, struct weston_input_device,
}
static void
-lose_touch_focus(struct wl_listener *listener,
- struct wl_resource *resource)
+lose_touch_focus(struct wl_listener *listener, void *data)
{
struct weston_input_device *device =
container_of(listener, struct weston_input_device,
return;
}
- device->touch_focus_resource_listener.func =
+ device->touch_focus_resource_listener.notify =
lose_touch_focus_resource;
- wl_list_insert(resource->destroy_listener_list.prev,
- &device->touch_focus_resource_listener.link);
- device->touch_focus_listener.func = lose_touch_focus;
- wl_list_insert(surface->resource.destroy_listener_list.prev,
- &device->touch_focus_listener.link);
+ wl_signal_add(&resource->destroy_signal,
+ &device->touch_focus_resource_listener);
+ device->touch_focus_listener.notify = lose_touch_focus;
+ wl_signal_add(&surface->resource.destroy_signal,
+ &device->touch_focus_listener);
device->touch_focus = surface;
device->touch_focus_resource = resource;
};
static void
-handle_drag_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+handle_drag_surface_destroy(struct wl_listener *listener, void *data)
{
struct weston_input_device *device;
}
static void
-device_handle_new_drag_icon(struct wl_listener *listener,
- struct wl_resource *resource)
+device_handle_new_drag_icon(struct wl_listener *listener, void *data)
{
struct weston_input_device *device;
device->modifier_state = 0;
device->num_tp = 0;
- device->drag_surface_destroy_listener.func = handle_drag_surface_destroy;
+ device->drag_surface_destroy_listener.notify =
+ handle_drag_surface_destroy;
wl_list_insert(ec->input_device_list.prev, &device->link);
- device->new_drag_icon_listener.func = device_handle_new_drag_icon;
- wl_list_insert(device->input_device.drag_icon_listener_list.prev,
- &device->new_drag_icon_listener.link);
+ device->new_drag_icon_listener.notify = device_handle_new_drag_icon;
+ wl_signal_add(&device->input_device.drag_icon_signal,
+ &device->new_drag_icon_listener);
}
WL_EXPORT void
surface->configure = drag_surface_configure;
- wl_list_insert(surface->surface.resource.destroy_listener_list.prev,
- &device->drag_surface_destroy_listener.link);
+ wl_signal_add(&surface->surface.resource.destroy_signal,
+ &device->drag_surface_destroy_listener);
return 1;
}
};
static void
-destroy_shell_grab_shsurf(struct wl_listener *listener,
- struct wl_resource *resource)
+destroy_shell_grab_shsurf(struct wl_listener *listener, void *data)
{
struct shell_grab *grab;
{
grab->grab.interface = interface;
grab->shsurf = shsurf;
- grab->shsurf_destroy_listener.func = destroy_shell_grab_shsurf;
- wl_list_insert(shsurf->resource.destroy_listener_list.prev,
- &grab->shsurf_destroy_listener.link);
+ grab->shsurf_destroy_listener.notify = destroy_shell_grab_shsurf;
+ wl_signal_add(&shsurf->resource.destroy_signal,
+ &grab->shsurf_destroy_listener);
}
}
static void
-shell_handle_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+shell_handle_surface_destroy(struct wl_listener *listener, void *data)
{
struct shell_surface *shsurf = container_of(listener,
struct shell_surface,
static struct shell_surface *
get_shell_surface(struct weston_surface *surface)
{
- struct wl_list *lst = &surface->surface.resource.destroy_listener_list;
struct wl_listener *listener;
- /* search the destroy listener list for our callback */
- wl_list_for_each(listener, lst, link) {
- if (listener->func == shell_handle_surface_destroy) {
- return container_of(listener, struct shell_surface,
- surface_destroy_listener);
- }
- }
+ listener = wl_signal_get(&surface->surface.resource.destroy_signal,
+ shell_handle_surface_destroy);
+ if (listener)
+ return container_of(listener, struct shell_surface,
+ surface_destroy_listener);
return NULL;
}
shsurf->fullscreen.black_surface = NULL;
wl_list_init(&shsurf->fullscreen.transform.link);
- shsurf->surface_destroy_listener.func = shell_handle_surface_destroy;
- wl_list_insert(surface->surface.resource.destroy_listener_list.prev,
- &shsurf->surface_destroy_listener.link);
+ shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy;
+ wl_signal_add(&surface->surface.resource.destroy_signal,
+ &shsurf->surface_destroy_listener);
/* init link so its safe to always remove it in destroy_shell_surface */
wl_list_init(&shsurf->link);
}
static void
-handle_lock_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+handle_lock_surface_destroy(struct wl_listener *listener, void *data)
{
struct wl_shell *shell =
container_of(listener, struct wl_shell, lock_surface_listener);
shell->lock_surface = surface;
- shell->lock_surface_listener.func = handle_lock_surface_destroy;
- wl_list_insert(&surface_resource->destroy_listener_list,
- &shell->lock_surface_listener.link);
+ shell->lock_surface_listener.notify = handle_lock_surface_destroy;
+ wl_signal_add(&surface_resource->destroy_signal,
+ &shell->lock_surface_listener);
shell->lock_surface->type = SHELL_SURFACE_LOCK;
}
return;
wl_list_remove(&switcher->listener.link);
- wl_list_insert(next->surface.resource.destroy_listener_list.prev,
- &switcher->listener.link);
+ wl_signal_add(&next->surface.resource.destroy_signal,
+ &switcher->listener);
switcher->current = next;
next->alpha = 255;
}
static void
-switcher_handle_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+switcher_handle_surface_destroy(struct wl_listener *listener, void *data)
{
struct switcher *switcher =
container_of(listener, struct switcher, listener);
switcher = malloc(sizeof *switcher);
switcher->compositor = compositor;
switcher->current = NULL;
- switcher->listener.func = switcher_handle_surface_destroy;
+ switcher->listener.notify = switcher_handle_surface_destroy;
wl_list_init(&switcher->listener.link);
switcher->grab.interface = &switcher_grab;
}
static void
-handle_lockscreen_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+handle_lockscreen_surface_destroy(struct wl_listener *listener, void *data)
{
struct tablet_shell *shell =
container_of(listener,
weston_surface_set_position(es, 0, 0);
shell->lockscreen_surface = es;
shell->lockscreen_surface->configure = tablet_shell_surface_configure;
- shell->lockscreen_listener.func = handle_lockscreen_surface_destroy;
- wl_list_insert(es->surface.resource.destroy_listener_list.prev,
- &shell->lockscreen_listener.link);
+ shell->lockscreen_listener.notify = handle_lockscreen_surface_destroy;
+ wl_signal_add(&es->surface.resource.destroy_signal,
+ &shell->lockscreen_listener);
}
static void
-handle_switcher_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+handle_switcher_surface_destroy(struct wl_listener *listener, void *data)
{
struct tablet_shell *shell =
container_of(listener,
shell->switcher_surface = es;
weston_surface_set_position(shell->switcher_surface, 0, 0);
- shell->switcher_listener.func = handle_switcher_surface_destroy;
- wl_list_insert(es->surface.resource.destroy_listener_list.prev,
- &shell->switcher_listener.link);
+ shell->switcher_listener.notify = handle_switcher_surface_destroy;
+ wl_signal_add(&es->surface.resource.destroy_signal,
+ &shell->switcher_listener);
}
static void
}
static void
-handle_zoom_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource)
+handle_zoom_surface_destroy(struct wl_listener *listener, void *data)
{
struct weston_zoom *zoom =
container_of(listener, struct weston_zoom, listener);
zoom->animation.frame = weston_zoom_frame;
weston_zoom_frame(&zoom->animation, NULL, zoom->spring.timestamp);
- zoom->listener.func = handle_zoom_surface_destroy;
- wl_list_insert(surface->surface.resource.destroy_listener_list.prev,
- &zoom->listener.link);
+ zoom->listener.notify = handle_zoom_surface_destroy;
+ wl_signal_add(&surface->surface.resource.destroy_signal,
+ &zoom->listener);
wl_list_insert(&surface->compositor->animation_list,
&zoom->animation.link);
xcb_timestamp_t selection_timestamp;
int selection_property_set;
int flush_property_on_delete;
- struct wl_selection_listener selection_listener;
+ struct wl_listener selection_listener;
struct {
xcb_atom_t wm_protocols;
if (source == NULL)
return;
- wl_list_init(&source->resource.destroy_listener_list);
+ wl_signal_init(&source->resource.destroy_signal);
source->offer_interface = &data_offer_interface;
source->cancel = data_source_cancel;
source->resource.data = wm;
}
static void
-weston_wm_set_selection(struct wl_selection_listener *listener,
- struct wl_input_device *device)
+weston_wm_set_selection(struct wl_listener *listener, void *data)
{
+ struct wl_input_device *device = data;
struct weston_wm *wm =
container_of(listener, struct weston_wm, selection_listener);
struct wl_data_source *source = device->selection_data_source;
xcb_flush(wm->conn);
device = wxs->compositor->input_device;
- wm->selection_listener.func = weston_wm_set_selection;
- wl_list_insert(&device->selection_listener_list,
- &wm->selection_listener.link);
+ wm->selection_listener.notify = weston_wm_set_selection;
+ wl_signal_add(&device->selection_signal, &wm->selection_listener);
fprintf(stderr, "created wm\n");
}
static void
-surface_destroy(struct wl_listener *listener, struct wl_resource *resource)
+surface_destroy(struct wl_listener *listener, void *data)
{
struct weston_wm_window *window =
container_of(listener,
struct wl_resource *resource = &surface->surface.resource;
struct wl_listener *listener;
- wl_list_for_each(listener, &resource->destroy_listener_list, link) {
- if (listener->func == surface_destroy)
- return container_of(listener,
- struct weston_wm_window,
- surface_destroy_listener);
- }
+ listener = wl_signal_get(&resource->destroy_signal, surface_destroy);
+ if (listener)
+ return container_of(listener, struct weston_wm_window,
+ surface_destroy_listener);
return NULL;
}
fprintf(stderr, "set_window_id %d for surface %p\n", id, surface);
window->surface = (struct weston_surface *) surface;
- window->surface_destroy_listener.func = surface_destroy;
- wl_list_insert(surface->resource.destroy_listener_list.prev,
- &window->surface_destroy_listener.link);
+ window->surface_destroy_listener.notify = surface_destroy;
+ wl_signal_add(&surface->resource.destroy_signal,
+ &window->surface_destroy_listener);
}
static const struct xserver_interface xserver_implementation = {