mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-15 08:56:26 -05:00
Simplify globals implementation by removing destructors
Some globals are static and it doesn't make sense to destroy them before the wl_display. For instance, wl_compositor should be created before the display is started and shouldn't be destroyed. For these globals, we can simplify the code by removing the destructor and stop keeping track of wl_resources (these will be destroyed with the wl_display by libwayland).
This commit is contained in:
parent
bcd5f7d259
commit
5cde35923c
57 changed files with 216 additions and 846 deletions
|
|
@ -242,14 +242,12 @@ at least one struct for each interface in the protocol. For instance,
|
|||
### Globals
|
||||
|
||||
Global interfaces generally have public constructors and destructors. Their
|
||||
struct has a field holding the `wl_global` itself, a list of resources clients
|
||||
created by binding to the global, a destroy signal and a `wl_display` destroy
|
||||
listener. Example:
|
||||
struct has a field holding the `wl_global` itself, a destroy signal and a
|
||||
`wl_display` destroy listener. Example:
|
||||
|
||||
```c
|
||||
struct wlr_compositor {
|
||||
struct wl_global *global;
|
||||
struct wl_list resources;
|
||||
…
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
|
|
@ -262,8 +260,9 @@ struct wlr_compositor {
|
|||
```
|
||||
|
||||
When the destructor is called, it should emit the destroy signal, remove the
|
||||
display destroy listener, destroy the `wl_global`, destroy all bound resources
|
||||
and then destroy the struct.
|
||||
display destroy listener, destroy the `wl_global` and then destroy the struct.
|
||||
The destructor can assume all clients and resources have been already
|
||||
destroyed.
|
||||
|
||||
### Resources
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue