mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
wlr_buffer: Introduce prerelease
The prerelease signal lets users do things things at the last moment that would be inappropriate to do on the release signal. Inside the prerelease signal, it is allowed to lock the buffer and also upload/import the contents of the buffer to a texture.
This commit is contained in:
parent
48874c9e86
commit
d9f6ec080f
2 changed files with 6 additions and 0 deletions
|
|
@ -56,6 +56,7 @@ struct wlr_buffer {
|
|||
struct {
|
||||
struct wl_signal destroy;
|
||||
struct wl_signal release;
|
||||
struct wl_signal prerelease;
|
||||
} events;
|
||||
|
||||
struct wlr_addon_set addons;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ void wlr_buffer_init(struct wlr_buffer *buffer,
|
|||
};
|
||||
wl_signal_init(&buffer->events.destroy);
|
||||
wl_signal_init(&buffer->events.release);
|
||||
wl_signal_init(&buffer->events.prerelease);
|
||||
wlr_addon_set_init(&buffer->addons);
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +59,10 @@ void wlr_buffer_unlock(struct wlr_buffer *buffer) {
|
|||
assert(buffer->n_locks > 0);
|
||||
buffer->n_locks--;
|
||||
|
||||
if (buffer->n_locks == 0) {
|
||||
wl_signal_emit_mutable(&buffer->events.prerelease, NULL);
|
||||
}
|
||||
|
||||
if (buffer->n_locks == 0) {
|
||||
wl_signal_emit_mutable(&buffer->events.release, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue