update DestroyNotify handler: if client with destroyed window exists, free it
This commit is contained in:
parent
70dd4aa93d
commit
3702b5be15
27
handler.c
27
handler.c
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user