ref: 423f348fa9b5b312129efdd2e4a873b70251cf37
parent: 0f5f23a78f2e51a05640b7dbe99648280709770a
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Jan 9 14:46:52 EST 2020
get rid of redraw arguments
--- a/zuke.c
+++ b/zuke.c
@@ -105,7 +105,7 @@
}
static void
-redraw(Image *screen, int new)
+redraw(void)
{
Image *col;
Point p, sp;
@@ -117,10 +117,7 @@
return;
lockdisplay(display);
- if(new && getwindow(display, Refnone) < 0)
- sysfatal("getwindow: %r");
- else
- draw(screen, screen->r, cola, nil, ZP);
+ draw(screen, screen->r, cola, nil, ZP);
scrollsz = Dy(screen->r) / f->height - 1;
adjustcolumns();
@@ -439,7 +436,7 @@
pcurplaying = player->pcur;
if(c != Cbackward && c != Cbackwardfast)
- redraw(screen, 0);
+ redraw();
while(1){
n = Relbufsz;
@@ -453,7 +450,7 @@
if(player->img != nil && nbrecv(player->img, &thiscover) != 0){
freeimage(cover);
cover = thiscover;
- redraw(screen, 0);
+ redraw();
player->img = nil;
}
c = nbrecvul(player->ctl);
@@ -492,7 +489,7 @@
}
byteswritten += n;
if(bytesfrom == byteswritten || (byteswritten/Bps > (byteswritten-n)/Bps))
- redraw(screen, 0);
+ redraw();
}
if(n == 0){ /* seeking backwards or end of the song */
@@ -679,7 +676,7 @@
for(s--; s != plraw; s--){
if(memcmp(s, "\0# ", 3) == 0 && isdigit(s[3])){
pcur = atoi(s+3);
- redraw(screen, 1);
+ redraw();
return;
}
}
@@ -740,7 +737,7 @@
close(fd);
}
- redraw(screen, 1);
+ redraw();
for(;;){
oldpcur = pcur;
@@ -759,7 +756,7 @@
scroll = plnum-scrollsz-1;
if(scroll < 0)
scroll = 0;
- redraw(screen, 0);
+ redraw();
}else{
pcur = scroll + (m.xy.y - screen->r.min.y)/f->height;
if(m.buttons == 4){
@@ -770,7 +767,9 @@
}
break;
case 1: /* resize */
- redraw(screen, 1);
+ if(getwindow(display, Refnone) < 0)
+ sysfatal("getwindow: %r");
+ redraw();
break;
case 2:
switch(key){
@@ -839,7 +838,9 @@
stop(playercurr);
playercurr = nil;
pcurplaying = -1;
- redraw(screen, 1);
+ freeimage(cover);
+ cover = nil;
+ redraw();
break;
case 'p':
toggle(playercurr);
@@ -867,7 +868,7 @@
scroll = 0;
if(pcur != oldpcur)
- redraw(screen, 0);
+ redraw();
}
}