summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2009-07-06 20:12:47 +0100
committerAnselm R Garbe <anselm@garbe.us>2009-07-06 20:12:47 +0100
commita72dc2fec277bb517adcb98edfb18f469333d980 (patch)
treec6de2b9f83d5e503e64f1ed9e40b729a04720531 /dwm.c
parentsome cleanups (diff)
downloaddwm-a72dc2fec277bb517adcb98edfb18f469333d980.tar.gz
dwm-a72dc2fec277bb517adcb98edfb18f469333d980.zip
applied Mate's patch, added Mate to LICENSE
Diffstat (limited to '')
-rw-r--r--dwm.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/dwm.c b/dwm.c
index 9e049c6..c0a15cc 100644
--- a/dwm.c
+++ b/dwm.c
@@ -136,6 +136,7 @@ struct Monitor {
136 Client *stack; 136 Client *stack;
137 Monitor *next; 137 Monitor *next;
138 Window barwin; 138 Window barwin;
139 Layout *lt[2];
139}; 140};
140 141
141typedef struct { 142typedef struct {
@@ -261,7 +262,6 @@ static Bool running = True;
261static Cursor cursor[CurLast]; 262static Cursor cursor[CurLast];
262static Display *dpy; 263static Display *dpy;
263static DC dc; 264static DC dc;
264static Layout *lt[] = { NULL, NULL };
265static Monitor *mons = NULL, *selmon = NULL; 265static Monitor *mons = NULL, *selmon = NULL;
266static Window root; 266static Window root;
267 267
@@ -376,8 +376,8 @@ arrange(void) {
376 showhide(m->stack); 376 showhide(m->stack);
377 focus(NULL); 377 focus(NULL);
378 for(m = mons; m; m = m->next) { 378 for(m = mons; m; m = m->next) {
379 if(lt[m->sellt]->arrange) 379 if(m->lt[m->sellt]->arrange)
380 lt[m->sellt]->arrange(m); 380 m->lt[m->sellt]->arrange(m);
381 restack(m); 381 restack(m);
382 } 382 }
383} 383}
@@ -456,7 +456,7 @@ cleanup(void) {
456 Monitor *m; 456 Monitor *m;
457 457
458 view(&a); 458 view(&a);
459 lt[selmon->sellt] = &foo; 459 selmon->lt[selmon->sellt] = &foo;
460 for(m = mons; m; m = m->next) 460 for(m = mons; m; m = m->next)
461 while(m->stack) 461 while(m->stack)
462 unmanage(m->stack); 462 unmanage(m->stack);
@@ -547,7 +547,7 @@ configurerequest(XEvent *e) {
547 if((c = wintoclient(ev->window))) { 547 if((c = wintoclient(ev->window))) {
548 if(ev->value_mask & CWBorderWidth) 548 if(ev->value_mask & CWBorderWidth)
549 c->bw = ev->border_width; 549 c->bw = ev->border_width;
550 else if(c->isfloating || !lt[selmon->sellt]->arrange) { 550 else if(c->isfloating || !selmon->lt[selmon->sellt]->arrange) {
551 m = c->mon; 551 m = c->mon;
552 if(ev->value_mask & CWX) 552 if(ev->value_mask & CWX)
553 c->x = m->mx + ev->x; 553 c->x = m->mx + ev->x;
@@ -668,7 +668,7 @@ drawbar(Monitor *m) {
668 } 668 }
669 if(blw > 0) { 669 if(blw > 0) {
670 dc.w = blw; 670 dc.w = blw;
671 drawtext(lt[m->sellt]->symbol, dc.norm, False); 671 drawtext(m->lt[m->sellt]->symbol, dc.norm, False);
672 x = dc.x + dc.w; 672 x = dc.x + dc.w;
673 } 673 }
674 else 674 else
@@ -1170,11 +1170,11 @@ movemouse(const Arg *arg) {
1170 ny = selmon->wy; 1170 ny = selmon->wy;
1171 else if(abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) 1171 else if(abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
1172 ny = selmon->wy + selmon->wh - HEIGHT(c); 1172 ny = selmon->wy + selmon->wh - HEIGHT(c);
1173 if(!c->isfloating && lt[selmon->sellt]->arrange 1173 if(!c->isfloating && selmon->lt[selmon->sellt]->arrange
1174 && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) 1174 && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
1175 togglefloating(NULL); 1175 togglefloating(NULL);
1176 } 1176 }
1177 if(!lt[selmon->sellt]->arrange || c->isfloating) 1177 if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
1178 resize(c, nx, ny, c->w, c->h, True); 1178 resize(c, nx, ny, c->w, c->h, True);
1179 break; 1179 break;
1180 } 1180 }
@@ -1289,11 +1289,11 @@ resizemouse(const Arg *arg) {
1289 nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); 1289 nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
1290 if(snap && nw >= selmon->wx && nw <= selmon->wx + selmon->ww 1290 if(snap && nw >= selmon->wx && nw <= selmon->wx + selmon->ww
1291 && nh >= selmon->wy && nh <= selmon->wy + selmon->wh) { 1291 && nh >= selmon->wy && nh <= selmon->wy + selmon->wh) {
1292 if(!c->isfloating && lt[selmon->sellt]->arrange 1292 if(!c->isfloating && selmon->lt[selmon->sellt]->arrange
1293 && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) 1293 && (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
1294 togglefloating(NULL); 1294 togglefloating(NULL);
1295 } 1295 }
1296 if(!lt[selmon->sellt]->arrange || c->isfloating) 1296 if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
1297 resize(c, c->x, c->y, nw, nh, True); 1297 resize(c, c->x, c->y, nw, nh, True);
1298 break; 1298 break;
1299 } 1299 }
@@ -1318,9 +1318,9 @@ restack(Monitor *m) {
1318 drawbars(); 1318 drawbars();
1319 if(!m->sel) 1319 if(!m->sel)
1320 return; 1320 return;
1321 if(m->sel->isfloating || !lt[m->sellt]->arrange) 1321 if(m->sel->isfloating || !m->lt[m->sellt]->arrange)
1322 XRaiseWindow(dpy, m->sel->win); 1322 XRaiseWindow(dpy, m->sel->win);
1323 if(lt[m->sellt]->arrange) { 1323 if(m->lt[m->sellt]->arrange) {
1324 wc.stack_mode = Below; 1324 wc.stack_mode = Below;
1325 wc.sibling = m->barwin; 1325 wc.sibling = m->barwin;
1326 for(c = m->stack; c; c = c->snext) 1326 for(c = m->stack; c; c = c->snext)
@@ -1396,10 +1396,10 @@ setclientstate(Client *c, long state) {
1396 1396
1397void 1397void
1398setlayout(const Arg *arg) { 1398setlayout(const Arg *arg) {
1399 if(!arg || !arg->v || arg->v != lt[selmon->sellt]) 1399 if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
1400 selmon->sellt ^= 1; 1400 selmon->sellt ^= 1;
1401 if(arg && arg->v) 1401 if(arg && arg->v)
1402 lt[selmon->sellt] = (Layout *)arg->v; 1402 selmon->lt[selmon->sellt] = (Layout *)arg->v;
1403 if(selmon->sel) 1403 if(selmon->sel)
1404 arrange(); 1404 arrange();
1405 else 1405 else
@@ -1411,7 +1411,7 @@ void
1411setmfact(const Arg *arg) { 1411setmfact(const Arg *arg) {
1412 float f; 1412 float f;
1413 1413
1414 if(!arg || !lt[selmon->sellt]->arrange) 1414 if(!arg || !selmon->lt[selmon->sellt]->arrange)
1415 return; 1415 return;
1416 f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; 1416 f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
1417 if(f < 0.1 || f > 0.9) 1417 if(f < 0.1 || f > 0.9)
@@ -1433,8 +1433,6 @@ setup(void) {
1433 sw = DisplayWidth(dpy, screen); 1433 sw = DisplayWidth(dpy, screen);
1434 sh = DisplayHeight(dpy, screen); 1434 sh = DisplayHeight(dpy, screen);
1435 bh = dc.h = dc.font.height + 2; 1435 bh = dc.h = dc.font.height + 2;
1436 lt[0] = &layouts[0];
1437 lt[1] = &layouts[1 % LENGTH(layouts)];
1438 updategeom(); 1436 updategeom();
1439 /* init atoms */ 1437 /* init atoms */
1440 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); 1438 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
@@ -1484,7 +1482,7 @@ showhide(Client *c) {
1484 return; 1482 return;
1485 if(ISVISIBLE(c)) { /* show clients top down */ 1483 if(ISVISIBLE(c)) { /* show clients top down */
1486 XMoveWindow(dpy, c->win, c->x, c->y); 1484 XMoveWindow(dpy, c->win, c->x, c->y);
1487 if(!lt[c->mon->sellt]->arrange || c->isfloating) 1485 if(!c->mon->lt[c->mon->sellt]->arrange || c->isfloating)
1488 resize(c, c->x, c->y, c->w, c->h, False); 1486 resize(c, c->x, c->y, c->w, c->h, False);
1489 showhide(c->snext); 1487 showhide(c->snext);
1490 } 1488 }
@@ -1730,6 +1728,8 @@ updategeom(void) {
1730 m->mfact = mfact; 1728 m->mfact = mfact;
1731 m->showbar = SHOWBAR; 1729 m->showbar = SHOWBAR;
1732 m->topbar = TOPBAR; 1730 m->topbar = TOPBAR;
1731 m->lt[0] = &layouts[0];
1732 m->lt[1] = &layouts[1 % LENGTH(layouts)];
1733 updatebarpos(m); 1733 updatebarpos(m);
1734 } 1734 }
1735 /* reassign left over clients of disappeared monitors */ 1735 /* reassign left over clients of disappeared monitors */
@@ -1916,8 +1916,8 @@ void
1916zoom(const Arg *arg) { 1916zoom(const Arg *arg) {
1917 Client *c = selmon->sel; 1917 Client *c = selmon->sel;
1918 1918
1919 if(!lt[selmon->sellt]->arrange 1919 if(!selmon->lt[selmon->sellt]->arrange
1920 || lt[selmon->sellt]->arrange == monocle 1920 || selmon->lt[selmon->sellt]->arrange == monocle
1921 || (selmon->sel && selmon->sel->isfloating)) 1921 || (selmon->sel && selmon->sel->isfloating))
1922 return; 1922 return;
1923 if(c == nexttiled(selmon->clients)) 1923 if(c == nexttiled(selmon->clients))