---
name: "wl_listener"
section: "3"
platform: "linux"
package: "wayland-docs"
version: "1.26.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/wl_listener"
---

# wl\_listener(3)

A single listener for Wayland signals.

## NAME

wl\_listener - A single listener for Wayland signals.

## SYNOPSIS

\#include \<wayland-server-core.h\>

### Data Fields

struct **wl\_list** **link**\
 **wl\_notify\_func\_t** **notify**\

## Detailed Description

A single listener for Wayland signals.

**wl\_listener** provides the means to listen for **wl\_signal** notifications. Many Wayland objects use **wl\_listener** for notification of significant events like object destruction.

Clients should create **wl\_listener** objects manually and can register them as listeners to signals using wl\_signal\_add(), assuming the signal is directly accessible. For opaque structs like **wl\_event\_loop**, adding a listener should be done through provided accessor methods. A listener can only listen to one signal at a time.

```
struct wl_listener your_listener;
your_listener.notify = your_callback_method;
// Direct access
wl_signal_add(&some_object->destroy_signal, &your_listener);
// Accessor access
wl_event_loop *loop = ...;
wl_event_loop_add_destroy_listener(loop, &your_listener);
```

If the listener is part of a larger struct, **wl\_container\_of** can be used to retrieve a pointer to it:

```
void your_listener(struct wl_listener *listener, void *data)
{
        struct your_data *data;
        your_data = wl_container_of(listener, data, your_member_name);
}
```

If you need to remove a listener from a signal, use wl\_list\_remove().

```
wl_list_remove(&your_listener.link);
```

**See also**

**wl\_signal**

## Field Documentation

### struct wl\_list wl\_listener::link

Part of **wl\_signal::listener\_list**

### wl\_notify\_func\_t wl\_listener::notify

Callback function pointer

## Author

Generated automatically by Doxygen for Wayland from the source code.
