diff options
author | kvik <kvik@a-b.xyz> | 2020-06-11 15:33:57 +0200 |
---|---|---|
committer | kvik <kvik@a-b.xyz> | 2020-06-11 15:33:57 +0200 |
commit | 57362e0c8c3b75cae8f3bc2735ffc6e30e19fe03 (patch) | |
tree | 606cc1b5a7d2a0b5cd16185dbcd751b9d82c7ad1 /sys/src/cmd/acme/acme.c | |
parent | db6e26d55eb5bdb22ea231642051ff9a1562239b (diff) |
acme: implement position-dependent scroll-wheel scrolling
This brings acme scrolling behaviour in line with that of 9front's rio
and sam, where the amount scrolled varies with a vertical position of
the pointer within the window, similar to how the scrollbar works.
At some point it would be good to implement a line-at-a-time scrolling
when the Shift key is pressed, as seen in rio. For this to happen the
acme keyboard input needs to be rewritten in terms of /dev/kbd instead
of relying on keyboard(2) -- that is, the /dev/cons interface.
Diffstat (limited to 'sys/src/cmd/acme/acme.c')
-rw-r--r-- | sys/src/cmd/acme/acme.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/sys/src/cmd/acme/acme.c b/sys/src/cmd/acme/acme.c index e874d3554..96a7d6b03 100644 --- a/sys/src/cmd/acme/acme.c +++ b/sys/src/cmd/acme/acme.c @@ -513,8 +513,13 @@ mousethread(void *) 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; @@ -523,18 +528,6 @@ mousethread(void *) } 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) |