mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
tinywl/tinywl: clean up tinywl_output when wlr_output is gone
Add destroy event processing. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3416
This commit is contained in:
parent
410c08cdc6
commit
cb012c5cb5
1 changed files with 15 additions and 0 deletions
|
@ -73,6 +73,7 @@ struct tinywl_output {
|
||||||
struct tinywl_server *server;
|
struct tinywl_server *server;
|
||||||
struct wlr_output *wlr_output;
|
struct wlr_output *wlr_output;
|
||||||
struct wl_listener frame;
|
struct wl_listener frame;
|
||||||
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tinywl_view {
|
struct tinywl_view {
|
||||||
|
@ -549,6 +550,15 @@ static void output_frame(struct wl_listener *listener, void *data) {
|
||||||
wlr_scene_output_send_frame_done(scene_output, &now);
|
wlr_scene_output_send_frame_done(scene_output, &now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void output_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
struct tinywl_output *output = wl_container_of(listener, output, destroy);
|
||||||
|
|
||||||
|
wl_list_remove(&output->frame.link);
|
||||||
|
wl_list_remove(&output->destroy.link);
|
||||||
|
wl_list_remove(&output->link);
|
||||||
|
free(output);
|
||||||
|
}
|
||||||
|
|
||||||
static void server_new_output(struct wl_listener *listener, void *data) {
|
static void server_new_output(struct wl_listener *listener, void *data) {
|
||||||
/* This event is raised by the backend when a new output (aka a display or
|
/* This event is raised by the backend when a new output (aka a display or
|
||||||
* monitor) becomes available. */
|
* monitor) becomes available. */
|
||||||
|
@ -582,6 +592,11 @@ static void server_new_output(struct wl_listener *listener, void *data) {
|
||||||
/* Sets up a listener for the frame notify event. */
|
/* Sets up a listener for the frame notify event. */
|
||||||
output->frame.notify = output_frame;
|
output->frame.notify = output_frame;
|
||||||
wl_signal_add(&wlr_output->events.frame, &output->frame);
|
wl_signal_add(&wlr_output->events.frame, &output->frame);
|
||||||
|
|
||||||
|
/* Sets up a listener for the destroy notify event. */
|
||||||
|
output->destroy.notify = output_destroy;
|
||||||
|
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
|
||||||
|
|
||||||
wl_list_insert(&server->outputs, &output->link);
|
wl_list_insert(&server->outputs, &output->link);
|
||||||
|
|
||||||
/* Adds this to the output layout. The add_auto function arranges outputs
|
/* Adds this to the output layout. The add_auto function arranges outputs
|
||||||
|
|
Loading…
Reference in a new issue