commit 23335d57179ba19818c84aabee5dc15127758c00
parent 5806667ac7f53d96740f14fdd02124c5c7b6bab5
Author: garbeam <garbeam@mmv.wmii.de>
Date: Sun, 11 Dec 2005 19:00:27 +0200
some more additions to column layout, still ths annoying deini/init bug
Diffstat:
5 files changed, 71 insertions(+), 8 deletions(-)
diff --git a/cmd/wm/frame.c b/cmd/wm/frame.c
@@ -327,7 +327,6 @@ void detach_client_from_frame(Client *c, Bool unmap)
c->rect.x = f->rect.x;
c->rect.y = f->rect.y;
reparent_client(c, root, c->rect.x, c->rect.y);
- XSync(dpy, False);
}
if ((client = cext_stack_get_top_item(&f->clients))) {
sel_client(client);
diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c
@@ -35,9 +35,15 @@ static Container *get_frames_col(Area *a);
static Action *get_actions_col(Area *a);
static void select_frame(void *obj, char *arg);
+static void swap_frame(void *obj, char *arg);
+static void new_col(void *obj, char *arg);
+static void destroy_col(void *obj, char *arg);
static Action lcol_acttbl[] = {
{"select", select_frame},
+ {"swap", swap_frame},
+ {"new", new_col},
+ {"destroy", destroy_col},
{0, 0}
};
@@ -328,3 +334,59 @@ static void select_frame(void *obj, char *arg)
draw_frame(f, nil);
}
}
+
+static void swap_frame(void *obj, char *arg)
+{
+ Area *a = obj;
+ Acme *acme = a->aux;
+ Column *col = get_sel_column(acme);
+ Frame *f = cext_stack_get_top_item(&col->frames);
+ if (!f || !arg)
+ return;
+}
+
+static void update_column_width(Area *a)
+{
+ Acme *acme = a->aux;
+ size_t size = cext_sizeof(&acme->columns);
+ unsigned int i, width = a->rect.width / cext_sizeof(&acme->columns);
+
+ for (i = 0; i < size; i++) {
+ Column *col = cext_list_get_item(&acme->columns, i);
+ col->refresh = True;
+ col->rect.x = i * width;
+ col->rect.width = width;
+ }
+ arrange_col(a);
+}
+
+static void new_col(void *obj, char *arg)
+{
+ Area *a = obj;
+ Acme *acme = a->aux;
+ Column *col = cext_emallocz(sizeof(Column));
+ cext_attach_item(&acme->columns, col);
+ update_column_width(a);
+}
+
+static void destroy_col(void *obj, char *arg)
+{
+ Area *a = obj;
+ Acme *acme = a->aux;
+ Column *col = get_sel_column(acme);
+ size_t size;
+
+ if (cext_sizeof(&acme->columns) > 1) {
+ while (cext_sizeof(&col->frames)) {
+ Frame *f = cext_stack_get_top_item(&col->frames);
+ while ((size = cext_sizeof(&f->clients))) {
+ detach_col(a, cext_stack_get_top_item(&f->clients), a->page != get_sel_page());
+ if (size == 1)
+ break;
+ }
+ }
+ cext_detach_item(&acme->columns, col);
+ free(col);
+ update_column_width(a);
+ }
+}
diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c
@@ -54,14 +54,17 @@ static void init_float(Area *a)
static void iter_detach_float(void *client, void *area)
{
Area *a = area;
- detach_float(a, client, a->page == get_sel_page());
+ fprintf(stderr, "layout_float: detach_float(0x%x)\n", client);
+ detach_float(a, client, a->page != get_sel_page());
}
static void deinit_float(Area *a)
{
+ fprintf(stderr, "%s", "layout_float: deinit enter\n");
cext_list_iterate(&a->clients, a, iter_detach_float);
free(a->aux);
a->aux = nil;
+ fprintf(stderr, "%s", "layout_float: deinit exit\n");
}
static Bool attach_float(Area *a, Client *c)
diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c
@@ -389,12 +389,9 @@ static void _attach_client(void *obj, char *cmd)
static void _detach_client(void *obj, char *cmd)
{
- Frame *f = get_sel_frame();
- Client *c;
- if (!f)
- return;
- c = cext_stack_get_top_item(&f->clients);
- f->area->layout->detach(f->area, c, False);
+ Client *c = get_sel_client();
+ if (c)
+ detach_client(c, False);
}
static void _select_page(void *obj, char *cmd)
diff --git a/rc/wmirc b/rc/wmirc
@@ -132,6 +132,8 @@ kbind normal $MODKEY-d 'wmir write /wm/ctl detach'
kbind normal $MODKEY-a 'wmir write /wm/ctl attach'
kbind normal $MODKEY-S-a 'wmir write /wm/ctl ''detached clients'''
kbind normal $MODKEY-S-c 'wmir write /wm/sel/layout/sel/name column'
+kbind normal $MODKEY-S-n 'wmir write /wm/sel/layout/sel/ctl new'
+kbind normal $MODKEY-S-d 'wmir write /wm/sel/layout/sel/ctl destroy'
kbind normal $MODKEY-S-f 'wmir write /wm/sel/layout/sel/name float'
kbind normal $MODKEY-Return 'wmir write /wm/sel/ctl ''select zoomed'''
kbind normal $MODKEY-C-y 'wmir write /wm/ctl new'