shithub: riscv

Download patch

ref: c63cd980a4f9d00360d63f61880e12c677bf4b70
parent: fb42cf0dda78d6a54511d1bf848f1db383591b07
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 29 03:28:47 EDT 2020

acme: revert stray changes

forgot I had local changes when testing, re-revert scrolling.

--- a/sys/src/cmd/acme/acme.c
+++ b/sys/src/cmd/acme/acme.c
@@ -513,13 +513,8 @@
 				but = 2;
 			else if(m.buttons == 4)
 				but = 3;
-			else if(m.buttons == 8)
-				but = 4;
-			else if(m.buttons == 16)
-				but = 5;
 			barttext = t;
-			if(t->what==Body && w != nil
-			&& (ptinrect(m.xy, t->scrollr) || (m.buttons & (8|16)))){
+			if(t->what==Body && ptinrect(m.xy, t->scrollr)){
 				if(but){
 					winlock(w, 'M');
 					t->eq0 = ~0;
@@ -526,6 +521,18 @@
 					textscroll(t, but);
 					winunlock(w);
 				}
+				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)){
--- a/sys/src/cmd/acme/scrl.c
+++ b/sys/src/cmd/acme/scrl.c
@@ -132,7 +132,7 @@
 			readmouse(mousectl);
 			continue;
 		}
-		if(but == 1 || but == 4)
+		if(but == 1)
 			p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
 		else
 			p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
@@ -140,7 +140,7 @@
 			textsetorigin(t, p0, TRUE);
 		oldp0 = p0;
 		/* debounce */
-		if(first && but < 4){
+		if(first){
 			flushimage(display, 1);
 			sleep(200);
 			nbrecv(mousectl->c, &mousectl->Mouse);