9front - general discussion about 9front
 help / color / mirror / Atom feed
From: kvik@a-b.xyz
To: 9front@9front.org
Subject: [PATCH] acme: implement 9front scrolling
Date: Thu, 14 May 2020 14:02:16 +0200	[thread overview]
Message-ID: <F34361FFC3DEDDCA0F84700657A8BE80@a-b.xyz> (raw)

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);


                 reply	other threads:[~2020-05-14 14:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F34361FFC3DEDDCA0F84700657A8BE80@a-b.xyz \
    --to=kvik@a-b.xyz \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).