9front - general discussion about 9front
 help / color / mirror / Atom feed
* [PATCH] acme: implement 9front scrolling
@ 2020-05-14 12:02 kvik
  0 siblings, 0 replies; only message in thread
From: kvik @ 2020-05-14 12:02 UTC (permalink / raw)
  To: 9front

This does away with one-line scrolling and implements scroll wheel
actions as seen in rio and sam.

It makes sense (to me) to unify scrolling behaviour across GUI programs,
but it is understandable that long-time acme users may feel otherwise.

Plaese feel invited to complain if this bugs you.

diff -r 35459627f401 sys/src/cmd/acme/acme.c
--- a/sys/src/cmd/acme/acme.c	Wed May 13 18:50:01 2020 -0700
+++ b/sys/src/cmd/acme/acme.c	Thu May 14 13:24:28 2020 +0200
@@ -506,8 +506,13 @@
 				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 && ptinrect(m.xy, t->scrollr)){
+			if(t->what==Body && w != nil
+			&& (ptinrect(m.xy, t->scrollr) || (m.buttons & (8|16)))){
 				if(but){
 					winlock(w, 'M');
 					t->eq0 = ~0;
@@ -516,18 +521,6 @@
 				}
 				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(but){
 					if(t->what == Columntag)
diff -r 35459627f401 sys/src/cmd/acme/scrl.c
--- a/sys/src/cmd/acme/scrl.c	Wed May 13 18:50:01 2020 -0700
+++ b/sys/src/cmd/acme/scrl.c	Thu May 14 13:24:28 2020 +0200
@@ -132,7 +132,7 @@
 			readmouse(mousectl);
 			continue;
 		}
-		if(but == 1)
+		if(but == 1 || but == 4)
 			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){
+		if(first && but < 4){
 			flushimage(display, 1);
 			sleep(200);
 			nbrecv(mousectl->c, &mousectl->Mouse);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-14 14:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 12:02 [PATCH] acme: implement 9front scrolling kvik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).