wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 8b9326aa2aa3284a6dc276ef4cd804ab1f375e2a
parent 862713890a6c07f0db6e08c5dee27963ba1112ac
Author: garbeam <garbeam@mmv.wmii.de>
Date:   Mon, 12 Dec 2005 18:04:40 +0200

added better area selection


Diffstat:
cmd/wm/client.c | 2+-
cmd/wm/event.c | 8++++----
cmd/wm/layout_column.c | 6+++---
cmd/wm/page.c | 18++++++++++++++++++
cmd/wm/wm.h | 2+-
rc/wmiirc | 11++++++-----
6 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -306,7 +306,7 @@ void attach_client(Client * c) if (c && c->trans) { Client *t = win_to_client(c->trans); if (t && t->frame) - a = t->frame->area; + a = cext_list_get_item(&t->frame->area->page->areas, 0); } cext_attach_item(&a->clients, c); a->layout->attach(a, c); diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -258,11 +258,11 @@ static void handle_enternotify(XEvent * e) c = win_to_client(ev->window); if (c && c->frame) { Frame *old = get_sel_frame(); - if (old != c->frame) { - c->frame->area->layout->select(c->frame, False); + if (old && old != c->frame) draw_frame(old, nil); - draw_frame(c->frame, nil); - } + sel_area(c->frame->area); + c->frame->area->layout->select(c->frame, False); + draw_frame(c->frame, nil); } } diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c @@ -96,6 +96,7 @@ static void arrange_col(Area *a) { Acme *acme = a->aux; cext_list_iterate(&acme->columns, a, iter_arrange_column); + XSync(dpy, False); } static void iter_attach_col(void *client, void *area) @@ -152,9 +153,9 @@ static Bool attach_col(Area *a, Client *c) attach_client_to_frame(f, c); if (a->page == get_sel_page()) XMapWindow(dpy, f->win); - select_col(f, True); col->refresh = True; arrange_col(a); + select_col(f, True); return True; } @@ -271,8 +272,7 @@ static void drop_moving(Frame *f, XRectangle *new, XPoint *pt) f->aux = tgt; tgt->refresh = src->refresh = True; cext_stack_top_item(&acme->columns, tgt); - iter_arrange_column(tgt, f->area); - iter_arrange_column(src, f->area); + arrange_col(f->area); } } diff --git a/cmd/wm/page.c b/cmd/wm/page.c @@ -11,8 +11,11 @@ static void handle_after_write_page(IXPServer * s, File * f); +static void select_area(void *obj, char *arg); + /* action table for /?/ namespace */ Action page_acttbl[] = { + {"select", select_area}, {0, 0} }; @@ -37,6 +40,7 @@ Page *alloc_page() p->file[P_CTL] = ixp_create(ixps, buf); p->file[P_CTL]->after_write = handle_after_write_page; alloc_area(p, &rect, "float"); + alloc_area(p, &rect, def[WM_LAYOUT]->content); cext_attach_item(&pages, p); def[WM_SEL_PAGE]->content = p->file[P_PREFIX]->content; invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]); @@ -155,3 +159,17 @@ Page *get_sel_page() { return cext_stack_get_top_item(&pages); } + +static void select_area(void *obj, char *arg) +{ + Page *p = obj; + Area *a = cext_stack_get_top_item(&p->areas); + + if (!strncmp(arg, "prev", 5)) + a = cext_list_get_prev_item(&p->areas, a); + else if (!strncmp(arg, "next", 5)) + a = cext_list_get_next_item(&p->areas, a); + else + a = cext_list_get_item(&p->areas, blitz_strtonum(arg, 0, cext_sizeof(&p->areas) - 1)); + sel_area(a); +} diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -92,7 +92,7 @@ enum { #define PROTO_DEL 1 #define BORDER_WIDTH 3 -#define LAYOUT "float" +#define LAYOUT "column" #define GAP 5 #define ROOT_MASK (SubstructureRedirectMask | ButtonPressMask | ButtonReleaseMask) diff --git a/rc/wmiirc b/rc/wmiirc @@ -129,7 +129,7 @@ kbind normal $MODKEY-t 'extern xterm ''+sb'' -bg ''#000000'' -fg ''#ffffff'' -cr kbind normal $MODKEY-d 'wmiir write /wm/ctl detach' kbind normal $MODKEY-a 'wmiir write /wm/ctl attach' kbind normal $MODKEY-S-a 'wmiir write /wm/ctl ''detached clients''' -kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layout/sel/geometry 0,0,east,south-20; wmiir write /wm/sel/layout/sel/name column' +kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layout/1/geometry 0,0,east,south-20; wmiir write /wm/sel/layout/1/name column' kbind normal $MODKEY-S-n 'wmiir write /wm/sel/layout/sel/ctl new' kbind normal $MODKEY-S-d 'wmiir write /wm/sel/layout/sel/ctl destroy' kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layout/sel/name float' @@ -137,13 +137,14 @@ kbind normal $MODKEY-Return 'wmiir write /wm/sel/ctl ''select zoomed''' kbind normal $MODKEY-C-y 'wmiir write /wm/ctl new' kbind normal $MODKEY-u 'wmiir write /wm/sel/layout/sel/frame/sel/locked 0' kbind normal $MODKEY-S-u 'wmiir write /wm/sel/layout/sel/frame/sel/locked 1' -kbind normal $MODKEY-$WESTKEY 'wmiir write /wm/ctl ''select prev''' -kbind normal $MODKEY-$EASTKEY 'wmiir write /wm/ctl ''select next''' +kbind normal $MODKEY-$WESTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select west''' +kbind normal $MODKEY-$EASTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select east''' kbind normal $MODKEY-Tab 'wmiir write /wm/sel/layout/sel/ctl ''select next''' kbind normal $MODKEY-$SOUTHKEY 'wmiir write /wm/sel/layout/sel/ctl ''select next''' kbind normal $MODKEY-$NORTHKEY 'wmiir write /wm/sel/layout/sel/ctl ''select prev''' -kbind normal $MODKEY-S-$WESTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select west''' -kbind normal $MODKEY-S-$EASTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select east''' +kbind normal $MODKEY-S-$WESTKEY 'wmiir write /wm/ctl ''select prev''' +kbind normal $MODKEY-S-$EASTKEY 'wmiir write /wm/ctl ''select next''' +kbind normal $MODKEY-Space 'wmiir write /wm/sel/ctl ''select next''' kbind normal $MODKEY-S-Tab 'wmiir write /wm/sel/layout/sel/frame/sel/ctl ''select next''' kbind normal $MODKEY-S-$SOUTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/ctl ''select next''' kbind normal $MODKEY-S-$NORTHKEY 'wmiir write /wm/sel/layout/sel/frame/sel/ctl ''select prev'''