wmii/cmd/wm/area.c

49 lines
838 B
C
Raw Normal View History

2005-11-18 18:54:58 +03:00
/*
* (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "wm.h"
#include <cext.h>
static Area zero_area = {0};
void
free_area(Area* a)
{
ixp_remove_file(ixps, a->files[A_PREFIX]);
2005-12-03 14:36:00 +03:00
free(a);
2005-11-18 18:54:58 +03:00
}
void
destroy_area(Area *a)
{
unsigned int i;
a->layout->deinit(a);
for(i = 0; a->frames && a->frames[i]; i++);
2005-12-03 14:36:00 +03:00
destroy_frame(a->frames[i]);
free(a->frames);
2005-11-18 18:54:58 +03:00
free_area(a);
}
void
focus_area(Area *a, int raise, int up, int down)
{
2005-12-03 14:36:00 +03:00
Page *p = a->page;
2005-11-18 18:54:58 +03:00
if (!p)
return;
2005-12-03 14:36:00 +03:00
if (down && a->frames)
focus_frame(a->frames[a->sel], raise, 0, down);
p->sel = index_item((void **)p->areas, a);
p->files[P_SEL_AREA]->content = a->files[A_PREFIX]->content;
2005-11-18 18:54:58 +03:00
if (up)
focus_page(p, raise, 0);
}