]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/winwatch.c
libtags, zuke: add *.mod support (thanks kemal)
[plan9front.git] / sys / src / cmd / winwatch.c
index d8feebbe91a2cbf466cec7fedf53c0414351dc1b..1f88dc541495281987aa399adaf9a954c378a004 100644 (file)
@@ -117,7 +117,7 @@ refreshwin(void)
                        n = atoi(pd[i].name);
                        if(n == mywinid)
                                continue;
-                       if(readfile(label, sizeof(label), "/dev/wsys/%d/label", n) <= 0)
+                       if(readfile(label, sizeof(label), "/dev/wsys/%d/label", n) < 0)
                                continue;
                        if(exclude != nil && regexec(exclude,label,nil,0))
                                continue;
@@ -185,19 +185,21 @@ drawwin(int i)
 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);