wmii/cmd/wm/layout_float.c

70 lines
1.4 KiB
C
Raw Normal View History

2005-12-05 03:09:27 +02:00
/*
* (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "wm.h"
#include "layout.h"
static void init_float(Area *a);
static void deinit_float(Area *a);
static void arrange_float(Area *a);
static void attach_float(Area *a, Client *c);
static void detach_float(Area *a, Client *c);
static void resize_float(Frame *f, XRectangle *new, XPoint *pt);
2005-12-05 03:09:27 +02:00
static Layout lfloat = { "float", init_float, deinit_float, arrange_float, attach_float, detach_float, resize_float };
void init_layout_float()
{
cext_attach_item(&layouts, &lfloat);
2005-12-05 03:09:27 +02:00
}
static void arrange_float(Area *a)
2005-12-05 03:09:27 +02:00
{
}
static void init_float(Area *a)
2005-12-05 03:09:27 +02:00
{
}
static void deinit_float(Area *a)
2005-12-05 03:09:27 +02:00
{
}
static void attach_float(Area *a, Client *c)
2005-12-05 03:09:27 +02:00
{
Frame *f = get_sel_frame_of_area(a);
2005-12-05 21:38:03 +02:00
/* check for tabbing? */
if (f && (((char *) f->file[F_LOCKED]->content)[0] == '1'))
f = 0;
if (!f) {
f = alloc_frame(&c->rect);
attach_frame_to_area(a, f);
}
attach_client_to_frame(f, c);
if (a->page == get_sel_page())
2005-12-05 21:38:03 +02:00
XMapRaised(dpy, f->win);
draw_frame(f, nil);
2005-12-05 03:09:27 +02:00
}
static void detach_float(Area *a, Client *c)
2005-12-05 03:09:27 +02:00
{
2005-12-05 23:22:24 +02:00
Frame *f = c->frame;
detach_client_from_frame(c);
if (!cext_sizeof(&f->clients)) {
2005-12-05 23:22:24 +02:00
detach_frame_from_area(f, 0);
destroy_frame(f);
}
2005-12-05 03:09:27 +02:00
}
static void resize_float(Frame *f, XRectangle *new, XPoint *pt)
2005-12-05 03:09:27 +02:00
{
f->rect = *new;
2005-12-05 03:09:27 +02:00
}