commit 978127964a2b147dd2c47c734cf3430d366b1e3f
parent 5d318d6a6b98b3986449ef8d4600be1107335f2c
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Tue, 28 Feb 2006 17:13:16 +0100
added MODKEY-Shift-s (for stacking mode of a column), MODKEY-Shift-m (for max mode of a column) and MODKEY-Shift-= for (equal mode, default)
Diffstat:
5 files changed, 55 insertions(+), 20 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -95,8 +95,9 @@ void
focus_client(Client *c)
{
Client *old = sel_client();
+ int i = area_to_index(c->area);
- c->area->page->sel = area_to_index(c->area);
+ c->area->page->sel = i;
c->area->sel = client_to_index(c);
if(old && (old != c)) {
c->revert = old;
@@ -112,6 +113,8 @@ focus_client(Client *c)
XSync(dpy, False);
client_name_event(c);
client_focus_event(c);
+ if(i > 0 && c->area->mode == COL_STACK)
+ arrange_column(c->area);
}
void
diff --git a/cmd/wm/column.c b/cmd/wm/column.c
@@ -11,21 +11,49 @@
void
arrange_column(Area *col)
{
- size_t i;
+ size_t i, yoff;
unsigned int h;
- h = col->rect.height;
- h /= col->nclient;
- for(i = 0; i < col->nclient; i++) {
- Client *c = col->client[i];
- c->frame.rect = col->rect;
- c->frame.rect.y += i * h;
- if(i + 1 < col->nclient)
- c->frame.rect.height = h;
- else
- c->frame.rect.height =
- col->rect.height - c->frame.rect.y + col->rect.y;
- resize_client(c, &c->frame.rect, 0);
+ switch(col->mode) {
+ case COL_EQUAL:
+ h = col->rect.height;
+ h /= col->nclient;
+ for(i = 0; i < col->nclient; i++) {
+ Client *c = col->client[i];
+ c->frame.rect = col->rect;
+ c->frame.rect.y += i * h;
+ if(i + 1 < col->nclient)
+ c->frame.rect.height = h;
+ else
+ c->frame.rect.height =
+ col->rect.height - c->frame.rect.y + col->rect.y;
+ resize_client(c, &c->frame.rect, 0);
+ }
+ break;
+ case COL_MAX:
+ for(i = 0; i < col->nclient; i++) {
+ Client *c = col->client[i];
+ c->frame.rect = col->rect;
+ resize_client(c, &c->frame.rect, 0);
+ }
+ break;
+ case COL_STACK:
+ yoff = col->rect.y;
+ h = col->rect.height - (col->nclient - 1) * bar_height();
+ for(i = 0; i < col->nclient; i++) {
+ Client *c = col->client[i];
+ c->frame.rect = col->rect;
+ c->frame.rect.y = yoff;
+ if(i == col->sel)
+ c->frame.rect.height = h;
+ else
+ c->frame.rect.height = bar_height();
+ yoff += c->frame.rect.height;
+ resize_client(c, &c->frame.rect, 0);
+ }
+ break;
+ default:
+ break;
}
}
diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c
@@ -57,7 +57,6 @@ static char Enocommand[] = "command not supported";
* /1/new/ Darea
* /1/float/ Darea floating clients in area 0
* /1/float/ctl Fctl command interface (area)
- * /1/float/max Fmax maximum clients
* /1/float/mode Fmode col mode
* /1/float/sel/ Dclient
* /1/float/1/ Dclient
@@ -66,7 +65,6 @@ static char Enocommand[] = "command not supported";
* /1/float/1/ctl Fctl command interface (client)
* /1/1/ Darea
* /1/1/ctl Fctl command interface (area)
- * /1/1/max Fmax maximum clients
* /1/1/mode Fmode col mode
* /1/1/1/sel/ Dclient
* /1/1/1/1/ Dclient
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -61,7 +61,7 @@ typedef struct Area Area;
typedef struct Page Page;
typedef struct Client Client;
-typedef enum { COL_MAX, COL_EQUAL, COL_STACK, COL_MODE_LAST } ColumnMode;
+typedef enum { COL_EQUAL, COL_STACK, COL_MAX, COL_MODE_LAST } ColumnMode;
struct Area {
unsigned short id;
diff --git a/rc/wmiirc b/rc/wmiirc
@@ -63,13 +63,15 @@ $MODKEY-Control-a
$MODKEY-Control-y
$MODKEY-t
$MODKEY-n
-$MODKEY-m
$MODKEY-Return
$MODKEY-h
$MODKEY-l
$MODKEY-j
$MODKEY-k
$MODKEY-Tab
+$MODKEY-Shift-m
+$MODKEY-Shift-s
+$MODKEY-Shift-equal
$MODKEY-Shift-h
$MODKEY-Shift-l
$MODKEY-Shift-p
@@ -146,8 +148,12 @@ do
extern xterm &;;
$MODKEY-n)
wmiir read /sel/new >/dev/null;;
- $MODKEY-m)
- xwrite /sel/sel/sel/ctl max;;
+ $MODKEY-Shift-m)
+ xwrite /sel/sel/mode 2;;
+ $MODKEY-Shift-s)
+ xwrite /sel/sel/mode 1;;
+ $MODKEY-Shift-equal)
+ xwrite /sel/sel/mode 0;;
$MODKEY-Return)
xwrite /sel/sel/sel/ctl sendtoarea prev;;
$MODKEY-Shift-Return)