acme: reverting scroll change, causes continuous scrolling with scrollwheel

This commit is contained in:
cinap_lenrek 2020-08-03 21:51:25 +02:00
parent 57362e0c8c
commit 053a6526e2
2 changed files with 15 additions and 8 deletions
sys/src/cmd/acme

View file

@ -513,13 +513,8 @@ mousethread(void *)
but = 2; but = 2;
else if(m.buttons == 4) else if(m.buttons == 4)
but = 3; but = 3;
else if(m.buttons == 8)
but = 4;
else if(m.buttons == 16)
but = 5;
barttext = t; barttext = t;
if(t->what==Body && w != nil if(t->what==Body && ptinrect(m.xy, t->scrollr)){
&& (ptinrect(m.xy, t->scrollr) || (m.buttons & (8|16)))){
if(but){ if(but){
winlock(w, 'M'); winlock(w, 'M');
t->eq0 = ~0; t->eq0 = ~0;
@ -528,6 +523,18 @@ mousethread(void *)
} }
goto Continue; goto Continue;
} }
/* scroll buttons, wheels, etc. */
if(t->what==Body && w != nil && (m.buttons & (8|16))){
if(m.buttons & 8)
but = Kscrolloneup;
else
but = Kscrollonedown;
winlock(w, 'M');
t->eq0 = ~0;
texttype(t, but);
winunlock(w);
goto Continue;
}
if(ptinrect(m.xy, t->scrollr)){ if(ptinrect(m.xy, t->scrollr)){
if(but){ if(but){
if(t->what == Columntag) if(t->what == Columntag)

View file

@ -132,7 +132,7 @@ textscroll(Text *t, int but)
readmouse(mousectl); readmouse(mousectl);
continue; continue;
} }
if(but == 1 || but == 4) if(but == 1)
p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height); p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
else else
p0 = t->org+frcharofpt(t, Pt(s.max.x, my)); p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
@ -140,7 +140,7 @@ textscroll(Text *t, int but)
textsetorigin(t, p0, TRUE); textsetorigin(t, p0, TRUE);
oldp0 = p0; oldp0 = p0;
/* debounce */ /* debounce */
if(first && but < 4){ if(first){
flushimage(display, 1); flushimage(display, 1);
sleep(200); sleep(200);
nbrecv(mousectl->c, &mousectl->Mouse); nbrecv(mousectl->c, &mousectl->Mouse);