ref: 6e5333dc66033dcd0100bc6f7df15371ca33ad45
parent: 93570dfab10c1f9cf99182ec3a37373dd70427ae
author: Sigrid <ftrvxmtrx@gmail.com>
date: Tue Feb 2 06:56:45 EST 2021
winwatch: always reflow when possible (thanks telephil9)
--- a/sys/src/cmd/winwatch.c
+++ b/sys/src/cmd/winwatch.c
@@ -185,19 +185,21 @@
int
geometry(void)
{
- int i, ncols, z;
+ int i, nrows, ncols, z;
Rectangle r;
z = 0;
- rows = (Dy(screen->r)-2*MARGIN+PAD)/(font->height+PAD);
- if(rows <= 0)
- rows = 1;
- if(rows*cols < nwin || rows*cols >= nwin*2){
- ncols = nwin <= 0 ? 1 : (nwin+rows-1)/rows;
- if(ncols != cols){
- cols = ncols;
- z = 1;
- }
+ nrows = (Dy(screen->r)-2*MARGIN+PAD)/(font->height+PAD);
+ if(nrows <= 0)
+ nrows = 1;
+ if(nrows != rows){
+ rows = nrows;
+ z = 1;
+ }
+ ncols = nwin <= 0 ? 1 : (nwin+rows-1)/rows;
+ if(ncols != cols){
+ cols = ncols;
+ z = 1;
}
r = Rect(0,0,(Dx(screen->r)-2*MARGIN+PAD)/cols-PAD, font->height);
--
⑨