shithub: bar

Download patch

ref: 788b43acc54ce8cc74681750f708c9044bfa2b72
parent: 5298ca94f10aed02b5aa78639c0da5cdb35d5dfa
parent:
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Nov 20 06:38:29 EST 2020

do not redraw on every event

--- a/bar.c	Fri Nov 20 05:57:39 2020
+++ b/bar.c	Fri Nov 20 06:38:29 2020
@@ -221,12 +221,11 @@
 	brgb = ~(brgb>>8 | brgb>>16 | brgb>>24);
 	brgb = brgb<<8 | brgb<<16 | brgb<<24 | 0xff;
 	ctext = allocimage(display, Rect(0,0,1,1), RGB24, 1, brgb);
+	redraw();
 
 	proccreate(updateproc, nil, 4096);
 
 	for(;;){
-		redraw();
-
 		switch(alt(a)){
 		case 0:
 			break;
@@ -234,6 +233,7 @@
 		case 1:
 			if(getwindow(display, Refnone) < 0)
 				sysfatal("getwindow: %r");
+			redraw();
 			break;
 
 		case 2: