remove listeners

This commit is contained in:
ARDiDo 2021-09-15 18:09:49 -04:00
parent c0e646d20b
commit 90ed84be14

36
dwl.c
View File

@ -1048,14 +1048,22 @@ destroynotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->map.link); wl_list_remove(&c->map.link);
wl_list_remove(&c->unmap.link); wl_list_remove(&c->unmap.link);
wl_list_remove(&c->destroy.link); wl_list_remove(&c->destroy.link);
if (c->type && c->type != XDGShell) {
#ifdef XWAYLAND
if (c->type == X11Managed) {
wl_list_remove(&c->activate.link);
wl_list_remove(&c->configure.link);
} else {
wl_list_remove(&c->configure.link);
free(c);
return;
}
#endif
} else {
wl_list_remove(&c->commit.link);
}
wl_list_remove(&c->set_title.link); wl_list_remove(&c->set_title.link);
wl_list_remove(&c->fullscreen.link); wl_list_remove(&c->fullscreen.link);
#ifdef XWAYLAND
if (c->type == X11Managed)
wl_list_remove(&c->activate.link);
else if (c->type == XDGShell)
#endif
wl_list_remove(&c->commit.link);
free(c); free(c);
} }
@ -2592,19 +2600,21 @@ createnotifyx11(struct wl_listener *listener, void *data)
c->isfullscreen = 0; c->isfullscreen = 0;
/* Listen to the various events it can emit */ /* Listen to the various events it can emit */
if (c->type == X11Managed) if (c->type == X11Managed) {
LISTEN(&xwayland_surface->events.map, &c->map, mapnotify); LISTEN(&xwayland_surface->events.map, &c->map, mapnotify);
else LISTEN(&xwayland_surface->events.request_activate, &c->activate,
activatex11);
LISTEN(&xwayland_surface->events.set_title, &c->set_title, updatetitle);
LISTEN(&xwayland_surface->events.request_fullscreen, &c->fullscreen,
fullscreennotify);
}
else {
LISTEN(&xwayland_surface->events.map, &c->map, mapnotify_unmanaged); LISTEN(&xwayland_surface->events.map, &c->map, mapnotify_unmanaged);
}
LISTEN(&xwayland_surface->events.unmap, &c->unmap, unmapnotify); LISTEN(&xwayland_surface->events.unmap, &c->unmap, unmapnotify);
LISTEN(&xwayland_surface->events.request_activate, &c->activate,
activatex11);
LISTEN(&xwayland_surface->events.request_configure, &c->configure, LISTEN(&xwayland_surface->events.request_configure, &c->configure,
configurex11); configurex11);
LISTEN(&xwayland_surface->events.set_title, &c->set_title, updatetitle);
LISTEN(&xwayland_surface->events.destroy, &c->destroy, destroynotify); LISTEN(&xwayland_surface->events.destroy, &c->destroy, destroynotify);
LISTEN(&xwayland_surface->events.request_fullscreen, &c->fullscreen,
fullscreennotify);
} }
void void