update DestroyNotify handler: if client with destroyed window exists, free it

This commit is contained in:
Akos Horvath 2023-03-19 18:37:46 +01:00
parent 70dd4aa93d
commit 3702b5be15

View File

@ -108,33 +108,16 @@ void wm_create_handler(Wm *wm, XCreateWindowEvent e)
//wm_client_focus(c);
}
// TODO
void wm_destroy_handler(Wm *wm, XDestroyWindowEvent e)
{
DEBUG_PRINT("DestroyNotify event\n");
Client *c;
// TODO: make function for linked list management
for (c = wm->smon->clients; c; c = c->next) {
if (e.window == c->window) {
if (c == wm->smon->clients) {
if (c->next)
wm->smon->clients = c->next;
else
wm->smon->clients = NULL;
} else {
if (!c->next)
c->prev->next = NULL;
else {
c->prev->next = c->next;
c->next->prev = c->prev;
}
}
free(c);
}
}
c = wm_client_find(wm, e.window);
if (!c)
return;
wm_client_free(wm, c);
}
void wm_reparent_handler(XReparentEvent e)
@ -142,8 +125,6 @@ void wm_reparent_handler(XReparentEvent e)
DEBUG_PRINT("ReparentNotify event\n");
}
void wm_keyrelease_handler(XKeyReleasedEvent e)
{
DEBUG_PRINT("KeyReleased event, code: %d\n", e.keycode)