wmii

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

commit d564fe9b171fcf922b540558c091bbc77013a238
parent 81db18a77265e65b440a9b9c7ed00144965606cf
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Mon, 23 Jan 2006 19:23:56 +0200

implemented rudimentary max action (M-m) in col and float layout, in col it doesn't works well if you unselect a maximized frame ;)  because of overlapping


Diffstat:
cmd/wm/layout_column.c | 33+++++++++++++++++++++++++++++++++
cmd/wm/layout_float.c | 22++++++++++++++++++++++
cmd/wm/wm.h | 2++
rc/wmiirc | 1+
4 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c @@ -50,6 +50,7 @@ static Client *sel_column(Layout *l); static Action *actions_column(Layout *l); static void select_frame(void *obj, char *arg); +static void max_frame(void *obj, char *arg); static void swap_frame(void *obj, char *arg); static void new_column(void *obj, char *arg); @@ -57,6 +58,7 @@ static Action lcol_acttbl[] = { {"select", select_frame}, {"swap", swap_frame}, {"new", new_column}, + {"max", max_frame}, {0, 0} }; @@ -456,6 +458,37 @@ actions_column(Layout *l) } static void +max_frame(void *obj, char *arg) +{ + Layout *l = obj; + Acme *acme = l->aux; + Column *c = acme->sel; + Cell *cell; + Frame *f; + + if(!c) + return; + + cell = c->sel; + if(!cell) + return; + + f = cell->frame; + if(f->maximized) { + f->rect = f->old; + resize_frame(f, &f->old, nil); + f->maximized = False; + } + else { + f->old = f->rect; + f->rect = c->rect; + XRaiseWindow(dpy, f->win); + resize_frame(f, &c->rect, nil); + f->maximized = True; + } +} + +static void select_frame(void *obj, char *arg) { Layout *l = obj; diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c @@ -22,9 +22,11 @@ static Client *sel_float(Layout *l); static Action *actions_float(Layout *l); static void select_frame(void *obj, char *arg); +static void max_frame(void *obj, char *arg); Action lfloat_acttbl[] = { {"select", select_frame}, + {"max", max_frame}, {0, 0} }; @@ -205,6 +207,26 @@ frames_float(Layout *l) } static void +max_frame(void *obj, char *arg) +{ + Layout *l = obj; + Float *fl = l->aux; + Frame *f = fl->sel; + + if(!f) + return; + if(f->maximized) { + resize_frame(f, &f->old, nil); + f->maximized = False; + } + else { + f->old = f->rect; + resize_frame(f, &rect, nil); + f->maximized = True; + } +} + +static void select_frame(void *obj, char *arg) { Layout *l = obj; diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -138,6 +138,8 @@ struct Frame { Client *sel; Client *clients; size_t nclients; + Bool maximized; + XRectangle old; GC gc; XRectangle rect; Cursor cursor; diff --git a/rc/wmiirc b/rc/wmiirc @@ -169,6 +169,7 @@ kbind normal $MODKEY-a 'wmiir write /wm/ctl attach' kbind normal $MODKEY-S-a 'wmiir write /wm/ctl detclients' kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layoutname column' kbind normal $MODKEY-n 'wmiir write /wm/sel/layout/sel/ctl new' +kbind normal $MODKEY-m 'wmiir write /wm/sel/layout/sel/ctl max' kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layoutname float' kbind normal $MODKEY-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap west''' kbind normal $MODKEY-S-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap east'''