mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-04 20:55:58 +01:00
Listen to display destroy in xdg-shell-v6
This commit is contained in:
parent
9ddaea14a1
commit
cbf5763c22
2 changed files with 13 additions and 2 deletions
|
@ -11,6 +11,8 @@ struct wlr_xdg_shell_v6 {
|
|||
struct wl_list popup_grabs;
|
||||
uint32_t ping_timeout;
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal new_surface;
|
||||
} events;
|
||||
|
|
|
@ -1250,6 +1250,12 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
|
|||
}
|
||||
}
|
||||
|
||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||
struct wlr_xdg_shell_v6 *xdg_shell =
|
||||
wl_container_of(listener, xdg_shell, display_destroy);
|
||||
wlr_xdg_shell_v6_destroy(xdg_shell);
|
||||
}
|
||||
|
||||
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display) {
|
||||
struct wlr_xdg_shell_v6 *xdg_shell =
|
||||
calloc(1, sizeof(struct wlr_xdg_shell_v6));
|
||||
|
@ -1272,6 +1278,9 @@ struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display) {
|
|||
|
||||
wl_signal_init(&xdg_shell->events.new_surface);
|
||||
|
||||
xdg_shell->display_destroy.notify = handle_display_destroy;
|
||||
wl_display_add_destroy_listener(display, &xdg_shell->display_destroy);
|
||||
|
||||
return xdg_shell;
|
||||
}
|
||||
|
||||
|
@ -1279,8 +1288,8 @@ void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell) {
|
|||
if (!xdg_shell) {
|
||||
return;
|
||||
}
|
||||
// TODO: this segfault (wl_display->registry_resource_list is not init)
|
||||
// wl_global_destroy(xdg_shell->wl_global);
|
||||
wl_list_remove(&xdg_shell->display_destroy.link);
|
||||
wl_global_destroy(xdg_shell->wl_global);
|
||||
free(xdg_shell);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue