shithub: riscv

Download patch

ref: ddfe55ee2fab41e2bfaa0c1800bba832999e1b0d
parent: 45bb01434cc038d07c687afe88bf4a0927a07a1d
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Fri Dec 9 15:38:01 EST 2011

winwatch: honor $font instead of hardcoding

--- a/sys/src/cmd/winwatch.c
+++ b/sys/src/cmd/winwatch.c
@@ -20,7 +20,6 @@
 int mwin;
 int onwin;
 int rows, cols;
-Font *font;
 Image *lightblue;
 
 enum {
@@ -243,11 +242,10 @@
 void
 main(int argc, char **argv)
 {
-	char *fontname;
+	char *fontname = nil;
 	int Etimer;
 	Event e;
 
-	fontname = "/lib/font/bit/lucidasans/unicode.8.font";
 	ARGBEGIN{
 	case 'f':
 		fontname = EARGF(usage());
@@ -268,8 +266,10 @@
 	lightblue = allocimagemix(display, DPalebluegreen, DWhite);
 	if(lightblue == nil)
 		sysfatal("allocimagemix: %r");
-	if((font = openfont(display, fontname)) == nil)
-		sysfatal("font '%s' not found", fontname);
+
+	if(fontname)
+		if((font = openfont(display, fontname)) == nil)
+			sysfatal("font '%s' not found", fontname);
 
 	refreshwin();
 	redraw(screen, 1);