Added support for scroll wheels on mice. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit bff4028c0241f468762663bd855d5204bf6f93ed
(DIR) parent e0389c6b45e06408954dab63136adddab61bcfb3
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Mon, 2 May 2016 11:21:59 -0500
Added support for scroll wheels on mice.
Diffstat:
doc/sam.1 | 2 ++
libXg/gwin.c | 3 +++
samterm/main.c | 9 +++++++++
3 files changed, 14 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/doc/sam.1 b/doc/sam.1
@@ -763,6 +763,8 @@ The cut and paste operations can also be accessed using combinations of mouse bu
After making a selection with button 1, pressing button 2 with button 1 still pressed will perform a cut operation.
Pressing button 3 with button 1 still pressed will perform a paste operation.
Performing both of these operations (pressing buttons 2 and then 3 with button 1 still pressed) is the equivalent of the snarf operation.
+.Pp
+A scroll wheel, if present, can be used to scroll a document up and down.
.Ss Abnormal termination
If
.Nm
(DIR) diff --git a/libXg/gwin.c b/libXg/gwin.c
@@ -328,6 +328,7 @@ Mouseaction(Widget w, XEvent *e, String *p, Cardinal *np)
case 2: s |= Button2Mask; break;
case 3: s |= Button3Mask; break;
case 4: s |= Button4Mask; break;
+ case 5: s |= Button5Mask; break;
}
break;
case ButtonRelease:
@@ -341,6 +342,7 @@ Mouseaction(Widget w, XEvent *e, String *p, Cardinal *np)
case 2: s &= ~Button2Mask; break;
case 3: s &= ~Button3Mask; break;
case 4: s &= ~Button4Mask; break;
+ case 5: s &= ~Button5Mask; break;
}
break;
case MotionNotify:
@@ -358,6 +360,7 @@ Mouseaction(Widget w, XEvent *e, String *p, Cardinal *np)
if(s & Button2Mask) m.buttons |= 2;
if(s & Button3Mask) m.buttons |= (s & ShiftMask) ? 2 : 4;
if(s & Button4Mask) m.buttons |= 8;
+ if(s & Button5Mask) m.buttons |= 16;
f = ((GwinWidget)w)->gwin.gotmouse;
if(f)
(*f)(&m);
(DIR) diff --git a/samterm/main.c b/samterm/main.c
@@ -132,6 +132,12 @@ main(int argc, char *argv[])
scroll(which, 3, fwdbut == 3 ? 3 : 1);
else
menu3hit();
+ }else if((mouse.buttons&16)){
+ flushtyping(0);
+ center(which, which->origin+which->f.nchars+1);
+ }else if((mouse.buttons&8)){
+ flushtyping(0);
+ outTsll(Torigin, t->tag, which->origin, which->f.maxlines+1);
}
mouseunblock();
}
@@ -668,6 +674,9 @@ type(Flayer *l, int res) /* what a bloody mess this is */
}else{
flast = which;
current(&cmd.l[0]);
+ flushtyping(0);
+ flsetselect(&cmd.l[0], a, a);
+ center(l, a);
}
}else{
if(c==ESC && typeesc>=0){