mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
backend: introduce wlr_backend_finish
This new functions cleans up the common backend state. While this currently only emits the destroy signal, this will also clean up the renderer and allocator in upcoming patches.
This commit is contained in:
parent
beae3018cb
commit
7ec5bf6b10
9 changed files with 16 additions and 7 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <wlr/util/log.h>
|
||||
#include "backend/backend.h"
|
||||
#include "backend/multi.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
#if WLR_HAS_X11_BACKEND
|
||||
#include <wlr/backend/x11.h>
|
||||
|
@ -32,6 +33,10 @@ void wlr_backend_init(struct wlr_backend *backend,
|
|||
wl_signal_init(&backend->events.new_output);
|
||||
}
|
||||
|
||||
void wlr_backend_finish(struct wlr_backend *backend) {
|
||||
wlr_signal_emit_safe(&backend->events.destroy, backend);
|
||||
}
|
||||
|
||||
bool wlr_backend_start(struct wlr_backend *backend) {
|
||||
if (backend->impl->start) {
|
||||
return backend->impl->start(backend);
|
||||
|
|
|
@ -41,7 +41,7 @@ static void backend_destroy(struct wlr_backend *backend) {
|
|||
destroy_drm_connector(conn);
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&backend->events.destroy, backend);
|
||||
wlr_backend_finish(backend);
|
||||
|
||||
struct wlr_drm_fb *fb, *fb_tmp;
|
||||
wl_list_for_each_safe(fb, fb_tmp, &drm->fbs, link) {
|
||||
|
|
|
@ -67,7 +67,7 @@ static void backend_destroy(struct wlr_backend *wlr_backend) {
|
|||
wlr_input_device_destroy(&input_device->wlr_input_device);
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&wlr_backend->events.destroy, backend);
|
||||
wlr_backend_finish(wlr_backend);
|
||||
|
||||
free(backend->format);
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ static void backend_destroy(struct wlr_backend *wlr_backend) {
|
|||
free(wlr_devices);
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&wlr_backend->events.destroy, wlr_backend);
|
||||
wlr_backend_finish(wlr_backend);
|
||||
|
||||
wl_list_remove(&backend->display_destroy.link);
|
||||
wl_list_remove(&backend->session_destroy.link);
|
||||
|
|
|
@ -58,7 +58,7 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) {
|
|||
}
|
||||
|
||||
// Destroy this backend only after removing all sub-backends
|
||||
wlr_signal_emit_safe(&wlr_backend->events.destroy, backend);
|
||||
wlr_backend_finish(wlr_backend);
|
||||
free(backend);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static void backend_destroy(struct wlr_backend *wlr_backend) {
|
|||
wlr_output_destroy(&output->wlr_output);
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&wlr_backend->events.destroy, backend);
|
||||
wlr_backend_finish(wlr_backend);
|
||||
|
||||
wl_list_remove(&backend->display_destroy.link);
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ static void backend_destroy(struct wlr_backend *backend) {
|
|||
wlr_input_device_destroy(input_device);
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&wl->backend.events.destroy, &wl->backend);
|
||||
wlr_backend_finish(backend);
|
||||
|
||||
wl_list_remove(&wl->local_display_destroy.link);
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ static void backend_destroy(struct wlr_backend *backend) {
|
|||
|
||||
wlr_input_device_destroy(&x11->keyboard_dev);
|
||||
|
||||
wlr_signal_emit_safe(&backend->events.destroy, backend);
|
||||
wlr_backend_finish(backend);
|
||||
|
||||
if (x11->event_source) {
|
||||
wl_event_source_remove(x11->event_source);
|
||||
|
|
|
@ -29,5 +29,9 @@ struct wlr_backend_impl {
|
|||
*/
|
||||
void wlr_backend_init(struct wlr_backend *backend,
|
||||
const struct wlr_backend_impl *impl);
|
||||
/**
|
||||
* Emit the destroy event and clean up common backend state.
|
||||
*/
|
||||
void wlr_backend_finish(struct wlr_backend *backend);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue