summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-06-19 12:28:56 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-06-19 12:28:56 +0100
commit31da0b7525f4a6f98fb5b3258da86d04387a0382 (patch)
treecffa127e01d321347cd4947cb4372599540d7426
parentuntested monocle (diff)
downloaddwm-31da0b7525f4a6f98fb5b3258da86d04387a0382.tar.gz
dwm-31da0b7525f4a6f98fb5b3258da86d04387a0382.zip
applied Gottox patch
-rw-r--r--dwm.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/dwm.c b/dwm.c
index f1d3641..0615978 100644
--- a/dwm.c
+++ b/dwm.c
@@ -207,7 +207,7 @@ static void zoom(const Arg *arg);
207static char stext[256]; 207static char stext[256];
208static int screen, sx, sy, sw, sh; 208static int screen, sx, sy, sw, sh;
209static int by, bh, blw, wx, wy, ww, wh; 209static int by, bh, blw, wx, wy, ww, wh;
210static uint seltags = 0; 210static uint seltags = 0, sellt = 0;
211static int (*xerrorxlib)(Display *, XErrorEvent *); 211static int (*xerrorxlib)(Display *, XErrorEvent *);
212static uint numlockmask = 0; 212static uint numlockmask = 0;
213static void (*handler[LASTEvent]) (XEvent *) = { 213static void (*handler[LASTEvent]) (XEvent *) = {
@@ -234,7 +234,7 @@ static Client *stack = NULL;
234static Cursor cursor[CurLast]; 234static Cursor cursor[CurLast];
235static Display *dpy; 235static Display *dpy;
236static DC dc = {0}; 236static DC dc = {0};
237static Layout *lt = NULL; 237static Layout *lt[] = { NULL, NULL };
238static Window root, barwin; 238static Window root, barwin;
239/* configuration, allows nested code to access above variables */ 239/* configuration, allows nested code to access above variables */
240#include "config.h" 240#include "config.h"
@@ -274,7 +274,7 @@ arrange(void) {
274 274
275 for(c = clients; c; c = c->next) 275 for(c = clients; c; c = c->next)
276 if(c->tags & tagset[seltags]) { /* is visible */ 276 if(c->tags & tagset[seltags]) { /* is visible */
277 if(!lt->arrange || c->isfloating) 277 if(!lt[sellt]->arrange || c->isfloating)
278 resize(c, c->x, c->y, c->w, c->h, True); 278 resize(c, c->x, c->y, c->w, c->h, True);
279 c->isbanned = False; 279 c->isbanned = False;
280 } 280 }
@@ -284,8 +284,8 @@ arrange(void) {
284 } 284 }
285 285
286 focus(NULL); 286 focus(NULL);
287 if(lt->arrange) 287 if(lt[sellt]->arrange)
288 lt->arrange(); 288 lt[sellt]->arrange();
289 restack(); 289 restack();
290} 290}
291 291
@@ -355,7 +355,7 @@ cleanup(void) {
355 355
356 close(STDIN_FILENO); 356 close(STDIN_FILENO);
357 view(&a); 357 view(&a);
358 lt = &foo; 358 lt[sellt] = &foo;
359 while(stack) 359 while(stack)
360 unmanage(stack); 360 unmanage(stack);
361 if(dc.font.set) 361 if(dc.font.set)
@@ -413,7 +413,7 @@ configurerequest(XEvent *e) {
413 if((c = getclient(ev->window))) { 413 if((c = getclient(ev->window))) {
414 if(ev->value_mask & CWBorderWidth) 414 if(ev->value_mask & CWBorderWidth)
415 c->bw = ev->border_width; 415 c->bw = ev->border_width;
416 else if(c->isfloating || !lt->arrange) { 416 else if(c->isfloating || !lt[sellt]->arrange) {
417 if(ev->value_mask & CWX) 417 if(ev->value_mask & CWX)
418 c->x = sx + ev->x; 418 c->x = sx + ev->x;
419 if(ev->value_mask & CWY) 419 if(ev->value_mask & CWY)
@@ -500,7 +500,7 @@ drawbar(void) {
500 } 500 }
501 if(blw > 0) { 501 if(blw > 0) {
502 dc.w = blw; 502 dc.w = blw;
503 drawtext(lt->symbol, dc.norm, False); 503 drawtext(lt[sellt]->symbol, dc.norm, False);
504 x = dc.x + dc.w; 504 x = dc.x + dc.w;
505 } 505 }
506 else 506 else
@@ -1009,10 +1009,10 @@ movemouse(const Arg *arg) {
1009 ny = wy; 1009 ny = wy;
1010 else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap) 1010 else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap)
1011 ny = wy + wh - c->h - 2 * c->bw; 1011 ny = wy + wh - c->h - 2 * c->bw;
1012 if(!c->isfloating && lt->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) 1012 if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
1013 togglefloating(NULL); 1013 togglefloating(NULL);
1014 } 1014 }
1015 if(!lt->arrange || c->isfloating) 1015 if(!lt[sellt]->arrange || c->isfloating)
1016 resize(c, nx, ny, c->w, c->h, False); 1016 resize(c, nx, ny, c->w, c->h, False);
1017 break; 1017 break;
1018 } 1018 }
@@ -1166,11 +1166,11 @@ resizemouse(const Arg *arg) {
1166 1166
1167 if(snap && nw >= wx && nw <= wx + ww 1167 if(snap && nw >= wx && nw <= wx + ww
1168 && nh >= wy && nh <= wy + wh) { 1168 && nh >= wy && nh <= wy + wh) {
1169 if(!c->isfloating && lt->arrange 1169 if(!c->isfloating && lt[sellt]->arrange
1170 && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) 1170 && (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
1171 togglefloating(NULL); 1171 togglefloating(NULL);
1172 } 1172 }
1173 if(!lt->arrange || c->isfloating) 1173 if(!lt[sellt]->arrange || c->isfloating)
1174 resize(c, c->x, c->y, nw, nh, True); 1174 resize(c, c->x, c->y, nw, nh, True);
1175 break; 1175 break;
1176 } 1176 }
@@ -1186,9 +1186,9 @@ restack(void) {
1186 drawbar(); 1186 drawbar();
1187 if(!sel) 1187 if(!sel)
1188 return; 1188 return;
1189 if(sel->isfloating || !lt->arrange) 1189 if(sel->isfloating || !lt[sellt]->arrange)
1190 XRaiseWindow(dpy, sel->win); 1190 XRaiseWindow(dpy, sel->win);
1191 if(lt->arrange) { 1191 if(lt[sellt]->arrange) {
1192 wc.stack_mode = Below; 1192 wc.stack_mode = Below;
1193 wc.sibling = barwin; 1193 wc.sibling = barwin;
1194 for(c = stack; c; c = c->snext) 1194 for(c = stack; c; c = c->snext)
@@ -1298,14 +1298,9 @@ setclientstate(Client *c, long state) {
1298 1298
1299void 1299void
1300setlayout(const Arg *arg) { 1300setlayout(const Arg *arg) {
1301 static Layout *prevlt = &layouts[1 % LENGTH(layouts)]; 1301 sellt ^= 1;
1302 1302 if(arg && arg->v && arg->v != lt[sellt])
1303 if(!arg || !arg->v || arg->v == lt) 1303 lt[sellt] = (Layout *)arg->v;
1304 lt = prevlt;
1305 else {
1306 prevlt = lt;
1307 lt = (Layout *)arg->v;
1308 }
1309 if(sel) 1304 if(sel)
1310 arrange(); 1305 arrange();
1311 else 1306 else
@@ -1317,7 +1312,7 @@ void
1317setmfact(const Arg *arg) { 1312setmfact(const Arg *arg) {
1318 float f; 1313 float f;
1319 1314
1320 if(!arg || !lt->arrange) 1315 if(!arg || !lt[sellt]->arrange)
1321 return; 1316 return;
1322 f = arg->f < 1.0 ? arg->f + mfact : arg->f - 1.0; 1317 f = arg->f < 1.0 ? arg->f + mfact : arg->f - 1.0;
1323 if(f < 0.1 || f > 0.9) 1318 if(f < 0.1 || f > 0.9)
@@ -1341,7 +1336,8 @@ setup(void) {
1341 sw = DisplayWidth(dpy, screen); 1336 sw = DisplayWidth(dpy, screen);
1342 sh = DisplayHeight(dpy, screen); 1337 sh = DisplayHeight(dpy, screen);
1343 bh = dc.h = dc.font.height + 2; 1338 bh = dc.h = dc.font.height + 2;
1344 lt = layouts; 1339 lt[0] = &layouts[0];
1340 lt[1] = &layouts[1 % LENGTH(layouts)];
1345 updategeom(); 1341 updategeom();
1346 1342
1347 /* init atoms */ 1343 /* init atoms */
@@ -1691,7 +1687,7 @@ void
1691zoom(const Arg *arg) { 1687zoom(const Arg *arg) {
1692 Client *c = sel; 1688 Client *c = sel;
1693 1689
1694 if(!lt->arrange || lt->arrange == monocle || (sel && sel->isfloating)) 1690 if(!lt[sellt]->arrange || lt[sellt]->arrange == monocle || (sel && sel->isfloating))
1695 return; 1691 return;
1696 if(c == nexttiled(clients)) 1692 if(c == nexttiled(clients))
1697 if(!c || !(c = nexttiled(c->next))) 1693 if(!c || !(c = nexttiled(c->next)))