ref: 66b8fabdb676aac215a94de23708d3582db20f8c
parent: 63f6c8631792be64af228a766b3b1d4639e91267
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Feb 14 16:04:57 EST 2020
plan9: framedev: show ms insted of µs; make redraw channel unbuffered
--- a/plan9.c
+++ b/plan9.c
@@ -74,7 +74,7 @@
static Field copyfield;
static int altdown;
static int mode = Minsert;
-static long framedev; /* frame deviation >= 1µs */
+static long framedev; /* frame deviation >= 1ms */
static char *style[Numstyles] = {
[Sfancy] = "fancy",
@@ -282,7 +282,7 @@
oldbpm = bpm;
}
- /* doesn't suppose to jump back, but just in case do _something_ */
+ /* not supposed to jump back, but just in case, do _something_ */
if (n < oldn)
end -= oldn - n;
@@ -295,7 +295,7 @@
sleep(1);
}
- framedev = (processnew - processold - 15000000000LL/bpm) / 1000LL;
+ framedev = labs(processnew/1000LL - processold/1000LL)/1000L - 15000L/bpm;
tick++;
}
}
@@ -425,7 +425,7 @@
/* frame deviation */
p.y -= font->height;
p.x += charw * (len + Coloff);
- len = MAX(6, runesprint(linebuf, "%ldµs", labs(framedev)));
+ len = MAX(6, runesprint(linebuf, "%ldms", labs(framedev)));
runestring(screen, p, color[Dfhigh], ZP, font, linebuf);
USED(len);
@@ -694,7 +694,7 @@
a[Ckey].c = kchan;
a[Cmouse].c = mctl->c;
a[Cresize].c = mctl->resizec;
- a[Credraw].c = chancreate(sizeof(ulong), 1);
+ a[Credraw].c = chancreate(sizeof(ulong), 0);
for (n = 0; n < Numcolors; n++)
color[n] = allocimage(display, Rect(0, 0, 1, 1), RGBA32, 1, setalpha(theme[n] & ~0xff, theme[n] & 0xff));