mouse scrolling
This commit is contained in:
parent
863f362631
commit
3d99190131
2 changed files with 52 additions and 9 deletions
25
NOTES
25
NOTES
|
|
@ -164,6 +164,31 @@ acme -W spec
|
||||||
where spec can be WIDTHxHEIGHT, WIDTHxHEIGHT@XMIN,YMIN
|
where spec can be WIDTHxHEIGHT, WIDTHxHEIGHT@XMIN,YMIN
|
||||||
'XMIN YMIN XMAX YMAX' or XMIN,YMIN,XMAX,YMAX.
|
'XMIN YMIN XMAX YMAX' or XMIN,YMIN,XMAX,YMAX.
|
||||||
|
|
||||||
|
* Mouse scrolling
|
||||||
|
|
||||||
|
The libraries pass along buttons 4 and 5, so if you have a
|
||||||
|
scroll mouse and have X configured to send the up/down
|
||||||
|
events as buttons 4 and 5, acme and 9term will scroll in
|
||||||
|
response.
|
||||||
|
|
||||||
|
You will likely need to change your X config to enable this.
|
||||||
|
In my XF86Config-4 I have
|
||||||
|
|
||||||
|
Section "InputDevice"
|
||||||
|
Identifier "Mouse0"
|
||||||
|
Driver "mouse"
|
||||||
|
Option "Buttons" "5"
|
||||||
|
Option "Emulate3Buttons" "off"
|
||||||
|
Option "Protocol" "ImPS/2"
|
||||||
|
Option "ZAxisMapping" "4 5"
|
||||||
|
Option "Device" "/dev/psaux"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
You'll want to find your mouse section (which may have
|
||||||
|
a different Identifier -- just leave it alone) and edit that.
|
||||||
|
The "Buttons", "Protocol", "ZAxisMapping", and "Emulate3Buttons"
|
||||||
|
lines are all important.
|
||||||
|
|
||||||
* Helping out
|
* Helping out
|
||||||
|
|
||||||
If you'd like to help out, great!
|
If you'd like to help out, great!
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,8 @@ void plumbstart(void);
|
||||||
void plumb(uint, uint);
|
void plumb(uint, uint);
|
||||||
void plumbclick(uint*, uint*);
|
void plumbclick(uint*, uint*);
|
||||||
uint insert(Rune*, int, uint, int);
|
uint insert(Rune*, int, uint, int);
|
||||||
|
void scrolldown(int);
|
||||||
|
void scrollup(int);
|
||||||
|
|
||||||
#define runemalloc(n) malloc((n)*sizeof(Rune))
|
#define runemalloc(n) malloc((n)*sizeof(Rune))
|
||||||
#define runerealloc(a, n) realloc(a, (n)*sizeof(Rune))
|
#define runerealloc(a, n) realloc(a, (n)*sizeof(Rune))
|
||||||
|
|
@ -519,7 +521,7 @@ mouse(void)
|
||||||
|
|
||||||
but = t.m.buttons;
|
but = t.m.buttons;
|
||||||
|
|
||||||
if(but != 1 && but != 2 && but != 4)
|
if(but != 1 && but != 2 && but != 4 && but != 8 && but != 16)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ptinrect(t.m.xy, scrollr)) {
|
if (ptinrect(t.m.xy, scrollr)) {
|
||||||
|
|
@ -558,6 +560,12 @@ mouse(void)
|
||||||
plumb(q0, q1);
|
plumb(q0, q1);
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
|
case 8:
|
||||||
|
scrollup(3);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
scrolldown(3);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -794,6 +802,20 @@ namecomplete(void)
|
||||||
return rp;
|
return rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
scrollup(int n)
|
||||||
|
{
|
||||||
|
setorigin(backnl(t.org, n), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
scrolldown(int n)
|
||||||
|
{
|
||||||
|
setorigin(line2q(n), 1);
|
||||||
|
if(t.qh<=t.org+t.f->nchars)
|
||||||
|
consread();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
key(Rune r)
|
key(Rune r)
|
||||||
{
|
{
|
||||||
|
|
@ -804,20 +826,16 @@ key(Rune r)
|
||||||
return;
|
return;
|
||||||
switch(r){
|
switch(r){
|
||||||
case Kpgup:
|
case Kpgup:
|
||||||
setorigin(backnl(t.org, t.f->maxlines*2/3), 1);
|
scrollup(t.f->maxlines*2/3);
|
||||||
return;
|
return;
|
||||||
case Kpgdown:
|
case Kpgdown:
|
||||||
setorigin(line2q(t.f->maxlines*2/3), 1);
|
scrolldown(t.f->maxlines*2/3);
|
||||||
if(t.qh<=t.org+t.f->nchars)
|
|
||||||
consread();
|
|
||||||
return;
|
return;
|
||||||
case Kup:
|
case Kup:
|
||||||
setorigin(backnl(t.org, t.f->maxlines/3), 1);
|
scrollup(t.f->maxlines/3);
|
||||||
return;
|
return;
|
||||||
case Kdown:
|
case Kdown:
|
||||||
setorigin(line2q(t.f->maxlines/3), 1);
|
scrolldown(t.f->maxlines/3);
|
||||||
if(t.qh<=t.org+t.f->nchars)
|
|
||||||
consread();
|
|
||||||
return;
|
return;
|
||||||
case Kleft:
|
case Kleft:
|
||||||
if(t.q0 > 0){
|
if(t.q0 > 0){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue