ref: b4f44fb55211c0445e3b55080082ee92d569e354
parent: 55d7cc8d1d4fe834ed8658d0a6ac5b0c4821d9d2
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Aug 24 10:25:51 EDT 2020
HiDPI-ready now
--- a/zuke.c
+++ b/zuke.c
@@ -23,9 +23,6 @@
Seek = 10, /* 10 seconds */
Seekfast = 60, /* a minute */
- Scrollwidth = 14,
- Scrollheight = 16,
-
Bps = 44100*2*2, /* 44100KHz, stereo, s16 for a sample */
Relbufsz = Bps/5, /* 0.2 second */
};
@@ -67,6 +64,10 @@
static double seekoff; /* ms */
static char *covers[] = {"folder", "cover", "Cover", "scans/CD", "Scans/Front", "Covers/Front"};
+static int Scrollwidth;
+static int Scrollheight;
+static int Coversz;
+
static char *menu3i[] = {
"theme",
"exit",
@@ -369,7 +370,7 @@
dup(fd = open("/dev/null", OWRITE), 2);
close(fd);
}
- snprint(tmp, sizeof(tmp), "%s -9t | resample -x128", prog);
+ snprint(tmp, sizeof(tmp), "%s -9t | resample -x%d", prog, Coversz);
execl("/bin/rc", "rc", "-c", tmp, nil);
sysfatal("execl: %r");
}
@@ -894,6 +895,10 @@
if(initdraw(nil, nil, "zuke") < 0)
sysfatal("initdraw: %r");
+ f = display->defaultfont;
+ Scrollwidth = MAX(14, stringwidth(f, "#"));
+ Scrollheight = MAX(16, f->height);
+ Coversz = MAX(64, stringwidth(f, "00:00/00:00 100%"));
unlockdisplay(display);
if((mctl = initmouse(nil, screen)) == nil)
sysfatal("initmouse: %r");
@@ -904,7 +909,6 @@
a[1].c = mctl->resizec;
a[2].c = kctl->c;
- f = display->defaultfont;
srand(time(0));
pcurplaying = -1;
chvolume(0);