'wmiir remove /<empty page>' will work now

This commit is contained in:
Anselm R. Garbe 2006-02-28 10:04:48 +01:00
parent d61117a3db
commit 1c8c963c0f
4 changed files with 13 additions and 6 deletions

View File

@ -32,10 +32,8 @@ 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);
if(a->client)
free(a->client);
cext_array_detach((void **)p->area, a, &p->areasz);
p->narea--;

View File

@ -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];

View File

@ -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

View File

@ -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);