applied Mate's patch, added Mate to LICENSE
a72dc2fe
2 file(s) · +21 −20
| 10 | 10 | © 2007-2008 Peter Hartlich <sgkkr at hartlich dot com> |
|
| 11 | 11 | © 2008 Martin Hurton <martin dot hurton at gmail dot com> |
|
| 12 | 12 | © 2008 Neale Pickett <neale dot woozle dot org> |
|
| 13 | + | © 2009 Mate Nagy <mnagy@port70.net> |
|
| 13 | 14 | ||
| 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a |
|
| 15 | 16 | copy of this software and associated documentation files (the "Software"), |
| 136 | 136 | Client *stack; |
|
| 137 | 137 | Monitor *next; |
|
| 138 | 138 | Window barwin; |
|
| 139 | + | Layout *lt[2]; |
|
| 139 | 140 | }; |
|
| 140 | 141 | ||
| 141 | 142 | typedef struct { |
|
| 261 | 262 | static Cursor cursor[CurLast]; |
|
| 262 | 263 | static Display *dpy; |
|
| 263 | 264 | static DC dc; |
|
| 264 | - | static Layout *lt[] = { NULL, NULL }; |
|
| 265 | 265 | static Monitor *mons = NULL, *selmon = NULL; |
|
| 266 | 266 | static Window root; |
|
| 267 | 267 | ||
| 376 | 376 | showhide(m->stack); |
|
| 377 | 377 | focus(NULL); |
|
| 378 | 378 | for(m = mons; m; m = m->next) { |
|
| 379 | - | if(lt[m->sellt]->arrange) |
|
| 380 | - | lt[m->sellt]->arrange(m); |
|
| 379 | + | if(m->lt[m->sellt]->arrange) |
|
| 380 | + | m->lt[m->sellt]->arrange(m); |
|
| 381 | 381 | restack(m); |
|
| 382 | 382 | } |
|
| 383 | 383 | } |
|
| 456 | 456 | Monitor *m; |
|
| 457 | 457 | ||
| 458 | 458 | view(&a); |
|
| 459 | - | lt[selmon->sellt] = &foo; |
|
| 459 | + | selmon->lt[selmon->sellt] = &foo; |
|
| 460 | 460 | for(m = mons; m; m = m->next) |
|
| 461 | 461 | while(m->stack) |
|
| 462 | 462 | unmanage(m->stack); |
|
| 547 | 547 | if((c = wintoclient(ev->window))) { |
|
| 548 | 548 | if(ev->value_mask & CWBorderWidth) |
|
| 549 | 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 | 551 | m = c->mon; |
|
| 552 | 552 | if(ev->value_mask & CWX) |
|
| 553 | 553 | c->x = m->mx + ev->x; |
|
| 668 | 668 | } |
|
| 669 | 669 | if(blw > 0) { |
|
| 670 | 670 | dc.w = blw; |
|
| 671 | - | drawtext(lt[m->sellt]->symbol, dc.norm, False); |
|
| 671 | + | drawtext(m->lt[m->sellt]->symbol, dc.norm, False); |
|
| 672 | 672 | x = dc.x + dc.w; |
|
| 673 | 673 | } |
|
| 674 | 674 | else |
|
| 1170 | 1170 | ny = selmon->wy; |
|
| 1171 | 1171 | else if(abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) |
|
| 1172 | 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 | 1174 | && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) |
|
| 1175 | 1175 | togglefloating(NULL); |
|
| 1176 | 1176 | } |
|
| 1177 | - | if(!lt[selmon->sellt]->arrange || c->isfloating) |
|
| 1177 | + | if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) |
|
| 1178 | 1178 | resize(c, nx, ny, c->w, c->h, True); |
|
| 1179 | 1179 | break; |
|
| 1180 | 1180 | } |
|
| 1289 | 1289 | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); |
|
| 1290 | 1290 | if(snap && nw >= selmon->wx && nw <= selmon->wx + selmon->ww |
|
| 1291 | 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 | 1293 | && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) |
|
| 1294 | 1294 | togglefloating(NULL); |
|
| 1295 | 1295 | } |
|
| 1296 | - | if(!lt[selmon->sellt]->arrange || c->isfloating) |
|
| 1296 | + | if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) |
|
| 1297 | 1297 | resize(c, c->x, c->y, nw, nh, True); |
|
| 1298 | 1298 | break; |
|
| 1299 | 1299 | } |
|
| 1318 | 1318 | drawbars(); |
|
| 1319 | 1319 | if(!m->sel) |
|
| 1320 | 1320 | return; |
|
| 1321 | - | if(m->sel->isfloating || !lt[m->sellt]->arrange) |
|
| 1321 | + | if(m->sel->isfloating || !m->lt[m->sellt]->arrange) |
|
| 1322 | 1322 | XRaiseWindow(dpy, m->sel->win); |
|
| 1323 | - | if(lt[m->sellt]->arrange) { |
|
| 1323 | + | if(m->lt[m->sellt]->arrange) { |
|
| 1324 | 1324 | wc.stack_mode = Below; |
|
| 1325 | 1325 | wc.sibling = m->barwin; |
|
| 1326 | 1326 | for(c = m->stack; c; c = c->snext) |
|
| 1396 | 1396 | ||
| 1397 | 1397 | void |
|
| 1398 | 1398 | setlayout(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 | 1400 | selmon->sellt ^= 1; |
|
| 1401 | 1401 | if(arg && arg->v) |
|
| 1402 | - | lt[selmon->sellt] = (Layout *)arg->v; |
|
| 1402 | + | selmon->lt[selmon->sellt] = (Layout *)arg->v; |
|
| 1403 | 1403 | if(selmon->sel) |
|
| 1404 | 1404 | arrange(); |
|
| 1405 | 1405 | else |
|
| 1411 | 1411 | setmfact(const Arg *arg) { |
|
| 1412 | 1412 | float f; |
|
| 1413 | 1413 | ||
| 1414 | - | if(!arg || !lt[selmon->sellt]->arrange) |
|
| 1414 | + | if(!arg || !selmon->lt[selmon->sellt]->arrange) |
|
| 1415 | 1415 | return; |
|
| 1416 | 1416 | f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; |
|
| 1417 | 1417 | if(f < 0.1 || f > 0.9) |
|
| 1433 | 1433 | sw = DisplayWidth(dpy, screen); |
|
| 1434 | 1434 | sh = DisplayHeight(dpy, screen); |
|
| 1435 | 1435 | bh = dc.h = dc.font.height + 2; |
|
| 1436 | - | lt[0] = &layouts[0]; |
|
| 1437 | - | lt[1] = &layouts[1 % LENGTH(layouts)]; |
|
| 1438 | 1436 | updategeom(); |
|
| 1439 | 1437 | /* init atoms */ |
|
| 1440 | 1438 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
|
| 1484 | 1482 | return; |
|
| 1485 | 1483 | if(ISVISIBLE(c)) { /* show clients top down */ |
|
| 1486 | 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 | 1486 | resize(c, c->x, c->y, c->w, c->h, False); |
|
| 1489 | 1487 | showhide(c->snext); |
|
| 1490 | 1488 | } |
|
| 1730 | 1728 | m->mfact = mfact; |
|
| 1731 | 1729 | m->showbar = SHOWBAR; |
|
| 1732 | 1730 | m->topbar = TOPBAR; |
|
| 1731 | + | m->lt[0] = &layouts[0]; |
|
| 1732 | + | m->lt[1] = &layouts[1 % LENGTH(layouts)]; |
|
| 1733 | 1733 | updatebarpos(m); |
|
| 1734 | 1734 | } |
|
| 1735 | 1735 | /* reassign left over clients of disappeared monitors */ |
|
| 1916 | 1916 | zoom(const Arg *arg) { |
|
| 1917 | 1917 | Client *c = selmon->sel; |
|
| 1918 | 1918 | ||
| 1919 | - | if(!lt[selmon->sellt]->arrange |
|
| 1920 | - | || lt[selmon->sellt]->arrange == monocle |
|
| 1919 | + | if(!selmon->lt[selmon->sellt]->arrange |
|
| 1920 | + | || selmon->lt[selmon->sellt]->arrange == monocle |
|
| 1921 | 1921 | || (selmon->sel && selmon->sel->isfloating)) |
|
| 1922 | 1922 | return; |
|
| 1923 | 1923 | if(c == nexttiled(selmon->clients)) |
|