dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit cc8f1e8cd69d99b840d141c38eb46503765f8e2e
parent f7495bca403b1630ff6b4ad288a86d0fe38a0196
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Wed, 28 Nov 2012 22:08:01 +0100

Fix coding style within layout files

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
bstack.c | 36++++++++++++++++++------------------
fibonacci.c | 48++++++++++++++++++++++++------------------------
fullscreen.c | 7+++----
grid.c | 34+++++++++++++++++++---------------
tile.c | 30+++++++++++++++---------------
tstack.c | 36++++++++++++++++--------------------
6 files changed, 95 insertions(+), 96 deletions(-)

diff --git a/bstack.c b/bstack.c @@ -1,57 +1,57 @@ -static void -bstack(void) { +static void bstack(void) +{ unsigned int i, m, n, nx, ny, nw, nh, mh, tw; Client *c; - for(n = 0, m = 0, c = clients; c; c = c->next, n++) - if(c->minimized) + for (n = 0, m = 0, c = clients; c; c = c->next, n++) + if (c->minimized) m++; - if(n == 1) + if (n == 1) mh = wah; - else if(n - 1 == m) + else if (n - 1 == m) mh = wah - m; else mh = screen.mfact * (wah - m); /* true if there are at least 2 non minimized clients */ - if(n - 1 > m) + if (n - 1 > m) tw = waw / (n - m - 1); nx = wax; ny = way; - for(i = 0, c = clients; c; c = c->next, i++){ - if(i == 0){ /* master */ + for (i = 0, c = clients; c; c = c->next, i++) { + if (i == 0) { /* master */ nh = mh; nw = waw; - } else { /* tile window */ - if(i == 1){ + } else { /* tile window */ + if (i == 1) { nx = wax; ny += mh; nh = (way + wah - m) - ny; } - if(i == n - m - 1){ /* last not minimized client */ + if (i == n - m - 1) { /* last not minimized client */ nw = (wax + waw) - nx; - } else if(i == n - m){ /* first minimized client */ + } else if (i == n - m) { /* first minimized client */ ny += nh; nx = wax; nw = waw; nh = 1; - } else if(c->minimized) { /* minimized window */ + } else if (c->minimized) { /* minimized window */ nw = waw; nh = 1; ny++; - } else /* normal non minimized tile window */ + } else /* normal non minimized tile window */ nw = tw; - if(i > 1 && !c->minimized){ + if (i > 1 && !c->minimized) { mvvline(ny, nx, ACS_VLINE, nh); mvaddch(ny, nx, ACS_TTEE); nx++, nw--; } } - resize(c,nx,ny,nw,nh); + resize(c, nx, ny, nw, nh); - if(n > 1 && i < n - m - 1) + if (n > 1 && i < n - m - 1) nx += nw; } } diff --git a/fibonacci.c b/fibonacci.c @@ -1,10 +1,10 @@ -static void -fibonacci(int s) { +static void fibonacci(int s) +{ unsigned int nx, ny, nw, nnw, nh, nnh, i, n, m, nm, mod; Client *c; - for(n = 0, m = 0, c = clients; c; c = c->next,n++) - if(c->minimized) + for (n = 0, m = 0, c = clients; c; c = c->next, n++) + if (c->minimized) m++; /* number of non minimized windows */ nm = n - m; @@ -18,15 +18,15 @@ fibonacci(int s) { * variables for the next new width/height */ nnw = waw - nw - 1; - nnh = nh = (wah - m); /* leave space for the minimized clients */ + nnh = nh = (wah - m); /* leave space for the minimized clients */ /* set the mod factor, 2 for dwindle, 4 for spiral */ mod = s ? 4 : 2; - for(i = 0, c = clients; c; c = c->next,i++) { - if(!c->minimized) { - /* dwindle: even case, spiral: case 0*/ - if(i % mod == 0) { + for (i = 0, c = clients; c; c = c->next, i++) { + if (!c->minimized) { + /* dwindle: even case, spiral: case 0 */ + if (i % mod == 0) { if (i) { if (s) { nh = nnh; @@ -36,29 +36,29 @@ fibonacci(int s) { nh = nnh; } /* don't adjust the width for the last non-minimized client */ - if(i < nm - 1) { - nw /= 2; + if (i < nm - 1) { + nw /= 2; nnw -= nw + 1; } mvaddch(ny, nx - 1, ACS_LTEE); } - } else if(i % mod == 1) { /* dwindle: odd case, spiral: case 1*/ + } else if (i % mod == 1) { /* dwindle: odd case, spiral: case 1 */ nx += nw; mvvline(ny, nx, ACS_VLINE, nh); mvaddch(ny, nx, ACS_TTEE); ++nx; nw = nnw; /* don't adjust the height for the last non-minimized client */ - if(i < nm - 1) { + if (i < nm - 1) { nh /= 2; nnh -= nh; } - } else if(i % mod == 2 && s) { /* spiral: case 2*/ + } else if (i % mod == 2 && s) { /* spiral: case 2 */ ny += nh; nh = nnh; /* don't adjust the width for the last non-minimized client */ - if(i < nm - 1) { - nw /= 2; + if (i < nm - 1) { + nw /= 2; nnw -= nw + 1; nx += nnw; mvvline(ny, nx, ACS_VLINE, nh); @@ -67,11 +67,11 @@ fibonacci(int s) { } else { mvaddch(ny, nx - 1, ACS_LTEE); } - } else if(s) { /* spiral: case 3*/ + } else if (s) { /* spiral: case 3 */ nw = nnw; - nx -= nw + 1; /* border */ + nx -= nw + 1; /* border */ /* don't adjust the height for the last non-minimized client */ - if(i < nm - 1) { + if (i < nm - 1) { nh /= 2; nnh -= nh; ny += nnh; @@ -85,16 +85,16 @@ fibonacci(int s) { ny = way + wah - (n - i); } - resize(c,nx,ny,nw,nh); + resize(c, nx, ny, nw, nh); } } -static void -spiral(void) { +static void spiral(void) +{ fibonacci(1); } -static void -dwindle(void) { +static void dwindle(void) +{ fibonacci(0); } diff --git a/fullscreen.c b/fullscreen.c @@ -1,6 +1,5 @@ -static void -fullscreen(void) { - Client *c; - for(c = clients; c; c = c->next) +static void fullscreen(void) +{ + for (Client *c = clients; c; c = c->next) resize(c, wax, way, waw, wah); } diff --git a/grid.c b/grid.c @@ -1,50 +1,54 @@ -static void -grid(void) { +static void grid(void) +{ unsigned int i, m, nm, n, nx, ny, nw, nh, aw, ah, cols, rows; Client *c; - for(n = 0, m = 0, c = clients; c; c = c->next,n++) - if(c->minimized) + for (n = 0, m = 0, c = clients; c; c = c->next, n++) + if (c->minimized) m++; /* number of non minimized windows */ nm = n - m; /* grid dimensions */ - for(cols = 0; cols <= nm/2; cols++) - if(cols*cols >= nm) + for (cols = 0; cols <= nm / 2; cols++) + if (cols * cols >= nm) break; rows = (cols && (cols - 1) * cols >= nm) ? cols - 1 : cols; /* window geoms (cell height/width) */ nh = (wah - m) / (rows ? rows : 1); nw = waw / (cols ? cols : 1); - for(i = 0, c = clients; c; c = c->next,i++) { - if(!c->minimized){ + for (i = 0, c = clients; c; c = c->next, i++) { + if (!c->minimized) { /* if there are less clients in the last row than normal adjust the * split rate to fill the empty space */ - if(rows > 1 && i == (rows * cols) - cols && (nm - i) <= (nm % cols)) + if (rows > 1 && i == (rows * cols) - cols + && (nm - i) <= (nm % cols)) nw = waw / (nm - i); nx = (i % cols) * nw + wax; ny = (i / cols) * nh + way; /* adjust height/width of last row/column's windows */ - ah = (i >= cols * (rows -1)) ? wah - m - nh * rows : 0; + ah = (i >= cols * (rows - 1)) ? wah - m - nh * rows : 0; /* special case if there are less clients in the last row */ - if(rows > 1 && i == nm - 1 && (nm - i) < (nm % cols)) + if (rows > 1 && i == nm - 1 && (nm - i) < (nm % cols)) /* (n % cols) == number of clients in the last row */ aw = waw - nw * (nm % cols); else - aw = ((i + 1) % cols == 0) ? waw - nw * cols : 0; - if(i % cols){ + aw = ((i + 1) % cols == + 0) ? waw - nw * cols : 0; + if (i % cols) { mvvline(ny, nx, ACS_VLINE, nh + ah); /* if we are on the first row, or on the last one and there are fewer clients * than normal whose border does not match the line above, print a top tree char * otherwise a plus sign. */ - if(i <= cols || (i >= rows * cols - cols && nm % cols && (cols - (nm % cols)) % 2)) + if (i <= cols + || (i >= rows * cols - cols && nm % cols + && (cols - (nm % cols)) % 2)) mvaddch(ny, nx, ACS_TTEE); else mvaddch(ny, nx, ACS_PLUS); nx++, aw--; } } else { - if(i == nm){ /* first minimized client */ + if (i == nm) { /* first minimized client */ ny = way + wah - m; nx = wax; nw = waw; diff --git a/tile.c b/tile.c @@ -1,27 +1,27 @@ -static void -tile(void) { +static void tile(void) +{ unsigned int i, m, n, nx, ny, nw, nh, nm, mw, th; Client *c; - for(n = 0, m = 0, c = clients; c; c = c->next, n++) - if(c->minimized) + for (n = 0, m = 0, c = clients; c; c = c->next, n++) + if (c->minimized) m++; nm = n - m; /* window geoms */ mw = (n == 1 || n - 1 == m) ? waw : screen.mfact * waw; /* check if there are at least 2 non minimized clients */ - if(n - 1 > m) + if (n - 1 > m) th = (wah - m) / (nm - 1); nx = wax; ny = way; - for(i = 0, c = clients; c; c = c->next, i++) { - if(i == 0) { /* master */ + for (i = 0, c = clients; c; c = c->next, i++) { + if (i == 0) { /* master */ nw = mw; nh = (n - 1 > m) ? wah : wah - m; - } else { /* tile window */ - if(!c->minimized){ - if(i == 1) { + } else { /* tile window */ + if (!c->minimized) { + if (i == 1) { ny = way; nx += mw; nw = waw - mw; @@ -30,9 +30,9 @@ tile(void) { nx++, nw--; } /* remainder */ - if(m == 0 && i + 1 == n) /* no minimized clients */ + if (m == 0 && i + 1 == n) /* no minimized clients */ nh = (way + wah) - ny; - else if(i == nm - 1) /* last not minimized client */ + else if (i == nm - 1) /* last not minimized client */ nh = (way + wah - (n - i - 1)) - ny; else nh = th; @@ -40,11 +40,11 @@ tile(void) { nh = 1; ny = way + wah - (n - i); } - if(i > 1 && nm > 1) + if (i > 1 && nm > 1) mvaddch(ny, nx - 1, ACS_LTEE); } - resize(c,nx,ny,nw,nh); - if(n > 1 && th != wah) + resize(c, nx, ny, nw, nh); + if (n > 1 && th != wah) ny += nh; } } diff --git a/tstack.c b/tstack.c @@ -1,58 +1,54 @@ -void -tstack(void) { +void tstack(void) +{ unsigned int i, m, n, nx, ny, nw, nh, mh, tw; Client *c; - for(n = 0, m = 0, c = clients; c; c = c->next, n++) - if(c->minimized) + for (n = 0, m = 0, c = clients; c; c = c->next, n++) + if (c->minimized) m++; /* relative height */ mh = (wah - m) * (n == 1 || n - 1 == m ? 1 : screen.mfact); /* true if there are at least 2 non minimized clients */ - if(n - 1 > m) + if (n - 1 > m) tw = waw / (n - m - 1); nx = wax, nw = waw; - for(i = 0, c = clients; c; c = c->next, i++){ - if(i == 0){ /* master */ + for (i = 0, c = clients; c; c = c->next, i++) { + if (i == 0) { /* master */ ny = way + wah - mh; nh = mh; - } - else { /* tile window */ - if(i == 1){ + } else { /* tile window */ + if (i == 1) { nx = wax; ny = way + m; nh = wah - mh - ny + way; } - if(i == n - m - 1){ /* last not minimized client */ + if (i == n - m - 1) { /* last not minimized client */ nw = (wax + waw) - nx; - } - else if(i == n - m) { /* first minimized client */ + } else if (i == n - m) { /* first minimized client */ nx = wax; --ny; nh = 1; nw = waw; - } - else if(c->minimized) { /* minimized window */ + } else if (c->minimized) { /* minimized window */ --ny; nh = 1; nw = waw; - } - else /* normal non minimized tile window */ + } else /* normal non minimized tile window */ nw = tw; - if(i > 1 && !c->minimized){ + if (i > 1 && !c->minimized) { mvvline(ny, nx, ACS_VLINE, nh); mvaddch(ny, nx, ACS_TTEE); ++nx, --nw; } } - resize(c,nx,ny,nw,nh); + resize(c, nx, ny, nw, nh); - if(n > 1 && i < n - m - 1) + if (n > 1 && i < n - m - 1) nx += nw; } }