From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from yow.a-b.xyz ([45.32.152.219]) by ewsd; Thu May 14 10:01:03 EDT 2020 Received: by yow.a-b.xyz (OpenSMTPD) with ESMTPSA id 5bf7210e (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Thu, 14 May 2020 16:00:52 +0200 (CEST) Message-ID: To: 9front@9front.org Subject: [PATCH] acme: implement 9front scrolling Date: Thu, 14 May 2020 14:02:16 +0200 From: kvik@a-b.xyz MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: full-stack enhancement 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);