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

This commit is contained in:
Anselm R. Garbe 2006-01-23 19:23:56 +02:00
parent 81db18a772
commit d564fe9b17
4 changed files with 58 additions and 0 deletions

View File

@ -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}
};
@ -455,6 +457,37 @@ actions_column(Layout *l)
return lcol_acttbl;
}
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)
{

View File

@ -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}
};
@ -204,6 +206,26 @@ frames_float(Layout *l)
return fl->frames;
}
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)
{

View File

@ -138,6 +138,8 @@ struct Frame {
Client *sel;
Client *clients;
size_t nclients;
Bool maximized;
XRectangle old;
GC gc;
XRectangle rect;
Cursor cursor;

View File

@ -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'''