Hi!
I've got an alternative patch to Args multiple windows in master area.
IMHO my changes feel much more comfortable and flexible than args
fixed 2, 3, 4 windows in the Master area.
I think this thing can be cleaned up, but it works very good.
Gottox
2007/1/5, Anselm R. Garbe <[EMAIL PROTECTED]>:
On Fri, Jan 05, 2007 at 03:58:47PM +0100, Szabolcs Nagy wrote:
> why do you swap with memory copy (in view.c/swap())?
> why just changing the pointers (prev, next) not enough?
The reason is that clients, stack or sel might be affected
during the swap and it's a pain to keep track of those pointers
pointing to the correct data. However, the freeze seems to be
related to a side-effect of this swap() thing. My brain is too
fucked up today, I have no sane solution right now. Maybe you
can do it better, lemme know.
Regards,
--
Anselm R. Garbe >< http://suckless.org/~arg/ >< GPG key: 0D73F361
--
http://www.gnuffy.org - Real Community Distro
http://www.gnuffy.org/index.php/GnuEm - Gnuffy on Ipaq (Codename Peggy)
diff -up dwm-2.8/dwm.h dwm-2.8-smaster/dwm.h
--- dwm-2.8/dwm.h 2007-01-02 14:52:53.000000000 +0100
+++ dwm-2.8-smaster/dwm.h 2007-01-05 14:29:03.000000000 +0100
@@ -100,7 +100,7 @@ extern unsigned int master, ntags, numlo
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
extern void (*arrange)(void); /* arrange function, indicates mode */
extern Atom wmatom[WMLast], netatom[NetLast];
-extern Bool running, issel, *seltag; /* seltag is array of Bool */
+extern Bool running, issel, *seltag, hassm; /* seltag is array of Bool */
extern Client *clients, *sel, *stack; /* global client list and stack */
extern Cursor cursor[CurLast];
extern DC dc; /* global draw context */
diff -up dwm-2.8/view.c dwm-2.8-smaster/view.c
--- dwm-2.8/view.c 2007-01-02 14:52:53.000000000 +0100
+++ dwm-2.8-smaster/view.c 2007-01-05 16:56:55.000000000 +0100
@@ -36,6 +36,7 @@ togglemax(Client *c) {
/* extern */
+Bool hassm = True;
void (*arrange)(void) = DEFMODE;
void
@@ -69,12 +70,27 @@ dofloat(void) {
void
dotile(void) {
- unsigned int i, n, mpw, th;
+ unsigned int i, n, mpw, mph, th;
+ Bool smaster = hassm;
Client *c;
-
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++;
- mpw = (waw * master) / 1000;
+
+ if(n < 2)
+ smaster = False;
+
+ if(smaster) {
+ mph = (wah * master) / 1000;
+ n--;
+ }
+ else
+ mph = wah;
+
+ if(n <= 1)
+ mpw = waw;
+ else
+ mpw = (waw * master) / 1000;
+
for(i = 0, c = clients; c; c = c->next)
if(isvisible(c)) {
@@ -85,20 +101,22 @@ dotile(void) {
c->ismax = False;
c->x = wax;
c->y = way;
- if(n == 1) { /* only 1 window */
- c->w = waw - 2 * BORDERPX;
- c->h = wah - 2 * BORDERPX;
+ if(i == 0) { /* primary master window */
+ c->w = mpw - 2 * BORDERPX;
+ c->h = mph - 2 * BORDERPX;
+ if(n != 1)
+ th = wah / (n - 1);
}
- else if(i == 0) { /* master window */
+ else if(i == 1 && smaster) { /* secondary master window */
+ c->y += mph;
c->w = mpw - 2 * BORDERPX;
- c->h = wah - 2 * BORDERPX;
- th = wah / (n - 1);
+ c->h = (wah-mph) - 2 * BORDERPX;
}
else { /* tile window */
c->x += mpw;
c->w = (waw - mpw) - 2 * BORDERPX;
if(th > bh) {
- c->y += (i - 1) * th;
+ c->y += (i - 1 - smaster) * th;
c->h = th - 2 * BORDERPX;
}
else /* fallback if th < bh */
@@ -254,14 +272,29 @@ zoom(Arg *arg) {
n++;
if(n < 2 || (arrange == dofloat))
return;
- if((c = sel) == nexttiled(clients))
- if(!(c = nexttiled(c->next)))
- return;
- detach(c);
- if(clients)
+
+ c = sel;
+ if(!clients) {
+ c->next = clients;
+ clients = c;
+ }
+ if(c == nexttiled(clients))
+ hassm = False;
+ else if(hassm == True && c == nexttiled(clients->next)) {
+ detach(c);
clients->prev = c;
- c->next = clients;
- clients = c;
+ c->next = clients;
+ clients = c;
+ }
+ else {
+ hassm = True;
+ detach(c);
+ c->next = clients->next;
+ clients->next = c;
+ c->prev = clients;
+ c->next->prev = c;
+ }
+
focus(c);
arrange();
}