From 83277da30948858da8203961d77330b7c05dc2f4 Mon Sep 17 00:00:00 2001 From: Sigrid Date: Fri, 23 Apr 2021 11:20:30 +0200 Subject: [PATCH] zuke: fix middle-click restarting playback if held while mouse pointer is moving --- sys/src/cmd/audio/zuke/zuke.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/src/cmd/audio/zuke/zuke.c b/sys/src/cmd/audio/zuke/zuke.c index 62ba83d5a..0d786d603 100644 --- a/sys/src/cmd/audio/zuke/zuke.c +++ b/sys/src/cmd/audio/zuke/zuke.c @@ -1145,7 +1145,7 @@ threadmain(int argc, char **argv) } redraw(1); - oldbuttons = 0; + m.buttons = 0; scrolling = 0; proccreate(plumbaudio, kctl->c, 4096); @@ -1157,6 +1157,7 @@ threadmain(int argc, char **argv) redraw(0); } + oldbuttons = m.buttons; switch(alt(a)){ case Emouse: if(ptinrect(m.xy, seekbar)){ @@ -1182,16 +1183,9 @@ threadmain(int argc, char **argv) break; } - - if(oldbuttons == 0 && !scrolling && ptinrect(m.xy, insetrect(seekbar, -4))){ - if(ptinrect(m.xy, seekbar)) - seekrel(playercurr, seekoff/1000.0 - byteswritten/Bps); - break; - } - n = (m.xy.y - screen->r.min.y)/f->height; - if(oldbuttons == 0 && m.xy.x <= screen->r.min.x+Scrollwidth){ + if(m.xy.x <= screen->r.min.x+Scrollwidth){ if(m.buttons == 1){ scroll = MAX(0, scroll-n-1); redraw(1); @@ -1205,6 +1199,12 @@ threadmain(int argc, char **argv) } } + if(!scrolling && ptinrect(m.xy, insetrect(seekbar, -4))){ + if(ptinrect(m.xy, seekbar)) + seekrel(playercurr, seekoff/1000.0 - byteswritten/Bps); + break; + } + if(scrolling){ if(scrollsz >= pl->n) break; @@ -1215,7 +1215,7 @@ threadmain(int argc, char **argv) n += scroll; if(n < pl->n){ pcur = n; - if(m.buttons == 2){ + if(m.buttons == 2 && oldbuttons == 0){ stop(playercurr); playercurr = newplayer(pcur, 1); start(playercurr);