diff --git a/cmd/wm/area.c b/cmd/wm/area.c index 69ee8f94..b470fe93 100644 --- a/cmd/wm/area.c +++ b/cmd/wm/area.c @@ -32,11 +32,9 @@ update_area_geometry(Area *a) void destroy_area(Area *a) { - size_t i; Page *p = a->page; - while(a->nclient) - detach_client(client[i], False); - free(a->client); + if(a->client) + free(a->client); cext_array_detach((void **)p->area, a, &p->areasz); p->narea--; free(a); diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c index a9c16b01..47538896 100644 --- a/cmd/wm/fs.c +++ b/cmd/wm/fs.c @@ -600,6 +600,10 @@ xremove(IXPConn *c, Fcall *fcall) if((i1 == -1) || (i2 == -1) || (i3 == -1)) return Enofile; switch(type) { + case Dpage: + if(destroy_page(page[i1]) == page[i1]) + return Enoperm; + break; case Dlabel: { Label *l = label[i1]; diff --git a/cmd/wm/page.c b/cmd/wm/page.c index 52875322..d4b047dd 100644 --- a/cmd/wm/page.c +++ b/cmd/wm/page.c @@ -27,13 +27,17 @@ alloc_page() return p; } -void +Page * destroy_page(Page *p) { unsigned int i; Page *old = p->revert; Client *c; + for(i = 0; i < p->narea; i++) + if(p->area[i]->nclient) + return p; + while(p->narea) destroy_area(p->area[0]); @@ -55,6 +59,7 @@ destroy_page(Page *p) } else write_event("PN -\n"); + return nil; } int diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h index 755c73e4..3fac7ec8 100644 --- a/cmd/wm/wm.h +++ b/cmd/wm/wm.h @@ -261,7 +261,7 @@ char *warp_mouse(char *arg); /* page.c */ Page *alloc_page(); -void destroy_page(Page *p); +Page *destroy_page(Page *p); void focus_page(Page *p); XRectangle *rectangles(unsigned int *num); int pid_to_index(unsigned short id);