Improve code of func "cleanup"

This commit is contained in:
Alex Kotov 2021-11-20 22:30:00 +05:00
parent afb3bc91b5
commit 642a6a37b1
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 16 additions and 8 deletions

View File

@ -459,20 +459,28 @@ void checkotherwm()
void cleanup() void cleanup()
{ {
Layout foo = { NULL, NULL }; Layout foo = { NULL, NULL };
Monitor *m;
size_t i;
selmon->lt[selmon->sellt] = &foo; selmon->lt[selmon->sellt] = &foo;
for (m = mons; m; m = m->next)
while (m->stack) for (Monitor *m = mons; m; m = m->next) {
while (m->stack) {
unmanage(m->stack, 0); unmanage(m->stack, 0);
}
}
XUngrabKey(dpy, AnyKey, AnyModifier, root); XUngrabKey(dpy, AnyKey, AnyModifier, root);
while (mons)
while (mons) {
cleanupmon(mons); cleanupmon(mons);
for (i = 0; i < CurLast; i++) }
for (size_t i = 0; i < CurLast; i++) {
drw_cur_free(drw, cursor[i]); drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors); i++) }
for (size_t i = 0; i < LENGTH(colors); i++) {
free(scheme[i]); free(scheme[i]);
}
atoms_destroy(atoms); atoms_destroy(atoms);
XDestroyWindow(dpy, wmcheckwin); XDestroyWindow(dpy, wmcheckwin);
drw_free(drw); drw_free(drw);